Custom DestroyMe scripts?

Have a thought on how NESmaker can be improved? We are a small team with limited means, but we'd love to hear your ideas!
User avatar
dale_coop
Posts: 1612
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Custom DestroyMe scripts?

Post by dale_coop » Fri Sep 14, 2018 7:38 am

You should make a custom destroy me script:
Paste the code in the "Routines\System\AI_Reactions\Reaction_03.asm" (currently unused), then in you "Project Settings > Project Labels", rename "Reaction_03" to "Destoy Me (Player Weapon)" (edge reaction and solid reaction). Lastly, reassign this reaction to the Melee/projectile object.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Bucket Mouse
Posts: 193
Joined: Wed Mar 07, 2018 2:25 am

Re: Custom DestroyMe scripts?

Post by Bucket Mouse » Fri Sep 14, 2018 8:08 am

dale_coop wrote:
Fri Sep 14, 2018 7:38 am
You should make a custom destroy me script:
Paste the code in the "Routines\System\AI_Reactions\Reaction_03.asm" (currently unused), then in you "Project Settings > Project Labels", rename "Reaction_03" to "Destoy Me (Player Weapon)" (edge reaction and solid reaction). Lastly, reassign this reaction to the Melee/projectile object.
OK, tried it...there was no difference or change for the monsters, but when the projectile hit an object it would just stay there.
User avatar
dale_coop
Posts: 1612
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Custom DestroyMe scripts?

Post by dale_coop » Fri Sep 14, 2018 8:31 am

Hmm...
In fact, thinking about the original question. You right, it's not the "DestroyMe" you want/need to customize... just the monster's death right?
So, as you said, you need just need to modify the "Adventure_HandleHurtMonster.asm".
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dale_coop
Posts: 1612
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Custom DestroyMe scripts?

Post by dale_coop » Fri Sep 14, 2018 8:37 am

And if you still want to play with the DESTROY ME script.
Soem correctins need to be made... add :

Code: Select all

;; DESTROY ME
	TXA
	STA tempx
at the begining... and

Code: Select all

continueDestroyingMe:
	LDX tempx 
	DeactivateCurrentObject 
	
at then end.
Now the "DeactivateCurrentObject " parts should works again.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Bucket Mouse
Posts: 193
Joined: Wed Mar 07, 2018 2:25 am

Re: Custom DestroyMe scripts?

Post by Bucket Mouse » Fri Sep 14, 2018 9:05 am

dale_coop wrote:
Fri Sep 14, 2018 8:37 am
And if you still want to play with the DESTROY ME script.
Soem correctins need to be made... add :

Code: Select all

;; DESTROY ME
	TXA
	STA tempx
at the begining... and

Code: Select all

continueDestroyingMe:
	LDX tempx 
	DeactivateCurrentObject 
	
at then end.
Now the "DeactivateCurrentObject " parts should works again.
It still says "Branch out of range" when I put this in Adventure_HandleHurtMonster.asm
User avatar
dale_coop
Posts: 1612
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Custom DestroyMe scripts?

Post by dale_coop » Fri Sep 14, 2018 9:22 am

This code was supposed to be for your Reaction_03.asm (the custom "DESTROY ME" script).... but only IF you still have modifications in this script.
But I would suggest to remove all the modification in DESTROY ME scripts. Because when I read you, I know understand you don't want/need that.

You want/need to make your modifications in Adventure_HandleHurtMonster.asm script.
Go step by step... else you will never go anywhere.
First, I would suggest to make an effect (explose or whatever you want), when the monster dies:
Take a look at the the line

Code: Select all

		JSR HandleDrops
This subroutine, is called each time a monster dies.
I think it would be smart, to write your code in that routine, make a copy custom script from this one.

If you can wait for 2 hours... I can do some tests, during my lunch time, and give you a script that should works.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dale_coop
Posts: 1612
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Custom DestroyMe scripts?

Post by dale_coop » Fri Sep 14, 2018 10:43 am

Currently the subroutine "HandleDrops" create objects when a monster dies: the "health" object or the "currency" object AND create the "Effect 1" object.
In your case, you would like the effect to be different depending of the weapon used.

So make a modify (or better make a custom) "Adventure_HandleDrops.asm", and at the end...
replace :

Code: Select all

donePickup:	
	;;; ALL cases create a "pow"
	CreateObject temp, temp1, #$09, #$00
by:

Code: Select all

donePickup:	
	;;; ALL cases create a "pow"
	
	;;supposed here, the weapon/projectile object is in tempx
	;;supposed here, the monster object is in x
	TXA
	STA tempy
	LDX tempx
	
	LDA Object_type, x
	CMP #$01
	BEQ isSwordWeapon
	CMP #$02
	BEQ isSwordWeapon
	CMP #$03
	BEQ isProjectileWeapon
	JMP finishedMonsterDeathEffect
	
isSwordWeapon:
	;;get the position of the monster:
	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1
	;;create the effect 9 object:
	CreateObject temp, temp1, #$09, #$00
	JMP finishedMonsterDeathEffect
	
isProjectileWeapon:
	;;get the position of the monster:
	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1
	;;create the effect 11 object:
	CreateObject temp, temp1, #$0B, #$00
	JMP finishedMonsterDeathEffect
	
finishedMonsterDeathEffect:
    LDX tempy

PS: by the way, don't forget to remove all the modifications made in the DETROY ME (Reactions_02 or 03) scripts.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Bucket Mouse
Posts: 193
Joined: Wed Mar 07, 2018 2:25 am

Re: Custom DestroyMe scripts?

Post by Bucket Mouse » Sat Sep 15, 2018 2:05 am

Wow, you did it! It really works!

Can you post the completed script in the Code forum? I would post it, but you did all the work.
User avatar
dale_coop
Posts: 1612
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Custom DestroyMe scripts?

Post by dale_coop » Sat Sep 15, 2018 11:47 am

It’s you idea, Bucket Mouse, you can post it. I encourage you to do it. I just helped you to make it.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply