LunaDLL/LunaLUA help thread
-
- https://www.youtube.com/watch?v=BODxOghVmko
- Posts: 1812
- Joined: 10 years ago
- First name: Mack
- https://rixithechao.talkhaus.com/
Re: LunaDLL help thread
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.
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.
Delightful Adventure Enhanced is out now!
There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link
(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)
Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link
(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)
Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
Re: LunaDLL help thread
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.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.
-
- Posts: 0
- Joined: 9 years ago
Re: LunaDLL help thread
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...
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...
- Karatekid5
- Welcome to the resort!
- Posts: 78
- Joined: 14 years ago
- Location: Pennsylvania
- Contact:
Re: LunaDLL help thread
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).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.
-
- Posts: 0
- Joined: 9 years ago
Re: LunaDLL help thread
maybe you can make the code like this:
IDK if that would work though.
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
-
- Posts: 0
- Joined: 9 years ago
Re: LunaDLL help thread
What i'm currently working on :3
Re: LunaDLL help thread
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 :/
-
- Posts: 0
- Joined: 9 years ago
Re: LunaDLL help thread
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...
Re: LunaDLL help thread
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.
Re: LunaDLL help thread
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
Here's my lunadll.txt, lunadll.lua, and lunaworld.lua and the level.
http://speedy.sh/U2RzK/raocoins.zip
Re: LunaDLL help thread
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".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
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
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.
Re: LunaDLL help thread
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.
Re: LunaDLL help thread
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.
Re: LunaDLL help thread
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.
Re: LunaDLL help thread
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.
Re: LunaDLL help thread
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).Kil wrote:Probably you just have to check a bunch of states, like the player forced powerup state.
Re: LunaDLL help thread
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.
Re: LunaDLL help thread
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
It's gonna be pretty bang-up that PGW is open source and has a lot of its stuff modifiable by .ini files
Re: LunaDLL help thread
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.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).
- Karatekid5
- Welcome to the resort!
- Posts: 78
- Joined: 14 years ago
- Location: Pennsylvania
- Contact:
Re: LunaDLL help thread
Is there a way to make an enemy immune to being slide killed?
Re: LunaDLL help thread
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.
PS. Yes I have used CE before to change numbers in games.
-
- https://www.youtube.com/watch?v=BODxOghVmko
- Posts: 1812
- Joined: 10 years ago
- First name: Mack
- https://rixithechao.talkhaus.com/
Re: LunaDLL help thread
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:
We're also working on wiki documentation, which will include stuff like tutorials and example code, so that should help as well.
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
Delightful Adventure Enhanced is out now!
There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link
(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)
Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link
(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)
Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
- Karatekid5
- Welcome to the resort!
- Posts: 78
- Joined: 14 years ago
- Location: Pennsylvania
- Contact:
Re: LunaDLL help thread
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:
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.
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
Re: LunaDLL help thread
NPCs can't trigger block trigger, because the way block trigger works right now is to collision check every single block in the level against demo's rectangle, and to do that with every single NPC in the level would almost certainly cause bigtime lag.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
- Karatekid5
- Welcome to the resort!
- Posts: 78
- Joined: 14 years ago
- Location: Pennsylvania
- Contact:
Re: LunaDLL help thread
Ah, alright then, I'll see if I can find another way. Though, is there a way to disable sliding?Kil wrote:NPCs can't trigger block trigger, because the way block trigger works right now is to collision check every single block in the level against demo's rectangle, and to do that with every single NPC in the level would almost certainly cause bigtime lag.