(shouting)

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

Luckily Wohlstand collected some of the stuff:
http://engine.wohlnet.ru/docs/Collected/LunaDLL/
User avatar
AuraPaladin
Posts: 1
Joined: 9 years ago
Contact:

Re: LunaDLL help thread

Post by AuraPaladin »

EDIT: Looks like I've found the problem - it didn't like my filepath, but once I took the .lvl file out of the level folder it started working.

Apologies for the simplicity of my problem, but LunaDLL's really not liking me that much (Read: Not working at all) and I'm at my wit's end trying to make sense of how it's supposed to be installed.

As an example block of code, I'm currently using the code that gives Mother Brain 1HP from the (thankfully salvaged) LunaDLL tutorial posted above. As it is, though, Mother Brain's still taking 10 hits to defeat.

Here's my SMBX folder.
http://i.imgur.com/X8vZzDQ.jpg

As you can see, LuaScriptsLib, LunaDLL, lua5.1 and lua51 are all there - I literally just downloaded the folder and extracted to this one.

Here's my level folder - currently within worlds itself.
http://i.imgur.com/d7Jlcbd.jpg


lunadll.txt's up the top there, and it's definitely the right folder, as npc-101 does indeed change the sprite.

Finally, here's lunadll.txt itselg
http://i.imgur.com/J4YG87k.jpg

This code's straight-up copied from the tutorial, so I'm fairly certain it's correct.

If needs be, I can provide additional documentation. Any and all help would be appreciated.
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

It's looking for specific filenames. Are you sure it's actually lunadll.txt or lunadll.lua and not like lunadll.txt.txt or something? The window 8 extension hiding stuff isn't helping you here.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Wohlstand
Moondust and TheXTech developer
Posts: 186
Joined: 10 years ago
First name: Vitaly
Pronouns: he/him/his
Location: Moscow, Russia

Re: LunaDLL help thread

Post by Wohlstand »

Kil wrote:It's looking for specific filenames. Are you sure it's actually lunadll.txt or lunadll.lua and not like lunadll.txt.txt or something? The window 8 extension hiding stuff isn't helping you here.
Therefore:
1) Open control panel
2) open folder properties
3) open "View" tab
4) switch to "Show hidden files"
Disable "hide extensions of registered files"
Disable "Hide propected system files"
5) press Ok and check your folders again
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL help thread

Post by Willhart »

Kil wrote:Ok I found a bug with the builtin sprites. It'll be fixed when I make builtin sprites not suck (for SDS 2?) but I can't update lunadll at the moment since im in the middle of a large update. But you could still use a phanto right now by copying the phanto definition into your file. Here's a complete working file for that level. Also I got rid of the cursed key problem in this one.

Code: Select all

///////////////////////////////
/// -- Phanto definition -- ///
#-1

$MyPhanto,SpriteBlueprint,0,0,0,0,0,0

$DECEL,Deccelerate,0.04,0.04,0,0,0,0

// These are the 4 random IDs I know a key can have
$KEY1,PlayerHoldingSprite,31,0,0,55000,0,0
$KEY2,PlayerHoldingSprite,15,0,0,55000,0,0
$KEY3,PlayerHoldingSprite,64,0,0,55000,0,0
$KEY4,PlayerHoldingSprite,192,0,0,55000,0,0

$MOVE,PhaseMove,0,0,0,0,0,0

$DRAW,RelativeDraw,0,0,0,0,0

$PHANHITBOX,SetHitbox,2,2,28,28,1,0

$MyPhanto,Attach,0,0,0,0,0,DECEL
$MyPhanto,Attach,0,0,0,0,0,KEY1
$MyPhanto,Attach,0,0,0,0,0,KEY2
$MyPhanto,Attach,0,0,0,0,0,KEY3
$MyPhanto,Attach,0,0,0,0,0,KEY4
$MyPhanto,Attach,0,0,0,0,0,MOVE
$MyPhanto,Attach,1,0,0,0,0,DRAW
$MyPhanto,Attach,2,0,0,0,0,PHANHITBOX

