[SOLVED] Boss drop

drexegar

Member
dale_coop said:
Because I think the object loaded in X is the player, not the monster, in that script...
How is your Handle Monster Hurt script? could you share it?

Ill share it later but i did the changes in your "fix monster drops post"
 

dale_coop

Moderator
Staff member
I know... But the handle monster drops script is executed by the handle monster hurt. And that one script load player object in X.
This is the problem... but I need to know your script... to be able to find a solution.
(it's the reason n8bit has his script in the Handle Object Collisions before the handle monster hurt change the X register)
 

drexegar

Member
dale_coop said:
I know... But the handle monster drops script is executed by the handle monster hurt. And that one script load player object in X.
This is the problem... but I need to know your script... to be able to find a solution.
(it's the reason n8bit has his script in the Handle Object Collisions before the handle monster hurt change the X register)

Here it is, i couldn't give it earlier because I was away from my computer at the time: Handle Monster Hurt.asm

Code:
;;; what should we do with the monster?
        ;;; monster is loaded in x
        LDA Object_vulnerability,x
        AND #%00000100 ;; is it weapon immune?
        BEQ notWeaponImmune
        ;PlaySound #SFX_MISS
        JMP skipHurtingMonsterAndSound
    notWeaponImmune:
        
        LDA Object_status,x
        AND #HURT_STATUS_MASK
        BEQ dontskipHurtingMonster
        JMP skipHurtingMonster
    dontskipHurtingMonster:
        LDA Object_status,x
        ORA #%00000001
        STA Object_status,x
        LDA #HURT_TIMER
        STA Object_timer_0,x
        ;;; assume idle is in step 0
        ChangeObjectState #$00,#$02
        ;;;; unfortunately this recoil is backwards
        LDA Object_status,x
        AND #%00000100
        BNE skipRecoilBecauseOnEdge
        LDA Object_vulnerability,x
        AND #%00001000 
        BNE skipRecoilBecauseOnEdge ;; skip recoil because bit is flipped to ignore recoil
        
        LDA selfCenterX
        STA recoil_otherX
        LDA selfCenterY
        STA recoil_otherY
        LDA otherCenterX
        STA recoil_selfX
        LDA otherCenterY
        STA recoil_selfY
        JSR DetermineRecoilDirection
    skipRecoilBecauseOnEdge:
        LDA Object_health,x
        SEC
        SBC #$01
        CMP #$01
        BCC +
        JMP notMonsterDeath
    +   
      
    
    LDA Object_x_hi,x
    STA temp
    LDA Object_y_hi,x
    STA temp1

    DeactivateCurrentObject

    CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, currentNametable
    
    
        
        PlaySound #SND_SPLAT
        ;;;;;;;;;;;;;;;;;; ok, so now we also add points to score
        ;LDY Object_type,x
        ;LDA ObjectWorth,y
        ;STA temp
;       AddValue #$03, GLOBAL_Player1_Score, temp
                ;arg0 = how many places this value has.
                ;arg1 = home variable
                ;arg2 = amount to add ... places?
        ;; and this should trip the update hud flag?
        
        ;;;; 
    

    TXA
    STA tempy

    AddValue #$08, myScore, #$01, #$00

    ;STA hudElementTilesToLoad
    ;   LDA #$00
    ;   STA hudElementTilesMax
        ; LDA DrawHudBytes
        ; ora #HUD_myScore
        ; STA DrawHudBytes
    UpdateHud HUD_myScore
    LDX tempy

        JSR HandleDrops
        JSR HandleToggleScrolling
        
        CountObjects #$00001000, #$00
        BEQ +
        JMP ++
    +
        .include SCR_KILLED_LAST_MONSTER
    ++
        
        JMP skipHurtingMonster
    notMonsterDeath
        STA Object_health,x
    skipHurtingMonster: 
        ;PlaySound #SFX_MONSTER_HURT
    
    skipHurtingMonsterAndSound:
        LDX tempx
        ;; what should we do with the projectile?
        DeactivateCurrentObject
 

dale_coop

Moderator
Staff member
Try this...
- Modify your Handle Monster Hurt script... add:
Code:
	LDA Object_type,x		;; used for Monster Drops
	STA	temp2			;; used for Monster Drops
Just before the "DeactivateCurrentObject" line.

- Modify your Handle Monster Drops, with this content:
Code:
;;; monster objects drop at random.
	LDA otherCenterX
	SBC #$08
	STA temp
	LDA otherCenterY
	SBC #$08
	STA temp1
	
	LDA Object_scroll,x
	SBC #$00
	STA temp3

	LDA temp2
	CMP #19
	BEQ bossEnd
	JMP pickUp
	
bossEnd:
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup

pickUp:


	JSR GetRandomNumber
	AND #%0000011 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	;;; here, we'll create health
	CreateObject temp, temp1, #$04, #$00, temp3
	JMP donePickup
notPickup0:
	LDA temp2
	CMP #$01
	BNE notPickup1
	;; one case here;
;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup1:
	LDA temp2
	CMP #$02
	BNE notPickup2
	;; two case here;
	;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.
	CreateObject temp, temp1, #$07, #$00, temp3
	
	
	
	
donePickup:	
	;;; ALL cases create a "pow"
 

drexegar

Member
dale_coop said:
Try this...
- Modify your Handle Monster Hurt script... add:


I did add everything and I got no errors but the monster 19 (oki) if that is right number is still dropping like a regular monster. So the code is still ignoring the #19 and skipping on to the normal drop code.
 

drexegar

Member
dale_coop said:
Try this...

For reference

Monster Hurt:
Code:
;;; what should we do with the monster?
        ;;; monster is loaded in x
        LDA Object_vulnerability,x
        AND #%00000100 ;; is it weapon immune?
        BEQ notWeaponImmune
        ;PlaySound #SFX_MISS
        JMP skipHurtingMonsterAndSound
    notWeaponImmune:
        
        LDA Object_status,x
        AND #HURT_STATUS_MASK
        BEQ dontskipHurtingMonster
        JMP skipHurtingMonster
    dontskipHurtingMonster:
        LDA Object_status,x
        ORA #%00000001
        STA Object_status,x
        LDA #HURT_TIMER
        STA Object_timer_0,x
        ;;; assume idle is in step 0
        ChangeObjectState #$00,#$02
        ;;;; unfortunately this recoil is backwards
        LDA Object_status,x
        AND #%00000100
        BNE skipRecoilBecauseOnEdge
        LDA Object_vulnerability,x
        AND #%00001000 
        BNE skipRecoilBecauseOnEdge ;; skip recoil because bit is flipped to ignore recoil
        
        LDA selfCenterX
        STA recoil_otherX
        LDA selfCenterY
        STA recoil_otherY
        LDA otherCenterX
        STA recoil_selfX
        LDA otherCenterY
        STA recoil_selfY
        JSR DetermineRecoilDirection
    skipRecoilBecauseOnEdge:
        LDA Object_health,x
        SEC
        SBC #$01
        CMP #$01
        BCC +
        JMP notMonsterDeath
    +   
      
    
    LDA Object_x_hi,x
    STA temp
    LDA Object_y_hi,x
    STA temp1
	LDA Object_type,x		;; used for Monster Drops
	STA	temp2			;; used for Monster Drops

    DeactivateCurrentObject

    ;CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, currentNametable
    
    
        
        PlaySound #SND_SPLAT
        ;;;;;;;;;;;;;;;;;; ok, so now we also add points to score
        ;LDY Object_type,x
        ;LDA ObjectWorth,y
        ;STA temp
;       AddValue #$03, GLOBAL_Player1_Score, temp
                ;arg0 = how many places this value has.
                ;arg1 = home variable
                ;arg2 = amount to add ... places?
        ;; and this should trip the update hud flag?
        
        ;;;; 
    

    TXA
    STA tempy

    AddValue #$08, myScore, #$01, #$02

    ;STA hudElementTilesToLoad
    ;   LDA #$00
    ;   STA hudElementTilesMax
        ; LDA DrawHudBytes
        ; ora #HUD_myScore
        ; STA DrawHudBytes
    UpdateHud HUD_myScore
    LDX tempy

        JSR HandleDrops
        JSR HandleToggleScrolling
        
        CountObjects #$00001000, #$00
        BEQ +
        JMP ++
    +
        .include SCR_KILLED_LAST_MONSTER
    ++
        
        JMP skipHurtingMonster
    notMonsterDeath
        STA Object_health,x
    skipHurtingMonster: 
        ;PlaySound #SFX_MONSTER_HURT
    
    skipHurtingMonsterAndSound:
        LDX tempx
        ;; what should we do with the projectile?
        DeactivateCurrentObject


And then the monster Drop:
Code:
;;; monster objects drop at random.
	LDA otherCenterX
	SBC #$08
	STA temp
	LDA otherCenterY
	SBC #$08
	STA temp1
	
	LDA Object_scroll,x
	SBC #$00
	STA temp3

	LDA temp2
	CMP #20
	BEQ bossEnd
	JMP pickUp
	
bossEnd:
	CreateObject temp, temp1, #$06, #$00, temp3
	JMP donePickup

pickUp:


	JSR GetRandomNumber
	AND #%0000011 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	;;; here, we'll create health
	CreateObject temp, temp1, #$04, #$00, temp3
	JMP donePickup
notPickup0:
	LDA temp2
	CMP #$01
	BNE notPickup1
	;; one case here;
;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup1:
	LDA temp2
	CMP #$02
	BNE notPickup2
	;; two case here;
	;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.
	CreateObject temp, temp1, #$07, #$00, temp3
	
	
	
	
donePickup:	
	;;; ALL cases create a "pow"
CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, currentNametable

I tried using a custom variable to store the object x (replace temp2 with something else) and its not working, so I guess the player_obeject_x is not getting picked up at all? I need to figure out how to call up these values to show up in the HUD.
 

dale_coop

Moderator
Staff member
Your boss is the 20 ?
Could you share a screenshots of your monsters?
I think there are some errors in your script ("01", "02" can't be monsters...)
 

drexegar

Member
dale_coop said:
Your boss is the 20 ?
Could you share a screenshots of your monsters?
I think there are some errors in your script ("01", "02" can't be monsters...)

The screen was already posted up and above here:

NhzyPgW.jpg


20 was a different test, I'm assuming my boss (OKI) is 19, is that correct? But anyway 19 doesn't work either.
 

dale_coop

Moderator
Staff member
(Sorry for always asking the same question... just because I work on so many project at the same time, I don't remember if I asked already or not)
Are you using a sprite sword weapon? Or the Melee Object?
 

drexegar

Member
dale_coop said:
(Sorry for always asking the same question... just because I work on so many project at the same time, I don't remember if I asked already or not)
Are you using a sprite sword weapon? Or the Melee Object?

Your tutorial code from before, the melee object
 

dale_coop

Moderator
Staff member
Ok, I think the main issue is the pickup item is created too close from the player (colliding him in fact), so the pickup disappears (the player takes it?)

Could you try this "Handle Monster Drops" script (using the temp2, like in my previous post):

Code:
;;; monster objects drop at random.
	LDA otherCenterX
	STA temp
	LDA otherCenterY
	STA temp1
	
	LDA Object_scroll,x
	SBC #$00
	STA temp3

	;; check if the monster is a BOSS monster (19):
	LDA temp2
	CMP #19
	BEQ bossEnd	;; it IS
	JMP pickUp	;; it is NOT
	
bossEnd:
	CreateObject temp, temp1, #$06, #$00, temp3
	JMP donePickup

pickUp:
	JSR GetRandomNumber
	AND #%0000011 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	;;; here, we'll create health
	CreateObject temp, temp1, #$04, #$00, temp3
	JMP donePickup
notPickup0:
	CMP #$01
	BNE notPickup1
	;; one case here;
;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup1:
	CMP #$02
	BNE notPickup2
	;; two case here;
	;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.
	CreateObject temp, temp1, #$07, #$00, temp3
	
	
donePickup:	
	;;; ALL cases create a "pow"
CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, currentNametable

And try to reduce the width value of your pickup items' bounding box.
 

drexegar

Member
dale_coop said:
Ok, I think the main issue is the pickup item is created too close from the player (colliding him in fact), so the pickup disappears (the player takes it?)

Could you try this "Handle Monster Drops" script (using the temp2, like in my previous post):

Code:
;;; monster objects drop at random.
	LDA otherCenterX
	STA temp
	LDA otherCenterY
	STA temp1
	
	LDA Object_scroll,x
	SBC #$00
	STA temp3

	;; check if the monster is a BOSS monster (19):
	LDA temp2
	CMP #19
	BEQ bossEnd	;; it IS
	JMP pickUp	;; it is NOT
	
bossEnd:
	CreateObject temp, temp1, #$06, #$00, temp3
	JMP donePickup

pickUp:
	JSR GetRandomNumber
	AND #%0000011 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	;;; here, we'll create health
	CreateObject temp, temp1, #$04, #$00, temp3
	JMP donePickup
notPickup0:
	CMP #$01
	BNE notPickup1
	;; one case here;
;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup1:
	CMP #$02
	BNE notPickup2
	;; two case here;
	;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.
	CreateObject temp, temp1, #$07, #$00, temp3
	
	
donePickup:	
	;;; ALL cases create a "pow"
CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, currentNametable

And try to reduce the width value of your pickup items' bounding box.

Ok well here are the results:

The death animation has move over 1 block to the right and to the bottom
The boss doesn't work, but for some reason "Monster Girl" counts as #19

Of course trying out 21 where Oki is doesnt work...

is nesmaker Giving IDs to monster as there created? because oki was one of the last making the cutscene monsters in bottom created before he was.

Also random items do not work anymore. So only the boss item can come out but I have no clue how the numbers work since 19 only points to monster girl and 20 21 does nothing.

UPDATE: The old code work actually, is just that 19 for whatever reason lands on monster girl. I assuming that maybe nesmaker creates monster ID base on what is created in order? I create a whole lot of monsters in graphics bank 1 first, is there anyway to find a monster id assign can I just make a HUD element and just throw it there?

Try to get the HUD to show the monster ID, but all I get is letters like P and J in one vaiule, maybe checking there placements on the HUD can shine some light what number these monsters may be.

WELL MONSTER IS #19 and J is the 19 letter in the HUD so looks like im getting somewhere!
 

drexegar

Member
dale_coop said:
Ok, I think the main issue is the pickup item is created too close from the player (colliding him in fact), so the pickup disappears (the player takes it?)

Could you try this "Handle Monster Drops" script (using the temp2, like in my previous post):

And try to reduce the width value of your pickup items' bounding box.

GOT IT!

I sticked with the old code

I use a HUD element and added code to store the monster ID, I realized I can count the letters for the HUD

so OKI was an R as you can see below in the upper corner

9ldRKjo.jpg


so I counted the HUD letter to 27 and voila! it worked!
That double 00 in the air is the boss drop with no collision! Works!

Thanks for your help again Dale!
Which means.... nes maker does create monster ID on your order or monsters right? Cause I jump to bank 1 first for cutscenes and then went back to bank 0!
 

dale_coop

Moderator
Staff member
Glad it worked. It should work... "Object_type,x" is the NESMaker index in the list.
A lot of work still... good luck everyone.
(I go back to my game... still not finished :p)
 
Top Bottom