Pages: 1
Posted on 12-15-17, 09:53 am (rev. 3 by newluigidev on 12-15-17, 10:58 pm)
Nipper Plant


Karma: 2406
Posts: 306/417
Since: 08-17-15
Just a small ASM hack I decided to make. Thought'd be cool. The current code plays the danger SFX at 4 coins, and kills Mario/Luigi at 5 coins. Every time you start a level, coin count is set to 0. You can change the 4 & 5 to increase/decrease how many coins it requires to play the warning SFX & kill Mario/Luigi.

Download .zip: https://nsmbhd.net/get.php?id=VR6UnmtEO86jbP5k

Video:


Code:
#include "nsmb.h"

int coinCounter = 0;
int dangerCounter = 0;
int* coins (int*)0x0208B37C;

void hook_0200696C_main()
{
        *coins = 0;
        coinCounter = 0;
}

void hook_0211F83C_ov_0A()
{
        if (coinCounter == 4) //Change 4 to a different number to play the danger SFX at that specific coin amount.
        {
                if (dangerCounter < 100)
                {
                        ++dangerCounter;
                }

                if (dangerCounter == 100)
                {
                        PlaySNDEffect(0x13D, 0);
                        dangerCounter = 0;
                }      
        }
}

void hook_02020354_main()
{
        MarioActor* mario = (MarioActor*)getPtrToPlayerActor(); //Pointer to MarioActor struct.

        ++coinCounter; 

        if (coinCounter == 5) //Change 5 to change how many coins it takes to kill Mario/Luigi.
        {
                mario->DeathState = 0x21197FC; //Kills Mario. 0x21197FC is normal death animation.
                coinCounter = 0;
        }
}
Posted on 12-15-17, 07:24 pm (rev. 1 by  Ndymario on 12-15-17, 07:24 pm)
Fuzzy
That MvL Hacker

Karma: 1593
Posts: 540/787
Since: 04-11-15
*Thinks about testing this in MvL*

Good job on the ASM
_________________________
Here's my MvL Hacking thread

Consider joining the NSMB DS Hacking Discord Server!

#HakingNoMore
Posted on 12-15-17, 10:52 pm (rev. 1 by newluigidev on 12-15-17, 10:55 pm)
Nipper Plant


Karma: 2406
Posts: 307/417
Since: 08-17-15
Updated code and download link due to a bug where if you died from something other than the coins, the coinCounter wouldn't reset, killing Mario/Luigi at the wrong amount when playing a new level.
Posted on 01-01-18, 08:24 pm
Newcomer
Lord Rotekoppen XD

Karma: 5
Posts: 5/8
Since: 10-14-16
Great work!

Made your code work the other way, so Mario must collect coins to survive.
https://pastebin.com/aGZt44pa
_________________________
Science has proven you cant breathe trough your nose wile having your tunge out.

STOP MAKING THAT FACE!
Posted on 01-01-18, 09:44 pm
この記号は… 解読できないよ…


Karma: 6012
Posts: 2300/2723
Since: 01-17-13
>kill Mario if 0 coins

umm. what if you get 100 coins? it looks back to 0.
Posted on 01-02-18, 01:54 am
Fuzzy
That MvL Hacker

Karma: 1593
Posts: 553/787
Since: 04-11-15
But you could never get to 100 coins, because it resets at 5
_________________________
Here's my MvL Hacking thread

Consider joining the NSMB DS Hacking Discord Server!

#HakingNoMore
Posted on 01-02-18, 05:10 am (rev. 2 by  Helios on 01-02-18, 05:13 am)
Red Cheep-cheep
Beyond DS and Project Tape

Karma: 737
Posts: 45/222
Since: 06-28-17
Posted by newluigidev
if (coinCounter == 5) {
        mario->DeathState = 0x21197FC;
        coinCounter = 0; // Resets coinCounter to 0 when coinCounter reaches 5
}
Here.

Edit: Thought you were discussing the 5-coin kill code. Never mind.
_________________________
Check out these awesome hacks! Beyond DS is now my major hack!
Posted on 01-02-18, 09:12 am
Newcomer
Lord Rotekoppen XD

Karma: 5
Posts: 6/8
Since: 10-14-16
Posted by Thierry
>kill Mario if 0 coins

umm. what if you get 100 coins? it looks back to 0.


By not hooking but instead overwriting the function, You wont get lives and never go over 99...

_________________________
Science has proven you cant breathe trough your nose wile having your tunge out.

STOP MAKING THAT FACE!
Pages: 1