Page 9 of 59

Re: LunaDLL help thread

Posted: 13 May 2014, 05:00
by Kil
Wait if smbx already saves these memory locations then this should already be working. You should be able to set those values using lunadll and smbx will handle saving and loading them.

Re: LunaDLL help thread

Posted: 13 May 2014, 06:37
by Rixithechao
You said "if they're truly 100% unused", so I was concerned about the possibility that the game could still write to those addresses even if it's not reading them. If that's the case then it'd be best to store the data somewhere we know the game won't access and just use those memory locations for saving and loading.

But yeah, it's entirely possible that this whole convoluted scheme is completely unnecessary, or that it wouldn't work anyway. Instead of blathering on about it here I really should just go and try it out already.

Re: LunaDLL help thread

Posted: 13 May 2014, 07:26
by Kil
i did find a couple of weird memory locations that seemed untouched in the player memory. It all depends on if SMBX saves and loads them automatically. That's one thing I never tested about them.

Re: LunaDLL help thread

Posted: 13 May 2014, 07:54
by Joseph Staleknight
Is it possible to trigger events on a player's death? I've been trying to find out how that's possible, and the closest I got was seeing which address had the player's death state (0x13C) and trying to use OnPlayerMem on it.

Re: LunaDLL help thread

Posted: 13 May 2014, 08:14
by Kil
That is how you do it yeah.

I think it's -1 when the player is dead.

Re: LunaDLL help thread

Posted: 13 May 2014, 19:28
by TiKi
How would I go about letting some event (OnPlayerMem) trigger another LunaDLL event? I know they're some number, but how do I find the number of a certain Luna event?

Re: LunaDLL help thread

Posted: 13 May 2014, 20:02
by Joseph Staleknight
Kil wrote:That is how you do it yeah.

I think it's -1 when the player is dead.
Okay, I tried that, but when I kill the player my custom event doesn't seem to trigger. For reference, here's my LunaDLL code:

Code: Select all

#0
DebugPrint,0,0,0,0,0,0
OnPlayerMem,0x13C,-1,0,1007,0,w

#1
ShowText,0,25,475,3,180,PURIFICATION IN PROGRESS...
Timer,0,1000,0,0,180,0
OnPlayerMem,0x13C,-1,0,1007,0,w

#1000
OnPlayerMem,0xF0,1,0,1001,0,w
OnPlayerMem,0xF0,2,0,1002,0,w
OnPlayerMem,0xF0,3,0,1003,0,w
OnPlayerMem,0xF0,4,0,1004,0,w
OnPlayerMem,0xF0,5,0,1005,0,w

#1001
ShowText,0,25,475,3,1,DEMO
Trigger,0,1006,0,0,1,0

#1002
ShowText,0,25,475,3,1,IRIS
Trigger,0,1006,0,0,1,0

#1003
ShowText,0,25,475,3,1,KOOD
Trigger,0,1006,0,0,1,0

#1004
ShowText,0,25,475,3,1,raocow
Trigger,0,1006,0,0,1,0

#1005
ShowText,0,25,475,3,1,SHEATH
Trigger,0,1006,0,0,1,0

#1006
ShowText,0,200,475,3,1,PURE
ShowText,0,300,475,3,1,HP 0001
ShowText,0,450,475,3,1,CP 000
ShowText,0,600,475,3,1,ATTACK
ShowText,0,600,500,3,1,COMPETENCE
ShowText,0,600,525,3,1,OBJECTS
ShowText,0,600,550,3,1,FLEE <
OnPlayerMem,0x13C,-1,0,1007,0,w

#1007
DeleteEventsFrom,1006,0,0,0,1,0
ShowText,0,200,475,3,1,DEAD
ShowText,0,300,475,3,1,HP 0000
ShowText,0,450,475,3,1,CP 000
ShowText,0,600,475,3,1,ATTACK
ShowText,0,600,500,3,1,COMPETENCE
ShowText,0,600,525,3,1,OBJECTS
ShowText,0,600,550,3,1,FLEE <

#END
Yes, I tried using OnPlayerMem for blocks 0, 1, and 1006. I don't think any of them fired.

Re: LunaDLL help thread

Posted: 13 May 2014, 21:22
by Kil
I dunno what's wrong with that but I thought of probably a better way. Near the state memory there is actually a death timer which is better understood. The fire condition can be "if death timer is greater than 0"

OnPlayerMem,0x13E,0,1,1007,0,w

Re: LunaDLL help thread

Posted: 13 May 2014, 21:23
by Kil
TiKi wrote:How would I go about letting some event (OnPlayerMem) trigger another LunaDLL event? I know they're some number, but how do I find the number of a certain Luna event?
Not sure what you mean. Whatever #number you give your custom event, that's the number you use to trigger it.

OnPlayerMem,0x13C,-1,0,1007,0,w
will trigger #1007

Re: LunaDLL help thread

Posted: 13 May 2014, 21:32
by Joseph Staleknight
Kil wrote:I dunno what's wrong with that but I thought of probably a better way. Near the state memory there is actually a death timer which is better understood. The fire condition can be "if death timer is greater than 0"

OnPlayerMem,0x13E,0,1,1007,0,w
Okay, that works better. Thanks!

Re: LunaDLL help thread

Posted: 14 May 2014, 01:32
by DinnerSonic
Do LunaDLL custom cheats activate the "YOU HAVE CHEATED NO SAVING" mode that normal cheats do?

Re: LunaDLL help thread

Posted: 14 May 2014, 01:34
by TiKi
Kil wrote:
TiKi wrote:How would I go about letting some event (OnPlayerMem) trigger another LunaDLL event? I know they're some number, but how do I find the number of a certain Luna event?
Not sure what you mean. Whatever #number you give your custom event, that's the number you use to trigger it.

OnPlayerMem,0x13C,-1,0,1007,0,w
will trigger #1007
Thanks! But I mean, how do I know that a certain event is say, 1007 instead of 1008?

Re: LunaDLL help thread

Posted: 14 May 2014, 02:16
by Kil
DinnerSonic wrote:Do LunaDLL custom cheats activate the "YOU HAVE CHEATED NO SAVING" mode that normal cheats do?
nope
TiKi wrote:
Kil wrote:
TiKi wrote:How would I go about letting some event (OnPlayerMem) trigger another LunaDLL event? I know they're some number, but how do I find the number of a certain Luna event?
Not sure what you mean. Whatever #number you give your custom event, that's the number you use to trigger it.

OnPlayerMem,0x13C,-1,0,1007,0,w
will trigger #1007
Thanks! But I mean, how do I know that a certain event is say, 1007 instead of 1008?
Well, you made it under #1007.

Re: LunaDLL help thread

Posted: 14 May 2014, 08:00
by Joseph Staleknight
Okay, another quick question. I've figured out how to represent the different powerups/status effects in the pseudo-RPG UI I made for the same level I had previous problems with, and now I'm attempting to record the different mounts and their colors under CP. However, in testing my level I run into overflow lag when I enter a mount other than the clown car. Is there a way to get rid of the overflow and keep the differing CP values, or should I just not care about mount color?

Here's some code again for reference, this time with helpful commentary:

Code: Select all

//Make the PC enter the level big
#-1
PlayerMemSet,0,0x112,2,0,0,w

// Debug purposes - Delete only after testing level LunaDLL in full!
#0
DebugPrint,0,0,0,0,0,0

// Introduction and listener for player's death
#1
ShowText,0,25,475,3,180,PURIFICATION IN PROGRESS...
Timer,0,1000,0,0,180,0
OnPlayerMem,0x13E,0,1,1007,0,w

// When reaching section 3, have the same UI, with slight changes...
#3
Trigger,0,1000,0,0,1,0
Trigger,0,2002,0,0,1,0

