Getting A.I. to attack behind them

DJGameFreakTheIguana

Active member
First I need to point out that these guys have Facing 1 in their headers. I have negative Range settings for when players are behind them, they will detect and attack them, and this works for another enemy I have, but not these guys for some reason, they just freeze or attack in front of them.
https://streamable.com/fin23

So here's the coding from the enemy this works for.
Code:
anim	attack2
	delay	7
	offset	76 94
	bbox	60 58 32 37
	range	-60 -20
	Jumpframe	0 -2 3
	Landframe	6
	attack1	83 58 23 15 5 0 0 0 0 20
	DropV	1 2
	frame	data/chars/Eggpawn/Run7.GIF
	frame	data/chars/Eggpawn/Run7.GIF
	frame	data/chars/Eggpawn/Run7.GIF
	frame	data/chars/Eggpawn/Run7.GIF
	frame	data/chars/Eggpawn/Run7.GIF
	delay	20
	frame	data/chars/Eggpawn/Run7.GIF
	delay	1
	frame	data/chars/Eggpawn/Run7.GIF

And here's one of the enemies from the video.
Code:
anim	attack2
	range	10 200
	loop	0
	delay	9
	offset	152 151
	bbox	144 92 21 51
	range	-100 -20
	fastattack	1
	drawmethod	flipx 1
	frame	data/chars/PDD/A1-0.gif
	frame	data/chars/PDD/A1-1.gif
	frame	data/chars/PDD/A1-2.gif
	frame	data/chars/PDD/A1-3.gif
	@cmd	toss "PDynam" 25 28 0
	frame	data/chars/PDD/A1-4.gif
	frame	data/chars/PDD/A1-5.gif
	frame	data/chars/PDD/A1-6.gif

I also tried using "@cmd attack1 -60 -2 -2 2 "ANI_Freespecial1"" within' their attack1 anims but that wasn't working.

X)
 
Well, on the example that does not work you are actually using the rage command twice:

anim attack2
range 10 200
loop 0
delay 9
offset 152 151
bbox 144 92 21 51
range -100 -20
fastattack 1
drawmethod flipx 1
frame data/chars/PDD/A1-0.gif
frame data/chars/PDD/A1-1.gif
        ....
 
Hmmm.... you need to declare attack1 function in IDLE or WALK animation instead of ATTACK1 animation
However if you insist on declaring there, you should widen z range of attack1 function to give chance for enemy to attack
 
Also, remember that lower values (eg. ATTACK1) animation has precedence over higher ones (ATTACK2).
So if both has the same range, the engine will make it to use ATTACK1 more than ATTACK2.
 
Bloodbane said:
Hmmm.... you need to declare attack1 function in IDLE or WALK animation instead of ATTACK1 animation
However if you insist on declaring there, you should widen z range of attack1 function to give chance for enemy to attack
Thanks for the suggestion, it works now. I usually have a lot of enemies on screen so I'll throw players a bone on this one.  ;)

O Ilusionista said:
Also, remember that lower values (eg. ATTACK1) animation has precedence over higher ones (ATTACK2).
So if both has the same range, the engine will make it to use ATTACK1 more than ATTACK2.
Never knew that, thanks for telling me.

X)
 
Back
Top Bottom