Looking for a "Repeat until X, then Advance" End Action step

Post Reply
User avatar
Convoy_Avenger
Posts: 53
Joined: Tue Aug 14, 2018 1:42 am

Looking for a "Repeat until X, then Advance" End Action step

Post by Convoy_Avenger » Fri Sep 14, 2018 11:49 am

TL;DR Making a boss fight, after he takes 3 damage, I want him to advance to his next Action Step. Until he takes three, want him to repeat his current action step.

Trying to make a more complicated boss. The current Action Steps/End Actions seem to be limiting me though in achieving what I'm hoping to do.

Right now, ignoring all of the complicated stuff I want to add, I just want to be able to make a counter that tracks the Monsters health, and after he gets hit 3 takes, advances to the next step, otherwise, repeat your current action (Shoot at the player).

Hitting the monster, seems to "Reset" the current action step though. I'm not sure if this resets it's current action entirely, causing it not to run through to the end of the code, or if the animation just resets.

I haven't actively tried anything yet, this is more a post to hear other peoples ideas on how they might implement it.
Bucket Mouse
Posts: 168
Joined: Wed Mar 07, 2018 2:25 am

Re: Looking for a "Repeat until X, then Advance" End Action step

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

I think it's doable. This is the script that counts down monster damage by increments of 1:

Code: Select all

		LDA Object_health,x
		SEC
		SBC #$01
		CMP #$01
		BCS notMonsterDeath
		DeactivateCurrentObject
When it gets to zero it kills the monster (DeactivateCurrentObject).

You would replace the number in CMP with whatever remaining HP you want the monster to have when it changes. Then instead of "DeactivateCurrentObject" you would put a variable that directs to the next Action Step.

You might not even need that variable, actually, since you can direct that action in NESMaker under Object Settings. This code would go into one of the unused AI scripts and you'd assign it to the monster.

My skills with code aren't up to the point where I can tell you exactly what to do here, but I have a vague idea. Hopefully you can run with this or someone else can.
Post Reply