#55000
AccelToPlayer,0.095,0.095,5.6,0,1,0
OnPlayerCollide,0,0,0,55001,1,0
OnPlayerDistance,3000,0,0,55002,1,0

#55001
HarmPlayer,0,0,0,0,1,0

#55002
TeleportNearPlayer,1000,0,0,0,1,0

//////////////////////////////////

// Level code
// Load image phanto.bmp into image slot 2 with transparency color FF00DC (pink)
#-1
LoadImage,2,0xDC00FF,0,0,0,phanto.bmp

#0
PlaceSprite,0,2,-159552,-160352,0,MyPhanto
Also that way gives you the ability to customize the speed of the phanto if you want.
I wish these new lunadll features were documented better.
User avatar
Ittababy
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Post by Ittababy »

Is there a way to make a boo that only moves horizontally? I have a plan to make the boohemoth~
A very shy ghost.
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL help thread

Post by Willhart »

OnCustomCheat stops randomly working for me. I wonder if it has something to do with the bge_editor. After editing the level with it the cheat did not work anymore, even though other lunadll events were still functioning.

Code: Select all

#1
OnCustomCheat,0,0,1,6000,0,cat

#6000
TriggerSMBXEvent,0,0,0,0,1,cheat1

#END
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

Ittababy wrote:Is there a way to make a boo that only moves horizontally? I have a plan to make the boohemoth~
It sounds like something you can do with just built-in smbx npc settings.
Willhart wrote:OnCustomCheat stops randomly working for me. I wonder if it has something to do with the bge_editor. After editing the level with it the cheat did not work anymore, even though other lunadll events were still functioning.

Code: Select all

#1
OnCustomCheat,0,0,1,6000,0,cat

#6000
TriggerSMBXEvent,0,0,0,0,1,cheat1

#END
It's probably changing the event name somehow, but who knows. If the event isn't named exactly "cheat1" and has some space or unix carriage return at the end of it, it won't work.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Kil wrote:
Ittababy wrote:Is there a way to make a boo that only moves horizontally? I have a plan to make the boohemoth~
It sounds like something you can do with just built-in smbx npc settings.
I don't believe you can, since SMBX only allows one speed setting, which for Boos will stop them following the player entirely, and will make them bob up and down.

You can, however, use LunaDLL to reset the y speed of the npc each frame, which will allow it to move only horizontally.
Image
Image
Image
Image
Image
User avatar
kitikami
Posts: 853
Joined: 10 years ago

Re: LunaDLL help thread

Post by kitikami »

I think Koopa Devil Mansion from MAGLX had boos that only move horizontally. I haven't looked at how they did that, but I don't think MAGLX used LunaDLL, did it? Although if you are using LunaDLL anyway, it might just be simpler to keep the y-speed at zero like Hoeloe said even if it is possible to do without Luna.
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4200
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL help thread

Post by SAJewers »

They way that level did it was set the speed of the ghost to 100. The speed flag only effects the horizontal speed of the NPC, so it ends up over the player's head before it travels any significant distance vertically. It's still moving vertically, you just don't notice it.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Ittababy
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Post by Ittababy »

Hoeloe wrote: I don't believe you can, since SMBX only allows one speed setting, which for Boos will stop them following the player entirely, and will make them bob up and down.

You can, however, use LunaDLL to reset the y speed of the npc each frame, which will allow it to move only horizontally.
How do I do that? I have only the most basic understanding of programming.
A very shy ghost.
User avatar
WestonSmith
Bunny
Posts: 188
Joined: 11 years ago

Re: LunaDLL help thread

Post by WestonSmith »

Anyone know if its possible to silence sound effects with LunaDLL? Or even in general? My understanding is that they can only be changed by adjusting the SFX folder, but I'm looking to remove them for a single level only.

Thoughts?
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4200
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL help thread

Post by SAJewers »

Check out the SDL stuff. It'll let you set your sound effects and default music on a per-level basis. Use that, and make your sounds silent.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
ohmato
hey idiot
Posts: 792
Joined: 9 years ago
Location: location, location
Contact:

Re: LunaDLL help thread

Post by ohmato »

Is there a way to edit NPC memory in a way that convinces SMBX that an NPC is "onscreen"? I have a layer attached to an NPC to make it bob up and down, but it stops when the NPC goes too far offscreen.
Image
Image
Image
Image
Image
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL help thread

Post by Rednaxela »

arabsalmon wrote:Is there a way to edit NPC memory in a way that convinces SMBX that an NPC is "onscreen"? I have a layer attached to an NPC to make it bob up and down, but it stops when the NPC goes too far offscreen.
Yep, NPC offset 0x12A is the "despawn countdown". If this is constantly reset to a non-zero value with LunaDLL/LunaLua, it'll never despawn and should keep working for your layer control purposes.
I'd imagine it can be done in some way with autocode, but since LunaLua is what I know, example with that:

Code: Select all

-- Run each tick
function onLoop()
	-- Find all NPCs with id 180, in the same section the player is currently in
	for i,npc in pairs(findnpcs(180, player.section)) do
		-- Set NPCs with id 180 to never despawn
		npc:mem(0x12A, FIELD_WORD, 120)
	end
end
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL help thread

Post by Willhart »

Willhart wrote:OnCustomCheat stops randomly working for me. I wonder if it has something to do with the bge_editor. After editing the level with it the cheat did not work anymore, even though other lunadll events were still functioning.

Code: Select all

#1
OnCustomCheat,0,0,1,6000,0,cat

#6000
TriggerSMBXEvent,0,0,0,0,1,cheat1

#END
I now know, why this stopped working earlier. I had the debugger open, and was accidentally writing to it during gameplay. The character still moved and recognized the inputs, but the code was not registered.
User avatar
ohmato
hey idiot
Posts: 792
Joined: 9 years ago
Location: location, location
Contact:

Re: LunaDLL help thread

Post by ohmato »

Rednaxela wrote:Yep, NPC offset 0x12A is the "despawn countdown". If this is constantly reset to a non-zero value with LunaDLL/LunaLua, it'll never despawn and should keep working for your layer control purposes.
I'd imagine it can be done in some way with autocode, but since LunaLua is what I know, example with that:

Code: Select all

-- Run each tick
function onLoop()
	-- Find all NPCs with id 180, in the same section the player is currently in
	for i,npc in pairs(findnpcs(180, player.section)) do
		-- Set NPCs with id 180 to never despawn
		npc:mem(0x12A, FIELD_WORD, 120)
	end
end
Thanks! Is there anywhere I can find a comprehensive list of these memory offsets? I was using the one on Wohlnet, but I didn't see this one listed. It'd be convenient if there was anything else I needed to alter.
Image
Image
Image
Image
Image
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

This is the most up-to-date, because it is the development repository of LunaDLL:
Player Memory Offset
NPC Memory Offset
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL help thread

Post by Rednaxela »

I discovered a pair of new memory offsets in the NPC structure which may be useful to people:

Code: Select all

0x+26	w	= Invincibility frames #1 (counts down 1 per frame)
0x+156	w	= Invincibility frames #2 (counts down 1 per frame)
These normally get used by the engine for things that takes multiple hits gets hit, to give it a short number of invincibility frames. When you manually set this however, it can grant (temporary unless you keep re-setting it) invincibility to any enemy.

Also, here's an important quirk about them:
If you force counter #1 to a non-zero value, counter #2 never gets incremented when you hit the enemy
If you force counter #2 to a non-zero value, counter #1 still gets triggered when you hit the enemy.

Turns out having BOTH of these can be very handy! Why? Because you can force counter #2 to non-zero to make an enemy invincible, while using counter #1 being triggered to detect when your NPC gets 'hit', allowing for some easier ways to implement custom NPC-got-hit behaviour in LunaLua, even for enemies that would normally be killed in one hit ;)

MAJOR EDIT:See my update post below. #1 is only for the elf-sword and #2 is general purpose.
Last edited by Rednaxela 9 years ago, edited 1 time in total.
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL help thread

Post by Rednaxela »