// Detect current PC, status (powerup) and CP (mount)
#1000
OnPlayerMem,0xF0,1,0,1001,0,w
OnPlayerMem,0xF0,2,0,1002,0,w
OnPlayerMem,0xF0,3,0,1003,0,w
OnPlayerMem,0xF0,4,0,1004,0,w
OnPlayerMem,0xF0,5,0,1005,0,w
OnPlayerMem,0x112,1,0,1008,0,w
OnPlayerMem,0x112,2,0,1009,0,w
OnPlayerMem,0x112,3,0,1010,0,w
OnPlayerMem,0x112,4,0,1011,0,w
OnPlayerMem,0x112,5,0,1012,0,w
OnPlayerMem,0x112,6,0,1013,0,w
OnPlayerMem,0x112,7,0,1014,0,w
OnPlayerMem,0x108,0,0,1015,0,w
OnPlayerMem,0x108,1,0,1016,0,w
OnPlayerMem,0x108,2,0,1020,0,w
OnPlayerMem,0x108,3,0,1021,0,w

// Display PC's name after intro is done
#1001
ShowText,0,25,475,3,1,DEMO
Trigger,0,1006,0,0,1,0

#1002
ShowText,0,25,475,3,1,IRIS
Trigger,0,1006,0,0,1,0

#1003
ShowText,0,25,475,3,1,KOOD
Trigger,0,1006,0,0,1,0

#1004
ShowText,0,25,475,3,1,raocow
Trigger,0,1006,0,0,1,0

#1005
ShowText,0,25,475,3,1,SHEATH
Trigger,0,1006,0,0,1,0

// Dummy Trigger command - may need to remove
#1006
Trigger,0,2000,0,0,1,0

// Display the PC's status:

// DEAD - Remove all blocks dealing with Status Effects and CP
#1007
DeleteEventsFrom,1006,0,0,0,1,0
DeleteEventsFrom,1008,0,0,0,1,0
DeleteEventsFrom,1009,0,0,0,1,0
DeleteEventsFrom,1010,0,0,0,1,0
DeleteEventsFrom,1011,0,0,0,1,0
DeleteEventsFrom,1012,0,0,0,1,0
DeleteEventsFrom,1013,0,0,0,1,0
DeleteEventsFrom,1014,0,0,0,1,0
DeleteEventsFrom,1015,0,0,0,1,0
DeleteEventsFrom,1016,0,0,0,1,0
DeleteEventsFrom,1017,0,0,0,1,0
DeleteEventsFrom,1018,0,0,0,1,0
DeleteEventsFrom,1019,0,0,0,1,0
DeleteEventsFrom,1020,0,0,0,1,0
DeleteEventsFrom,1021,0,0,0,1,0
DeleteEventsFrom,1022,0,0,0,1,0
DeleteEventsFrom,1023,0,0,0,1,0
DeleteEventsFrom,1024,0,0,0,1,0
DeleteEventsFrom,1025,0,0,0,1,0
DeleteEventsFrom,1026,0,0,0,1,0
DeleteEventsFrom,1027,0,0,0,1,0
DeleteEventsFrom,1028,0,0,0,1,0
DeleteEventsFrom,1029,0,0,0,1,0
ShowText,0,200,475,3,1,DEAD
ShowText,0,300,475,3,1,HP 0000
ShowText,0,450,475,3,1,CP 000
Trigger,0,2001,0,0,1,0

// POISON (POIS) - Small
#1008
ShowText,0,200,475,3,1,POIS
ShowText,0,300,475,3,1,HP 0001

// PURE - Big/Normal
#1009
ShowText,0,200,475,3,1,PURE
ShowText,0,300,475,3,1,HP 0002

// HASTY (HSTY) - Fire Flower
#1010
ShowText,0,200,475,3,1,HSTY
ShowText,0,300,475,3,1,HP 0003

// FLOATY (FLOT) - Leaf
#1011
ShowText,0,200,475,3,1,FLOT
ShowText,0,300,475,3,1,HP 0008

// STONED (STON) - Tanooki Suit
#1012
ShowText,0,200,475,3,1,STON
ShowText,0,300,475,3,1,HP 0013

// FURY - Hammer Suit
#1013
ShowText,0,200,475,3,1,FURY
ShowText,0,300,475,3,1,HP 0021

// CHILL (CHLL) - Ice Flower
#1014
ShowText,0,200,475,3,1,CHLL
ShowText,0,300,475,3,1,HP 0005

// Display the PC's CP:

// No Mount - No CP
#1015
ShowText,0,450,475,3,1,CP 000

// Boot - Look for type of boot (Kuribo's, Podobo's, Lakitu's)
// Currently assuming boot type does matter
#1016
OnPlayerMem,0x10A,1,0,1017,0,w
OnPlayerMem,0x10A,2,0,1018,0,w
OnPlayerMem,0x10A,3,0,1019,0,w
//ShowText,0,450,475,3,1,CP 020 - Failsafe

// Kuribo's Shoe
#1017
ShowText,0,450,475,3,1,CP 001

// Podobo's Shoe
#1018
ShowText,0,450,475,3,1,CP 020

// Lakitu's Shoe
#1019
ShowText,0,450,475,3,1,CP 070

// Clown Car - Squishy Wizard (MAX CP)
#1020
ShowText,0,450,475,3,1,CP 999

// Yoshi - Look for color of Yoshi (green, blue, yellow, red, black, purple,
// pink, ice)
// Currently assuming Yoshi color does matter
#1021
OnPlayerMem,0x10A,1,0,1022,0,w
OnPlayerMem,0x10A,2,0,1023,0,w
OnPlayerMem,0x10A,3,0,1024,0,w
OnPlayerMem,0x10A,4,0,1025,0,w
OnPlayerMem,0x10A,5,0,1026,0,w
OnPlayerMem,0x10A,6,0,1027,0,w
OnPlayerMem,0x10A,7,0,1028,0,w
OnPlayerMem,0x10A,8,0,1029,0,w
//ShowText,0,450,475,3,1,CP 100 - Failsafe

// Green Yoshi
#1022
ShowText,0,450,475,3,1,CP 003

// Blue Yoshi
#1023
ShowText,0,450,475,3,1,CP 100

// Yellow Yoshi
#1024
ShowText,0,450,475,3,1,CP 010

// Red Yoshi
#1025
ShowText,0,450,475,3,1,CP 005

// Black Yoshi
#1026
ShowText,0,450,475,3,1,CP 118

// Purple Yoshi
#1027
ShowText,0,450,475,3,1,CP 30

// Pink Eldritch Yoshi
#1028
ShowText,0,450,475,3,1,CP 616

// Ice Yoshi
#1029
ShowText,0,450,475,3,1,CP 050

// Display rest of Battle Pseudo-UI. If dead, remove Arrow from commands list.
// Alternatively, move arrow to ATTACK if at end of escape sequence.
#2000
ShowText,0,600,475,3,1,ATTACK
ShowText,0,600,500,3,1,COMPETENCE
ShowText,0,600,525,3,1,OBJECTS
ShowText,0,600,550,3,1,FLEE <

#2001
DeleteEventsFrom,2000,0,0,0,1,0
ShowText,0,600,475,3,1,ATTACK
ShowText,0,600,500,3,1,COMPETENCE
ShowText,0,600,525,3,1,OBJECTS
ShowText,0,600,550,3,1,FLEE

#2002
DeleteEventsFrom,2000,0,0,0,1,0
ShowText,0,600,475,3,1,ATTACK <
ShowText,0,600,500,3,1,COMPETENCE
ShowText,0,600,525,3,1,OBJECTS
ShowText,0,600,550,3,1,FLEE

#END

Re: LunaDLL help thread

Posted: 14 May 2014, 08:59
by Kil
oh my god what

I'm not sure what's causing lag. All your text seems to have the right amount of active time, which is 1. Keep in mind showtext is by far the slowest command, except blocktrigger or NPC commands in levels with thousands of NPCs and blocks. Showtext manually calls SMBX's incredibly bad and slow text printing command. With the luna debug thing going also, it's a lot of text being printed every frame. Maybe send me the level.

Re: LunaDLL help thread

Posted: 14 May 2014, 11:32
by Joseph Staleknight
Okay then. Normally I'd wait until my level has at least a basic path from start to end before posting it, but since this is really bugging me I might as well show what I had in mind so far.

Here's the level, complete with LunaDLL document. Make of it what you will.

Re: LunaDLL help thread

Posted: 14 May 2014, 11:57
by Kil
Oh

It's event #1016.
OnPlayerMem,0x10A,1,0,1017,0,w
OnPlayerMem,0x10A,2,0,1018,0,w
OnPlayerMem,0x10A,3,0,1019,0,w

Since you call this event each frame when you have a mount, keep in mind, it's copying these 3 each frame, and they all have an infinite lifecycle of 0. Change them all to 1 and it works fine. They'll all 3 die and be replaced every frame so long as you're in the mount. That goes for the ones in #1021 as well.

Basically you have 2 kinds of sensors here. The OnPlayerMem's that are called only once (1, 1000), they should be 0 to stay around forever. The other ones are constantly being copied from their custom event every frame, and they NEED to die, so they should have a time of 1 frame.

// Boot - Look for type of boot (Kuribo's, Podobo's, Lakitu's)
// Currently assuming boot type does matter
#1016
OnPlayerMem,0x10A,1,0,1017,1,w
OnPlayerMem,0x10A,2,0,1018,1,w
OnPlayerMem,0x10A,3,0,1019,1,w

// Yoshi - Look for color of Yoshi (green, blue, yellow, red, black, purple,
// pink, ice)
// Currently assuming Yoshi color does matter
#1021
OnPlayerMem,0x10A,1,0,1022,1,w
OnPlayerMem,0x10A,2,0,1023,1,w
OnPlayerMem,0x10A,3,0,1024,1,w
OnPlayerMem,0x10A,4,0,1025,1,w
OnPlayerMem,0x10A,5,0,1026,1,w
OnPlayerMem,0x10A,6,0,1027,1,w
OnPlayerMem,0x10A,7,0,1028,1,w
OnPlayerMem,0x10A,8,0,1029,1,w
//ShowText,0,450,475,3,1,CP 100 - Failsafe

TLDR just replace those two events

Also what in god's name is going on here...

Re: LunaDLL help thread

Posted: 14 May 2014, 12:36
by Joseph Staleknight
Ah, so that's what's causing the issues! Custom events are so screwy...
Kil wrote:Also what in god's name is going on here...
Just some experimentation with the capabilities of LunaDLL for a level based on the game OFF. I'm planning on simulating the latter's battle screen UI to extend the homage.

Re: LunaDLL help thread

Posted: 14 May 2014, 12:44
by Kil
Yeah I should really make it more clear to all users that custom events technically work by copying the commands in the custom event into section 0, and through that copying, any of those commands that have infinite length instantly cause massive overflows because they never go away.

Re: LunaDLL help thread

Posted: 16 May 2014, 02:07
by TiKi
How does replacing one npc with another (such as npc-30 with npc-127) work?

Re: LunaDLL help thread

Posted: 16 May 2014, 04:52
by Kil
You pretty much just use NPCMemSet and memory offset 0xE2

Code: Select all

// 0x+E2	w	= Sprite GFX index   // x011C = lakitu
to find any NPC with ID 30 and change it to 127

Code: Select all

NPCMemSet,30,0xE2,127,0,0,w

Re: LunaDLL help thread

Posted: 16 May 2014, 06:04
by TiKi
Kil wrote:You pretty much just use NPCMemSet and memory offset 0xE2

Code: Select all

// 0x+E2	w	= Sprite GFX index   // x011C = lakitu
to find any NPC with ID 30 and change it to 127

Code: Select all

NPCMemSet,30,0xE2,127,0,0,w
Wow! It's a miracle! Thanks!

Re: LunaDLL help thread

Posted: 16 May 2014, 06:11
by Mabel
Kil wrote:You pretty much just use NPCMemSet and memory offset 0xE2

Code: Select all

// 0x+E2	w	= Sprite GFX index   // x011C = lakitu
to find any NPC with ID 30 and change it to 127

Code: Select all

NPCMemSet,30,0xE2,127,0,0,w
this is beautiful...
Turning lovefrog bullets into donuts is oh god the things I can do with this...

Re: LunaDLL help thread

Posted: 16 May 2014, 06:25
by Kil
Is that what that does? Welp

Re: LunaDLL help thread

Posted: 16 May 2014, 07:04
by Mabel
yeah:


coulda sworn this was used for the Nevada battle but nah that was just npc and graphic shenanigans