(shouting)

LunaDLL/LunaLUA help thread

The second SMBX collab!
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

Yeah that doesnt work but was working not too long ago. I'll figure it out.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

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.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

ps, I think I just fixed a2mbxt appearing as a virus, and it no longer should with most antiviruses

http://www.gamearchaeology.com/a2mbxt.exe
DON'T PM me. Ask your question in the help thread so everyone can be answered.
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:ps, I think I just fixed a2mbxt appearing as a virus, and it no longer should with most antiviruses

http://www.gamearchaeology.com/a2mbxt.exe
Avast still prevented it automatically. Hopefully it works for others.

Infection: Win32:Evo-gen [Susp]
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

That's unfortunate. According to this online scan it was showing barely any detections https://www.virustotal.com/en/file/4ddc ... 413193242/
https://www.metascan-online.com/en/scan ... a35cf740e0
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Just spotted something on the reference page, in the memory map of the player object:

Code: Select all

//+0x66		w	= Unknown66
//+0x68		w	= Unknown68
//+0x7A		w	= Unknown70
//+0x7C		w	= Unknown72
That's an awfully big memory gap there. I'd have expected the next few values to be:

0x6A
0x6C
0x6E
0x70
0x72
0x74
0x76
0x78
0x7A

What happened to these values? Why is 0x68 mapped as a 640-bit word?
Image
Image
Image
Image
Image
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

I only marked down addresses which the game actually tried to use
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Kil wrote:I only marked down addresses which the game actually tried to use
Ah, that makes sense. I was just having a look to see if I can detect whether the player has finished the level or not (so I can run some code immediately before returning to the world map), so I was looking for some unknown timers or flags. Good to know it's just because the game doesn't use them, though.
Image
Image
Image
Image
Image
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

By the way detecting that sounds rough, considering all the ways you can leave end or otherwise exit a level, and I don't know of any really convenient memory you can scan for that or anything. I suppose you could do it with tons and tons of conditional checks of various things.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Kil wrote:By the way detecting that sounds rough, considering all the ways you can leave end or otherwise exit a level, and I don't know of any really convenient memory you can scan for that or anything. I suppose you could do it with tons and tons of conditional checks of various things.
I can cover most level exits using Lua's findnpcs function, but this doesn't account for a) key exits and b) warp/offscreen exits.

An alternative would be to find the ways the player can leave the level without finishing it. I believe this is just by death or by quitting, which might be simpler to detect...
Image
Image
Image
Image
Image
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

I know the function npcs_to_coins which is called when the player hits the exit. With xrefs (IDA's Reference Language :P) I can lookup which function calls this function. But currently I am heavly busy :/
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Kevsoft wrote:I know the function npcs_to_coins which is called when the player hits the exit. With xrefs (IDA's Reference Language :P) I can lookup which function calls this function. But currently I am heavly busy :/
That could help, but also doesn't cover all cases, so it could potentially lead nowhere.
Image
Image
Image
Image
Image
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

I spent about 2 hours finding it, now have a good use for it!
0x00B2C59E at type WORD
0x00B2C59E = 0 means currently not winning
0x00B2C59E = ? means current winning at win-type '?'
TiKi
Posts: 709
Joined: 11 years ago

Re: LunaDLL help thread

Post by TiKi »

Kevsoft wrote:I spent about 2 hours finding it, now have a good use for it!
0x00B2C59E at type WORD
0x00B2C59E = 0 means currently not winning
0x00B2C59E = ? means current winning at win-type '?'
Image
Finally a way to remove the mercy block's invincible mode!
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Kevsoft wrote:I spent about 2 hours finding it, now have a good use for it!
0x00B2C59E at type WORD
0x00B2C59E = 0 means currently not winning
0x00B2C59E = ? means current winning at win-type '?'
This is super useful! I've managed to build a currency system now.

It's definitely worth noting that this doesn't work for "warp" level endings (doors and the like), but that shouldn't be too much of an issue.
Image
Image
Image
Image
Image
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

Just checked, if you keep setting it to 0 you can basically deactivate winning. Kinda funny :P
User avatar
Mabel
Just west of wierd
Posts: 302
Joined: 10 years ago
https://marbels.talkhaus.com/

Re: LunaDLL help thread

Post by Mabel »

Looks like those Gravity codes might have some issues...

-play level with custom gravity in it
-die/exit
-go to another level
-gravity still on

just putting this out here so if you use such codes in your level that this happens...this might even be just editor only...


theres been alot of posts lately so this was probably brough up before so if it has this is just an empty post

Image
Image
Image Image
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

No you're right, you should be careful with those because they are never reset back to normal values. It'd be nice if someone reset them in the lunaworld file.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
TiKi
Posts: 709
Joined: 11 years ago

Re: LunaDLL help thread

Post by TiKi »

So would normal gravity in lunaworld overwrite the custom gravity? I hope not.

Also custom sprites: let's say I set a custom sprite to display when the player has 1 heart. If I got another heart would it disappear or would it keep displaying until told to disappear?
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

TiKi wrote:So would normal gravity in lunaworld overwrite the custom gravity? I hope not.
That's why you should put the gravity reset in the level load section of lunaworld.
Also custom sprites: let's say I set a custom sprite to display when the player has 1 heart. If I got another heart would it disappear or would it keep displaying until told to disappear?
That's entirely dependent on how you're displaying the sprite.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL help thread

Post by Kevsoft »

Personally I would just hardcode a reset code in the dll to prevent such a thing.
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

If someone tells me all the default values that need to be reset, I would :P
DON'T PM me. Ask your question in the help thread so everyone can be answered.
TiKi
Posts: 709
Joined: 11 years ago

Re: LunaDLL help thread

Post by TiKi »

Man, lunadll gets better every day

So about speed: wouldn't there be some value SMBX sets the cap to, like "if player is above x set acceleration to 0"? One that could be modified?
Kil
Posts: 13
Joined: 15 years ago

Re: LunaDLL help thread

Post by Kil »

That seems like it would be in the speed processing code, probably not a modifiable memory location
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Oddwrath
The ghost of talkhaus unlikely
Posts: 117
Joined: 9 years ago
Pronouns: she/her
Location: Merry Old Europe

Re: LunaDLL help thread

Post by Oddwrath »

In LunaLua, what is the difference between RECT and RECTd? And which one would be the TriggerZone of LunaLua?
:lesbian_pride: my avatar is from that obake game made in 2001 that you cannot play anymore unless you run it through a virtual machine and apply a locale patch
Post Reply