A clarification to some existing offsets:

Code: Select all

// 0x+88	qw	= Height
// 0x+90	qw	= Width
A correction to what Spawn X and Spawn Y should be:

Code: Select all

// 0x+A8	qw	= Spawn X
// 0x+B0	qw	= Spawn Y
Also some more newfound NPC memory offsets:

Code: Select all

// 0x+B8  qw  = Copy of 0x88? Maybe "Spawn Height" to match the pattern?
// 0x+C0  qw  = Copy of 0x90? Maybe "Spawn Width" to match the pattern?

// 0x+D8  f   = Unknown float, set to 1.0 normally?
// 0x+DC  w   = NPC identity (Unknown use, unlike 0x+E2 it does not control sprite or known behaviour, but starts with the same value)

// 0x+EC	f	= Direction faced (difference from 0x118 is unknown, but it is set based on NPC direction)

// 0x+120	w	= Collide with block (set to -1/0xFFFF for a single frame when bouncing off a block)

// 0x+138 w     = Seems to be set if the NPC is contained within another NPC. (i.e. If this NPC is inside a mother-brain-jar, this is 208) Forcing this to 208 causes it to be frozen as if in a jar. Forcing to other values can cause other varied effects.
I also know that 0x+FC and 0x+FE appear to both be used in counting when dry bones gets back up again, which means 0xFC at very least is a multi-purpose NPC timer used for both dry bones, grabbable gun, and possibly other things
0x+106 (w) is also used in some fashion when a dry bones' collapsed bones start to wiggle.
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

What a collection of new offsets :D.... I will update the repo with these new offsets, thx for the work!
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL help thread

Post by Rednaxela »

I have a clarification about the 0x+26 and 0x+156 invincibility timer-ish offsets that I discovered.

0x+26 only appears to be used when the NPC is hit with the elf's sword. It's only set to non-zero by the engine when hit by the elf's sword.... and forcing it to non-zero only affects whether the elf's sword can hit it. (By forcing this to non-zero always, you can make an enemy immune to the elf's sword without affecting other things that could hurt it. Some people may find this useful. Note, this does not mean immunity to the elf, only to his sword. For example a goomba with this set can still be stomped by the elf.)

0x+156 appears to be a more general invincibility timer, which is triggered by and effects all things which may hurt an NPC.
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL help thread

Post by Rednaxela »

Some more useful NPC offsets to add:

Code: Select all

// 0x+00A w = Set to 2 when touching a block below
// 0x+00C w = Set to 2 when touching a block to the left
// 0x+00E w = Set to 2 when touching a block above
// 0x+010 w = Set to 2 when touching a block to the right
// (Forcing these to a value doesn't affect behaviour, the engine presumably resets before using them)
EDIT:
Also, so far as I can tell 0x+136 should be

Code: Select all

// 0x+136	w	= 0xFFFF = Hit by and hits other NPCs.
For example, if you set this on a thwomp, then it becomes vulnerable to rinka circles, and if a koopa walks into it's side they both die. It does *not* however allow collision with certainly particular things like bowser statue fire for some reason.

This flag seems to be set when the player grabs/throws an NPC.
This is also the flag that the Bowser bosses set while falling, causing them to kill other enemies when slamming down, but not otherwise.

It also has some other side effects, such as:
- It triggers upside-down animations and behaviour as if just thrown for certain enemies such as Tweeter
- When set on a SM64 Bully, it causes the Bully to not do anything, and it doesn't even collide with other NPCs like most other NPCs seem to when this flag is set.
Rixithechao
https://www.youtube.com/watch?v=BODxOghVmko
Posts: 1812
Joined: 10 years ago
First name: Mack
https://rixithechao.talkhaus.com/

Re: LunaDLL help thread

Post by Rixithechao »

Oh, dang, these will all be really helpful! I'm going to have to incorporate some of them into the new cinematX patch! :D

For future reference, there's a thread for LunaDLL discoveries over here:
viewtopic.php?f=36&t=15005
Delightful Adventure Enhanced is out now!

Image

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)
Post Reply