spawn a new monster on a certain monsters death?

SciNEStist

Well-known member
Hello, I am trying to modify HandleHurtMonster.asm so when one particular monster is killed, it spawns a new monster. I'm still trying to learn more about assembly, so I'm sure my mistake is embarrassingly obvious to someone with more knowledge.

when I put the following edit into the script, it doesnt work with any monsters at all.

Code:
        LDA Object_x_hi,x ;; get x coord
        STA temp
        LDA Object_y_hi,x ;; get y coord
        STA temp1
        LDA Object_ID,x ;; get the object ID of the hurt monster
        CMP #$10 ;; check if the ID matches the monster I want (in this case the first monster in my list)
        BNE +++ ;; if it isn't the chosen monster, skip ahead
        DeactivateCurrentObject ;; destroy the monster
        CreateObject temp, temp1, #$13, #$00, currentNametable ;; spawn a new monster at the same coordinates, in this case the 4th monster in my list.
        +++



I can however get it to happen to all monsters if I just do it like this in the same part of the script:


Code:
        LDA Object_x_hi,x ;; get x coord
        STA temp
        LDA Object_y_hi,x ;; get y coord
        STA temp1
        DeactivateCurrentObject ;; destroy the monster
        CreateObject temp, temp1, #$13, #$00, currentNametable ;; spawn a new monster at the same coordinates, in this case the 4th monster in my list.


The problem is that I only want this to occur with one monster, but not happen with any others. Am I just doing this completely wrong, or am I at least on the right track?
 

dale_coop

Moderator
Staff member
You wrote a small mistake:
Code:
LDA Object_ID,x
is for getring the instance index of an object.

But, what you really want here is the "object type" id:
Code:
LDA Object_type,x
 

dale_coop

Moderator
Staff member
You're welcome.... and yes, of course, you will! Everyone here is ussful and helps when/if he/she can <3
 
Top Bottom