Page 1 of 1

LunaDLL idea

Posted: Tue Aug 12, 2014 8:33 pm
by MistakesWereMade
Is it possible to make something that basically "activates a switch" when you press a certain button?

For example, if you press something like alt run, the blue switch will activate and the red switch will deactivate, kind of like how shaking the wiimote moved the platforms in one stage in mario galaxy

Re: LunaDLL idea

Posted: Tue Aug 12, 2014 8:35 pm
by zioy
That would be brilliant! I just don't have any idea of how to do it.

Re: LunaDLL idea

Posted: Tue Aug 12, 2014 9:58 pm
by leif_erikson
Unfortunately SMBX doesn't keep track of what switch is pressed. It just switches all the blocks from on/off or /off/on each time you press it. But you can make lunadll detect when you press altjump, and you can tell it to swap all blocks in the level with another type of block.

Code: Select all

#-1
SetVar,0,0,0,0,1,SJPressed

#0
OnPlayerMem,0xFC,0xFFFF,0,2000,0,0
OnPlayerMem,0xFC,0,0,2001,0,0

#2000
IfVar,0,0,0,2002,1,SJPressed

#2001
SetVar,0,0,0,0,1,SJPressed

#2002
SetVar,0,0,1,0,1,SJPressed
SwapAllBlocks,1,3,0,0,1,0

#END
This code swaps all blocks of blockID 1 (square wood block) to have block ID 3 (wood flat floor block) and vice versa. If you want to use different block types, change the 1 and the 3 next to SwapAllBlocks to the blocks you want.

You will need the latest version of lunadll by the way because block swap is a new command http://www.gamearchaeology.com/LunaDll.dll

Re: LunaDLL idea

Posted: Tue Aug 12, 2014 10:06 pm
by FanofSMBX
You could make the empty blue ones turn to full blue ones and the full red ones turn to empty red ones for example.

Re: LunaDLL idea

Posted: Tue Aug 12, 2014 10:14 pm
by leif_erikson
yes you should probably do that but I'm too lazy to look up the block IDs. Go to the graphics folder for blocks to find them