4.5.9 Monsters With Hit Points In Platformer Module

TheRetroBro

Active member
To my shock, I've discovered monsters with hit points are not standard in modules that are not Adventure. This means it is not possible in the unaltered Platformer module to create a boss that takes more than one hit to go down! Sure hope someone got fired for that blunder.

But we can fix it! Go to the PlatformBase module and find the hurtPlayer-PlatformBase script (should be in the Common folder). Open it and around line 20, you'll spot this:

LDX otherObject
That's the moment your sprite's foot hits the monster. We're gonna borrow some code from Adventure and paste it right below that, The end result should look like this:

Code:
        LDX otherObject
            TXA
    STA temp
    GetActionStep temp
    CMP #$07 ;; we will use action step 7 for hurt.
    BEQ +doSkipHurtingThisObject ;; if he is hurt, he can't be hurt again.
        ChangeActionStep temp, #$07
        DEC Object_health,x
        LDA Object_health,x
        BNE +doSkipHurtingThisObject
            DestroyObject
    +doSkipHurtingThisObject
      
        CountObjects #%00001000
..and it continues from there unaltered.

Now your bosses have hit points and won't disappear instantly. You set these hit points by going to the monster GUI in NESMaker, hitting the "Object Details" button, hitting the "Details" tab and adjusting the Health number. KEEP IN MIND the default for every monster in Platformer is zero, and this must be changed to at least one! When hit points are applied, "zero" is interpreted as "invincible."

Note: if you've modified your platformer to use melee weapons or guns, you might also have to paste this code somewhere else. I don't know where that would be at this time, as I don't have a game ready that's been modified like that. If you find it yourself, post a follow-up.


BONUS PROJECT: GIVE YOUR BOSS A DEATH ANIMATION
If you want your boss to have a death animation before it disappears, then take the code above and replace "DestroyObject" with this:

ChangeActionStep temp, #$06

Now assign that animation to Action Step 6 in the monster GUI. Be sure to set the End Action to "Destroy Me."
In fact, if you use this you will have to make every monster's Action Step 6 end in Destroy Me or they will live forever. That's why this is optional. Not a big deal for everyone, but it might be for some people.
Yeah this didn't work Just made my enemy invincible lol
 

101010

Member
yeah, it doesn't work anywhere. sad...
I'm trying to figure this out now. what's silly is that hurtMonter has the code to hurt the monster...it just doesn't do anything lol
nesmaker is just a hot mess
 

tbizzle

Well-known member
@101010 @TheRetroBro
Has anyone figured this out for the shooter module too?
Is this what you guys need????

 

NightMusic

Active member
View: https://www.youtube.com/watch?v=5ixCe1ITZT4

my own take on it...


I HAVE A DIFFERENT METHOD :
It's just what I've been using for years. Essentially it takes the idea from this. You borrow the object health part of adventure module monster hurt script (or was it player hurting monster? idk .. either way its an older method.)



1. create a blank script name it hurtMonster_(your project name) save it
2. open your doHandleObjectCollisions script for your project.
3. EDIT the script : ** NOTE ** IF YOU HAVE PLAYER WEAPON / MONSTER COLLISONS look for that as well
a. in my script on line 80 it starts player weapon and monster collisions.
b. in my project the player will always be hurt when colliding with the monster, but not the monster.
c. we can now edit the script and test the results for simple things to prove its working...
d. I will be making references to my script here:

> on line 99 there is "DestroyObject" that object is your monster.
if you are using health you need to comment this out.

> make sure there is a JSR doHandleHurtMonster in your script

4. Edit hurtMonster script you created (the blank script)
Add the following :

DestroyObject

5. Test it to make sure its destroying the monster. you can check the health and set it and no matter what it doesnt matter. it destroys the monster on impact by default now.

6. now, object health is still active in all modules this only accesses it...

(script link in video description)


It's rather basic. It checks action step in the monster for 7 then 6 both are important to prevent instant death.
stun action step is action step 6 and i left 7 open for death animation (if you want individual death animaitons for all your monsters) (if you arent using individual deaths in your game, you could just comment out this check for 7)

I have a simple stunned animation for my monster (shown)
* I understand we can edit the collision script add a flag for invulnerability etc but wanted this to be a simple video/explanation. *
 
Top Bottom