Enemy jumpattack takes always priority on other attacks

kimono

Well-known member
Hi, I'm wondering if there is a solution for the enemies to perform various attacks instead of only jumpattacks in a specific range.
I tried to set the same range to jumpattack and runattack in my Sid enemy, but he always use jumpattacks:
Code:
anim jumpattack
	range 20 80
	rangea 0 100
	fastattack 1
	jugglecost 10
	forcedirection -1
	loop	0
	delay	4
	offset	21 86
	bbox 8 0 25 60
	hitfx	data/sounds/sf/HighKick.wav
	sound	data/sounds/sf/HighAttack.wav
	attack1 0 29 60 35 8 1 0 0 10 12
	frame	data/chars/sid/jumpatk00.gif
	sound	data/voices/signal/signal1.wav
	frame	data/chars/sid/jumpatk00.gif

anim runattack #SLIDE
	range 20 80
	rangea 0 100
	fastattack 1
	jugglecost 10
	forcedirection -1
	energycost 0
	loop	0
	delay	16
	offset	21 78
	bbox 9 13 28 66
	frame	data/chars/sid/slide00.gif
	bbox 9 21 28 58
	frame	data/chars/sid/slide01.gif
	attack1 23 57 60 22 8 1 0 0 10 12
	@cmd dasher 2 0 0
	hitfx	data/sounds/sf/HighKick.wav
	sound	data/sounds/sf/Slide.wav
	frame	data/chars/sid/slide02.gif
	@cmd dasher 1 0 0
	frame	data/chars/sid/slide02.gif
	@cmd dasher 0.5 0 0
	frame	data/chars/sid/slide02.gif
	@cmd dasher 0 0 0
	attack1 0 0 0 0 0 0 0 0 0 0
	frame	data/chars/sid/slide01.gif
	bbox 9 13 28 66
	frame	data/chars/sid/slide00.gif

I wish that he uses either jumpattacks or run attack at this range. Thanks for your suggestions :).
 
kimono,

For better or worse, that is intentional behavior. The AI is hard-coded to prioritize Jumpattack over normal attacks. This is a backward compatibility throwback from the original BOR.

The main way around it is make your Jumpattack into a Freespecial instead, or as O Ilusionista pointed out, very carefully adjust ranges. In this case, don't forget about the Minimum range. Set it up so that the Jumpattack isn't available when targets get close enough.

DC

*Edit:* Moved to general help area as this really isn't a scripting question.
 
O Ilusionista Damon Caskey: Thanks for the tips. Sid has a jumpheight around 3, so I use a 
Code:
jumpframe	0 3 3
But sadly, Sid still only use his freespecial jumpattack when he's in mid range. He has got
Code:
aimove chase
, so he's able to use run and runattack.
Here his text entity:
Code:
##ATTRIBUTES

#SKILLS		*
#POWER		*
#SPEED		*
#JUMP		*
#RAGE		*

##MAIN
name				sidm
type				enemy
hostile				player
candamage			player obstacle
projectilehit		player enemy obstacle

subject_to_wall		1
subject_to_hole		1

##LIFE
health				100 #SCRIPT

##POWER
offense 			all 1 #1/1.5/2/2.5/3/3.5

##SPEED
speed				12 #SCRIPT

##JUMP
jumpspeed			13 #13/15/17/19/21/23
jumpheight 			2.9 #2.9/3.1/3.3/3.5/3.7/3.9

##GRAB
grabdistance 		33 #36/33/30
grabfinish 			1 #PLAYER=0/ENEMY=1

##WEIGHT/HEIGHT
antigravity			-6 #-3/-6/-9
height				75

##MISC
jugglepoints		30
risetime			170
riseinv				0 1 #HEROES 0.4 - ENEMY 0 - BOSS 0.4
makeinv				2 0
atchain				1 1 2
weapons				none none none none
gfxshadow			1 1
dust				dust
aimove				chase #ENEMY ONLY
death   			1 

##SCRIPTS
onblockpscript		data/scripts/onblockp/platform.c
onspawnscript		data/scripts/onspawn/signal.c
animationscript	 	data/scripts/script.c

##ICONS
icon				data/chars/sid/icon.gif 1

##DIESOUND
diesound			data/voices/enemy/Die1.wav

##REMAPS
alternatepal  data/chars/sid/alter1.gif
alternatepal  data/chars/sid/alter2.gif
alternatepal  data/chars/sid/alter3.gif

load zombie0

##ANIMATIONS#############################################################################

anim spawn
	loop	0
	delay	1
	offset	17 78
	frame	data/chars/sid/idle00.gif

anim idle
	loop	1
	delay	16
	offset	17 78
	bbox 9 6 24 72
	@cmd clearL
	frame	data/chars/sid/idle00.gif
	frame	data/chars/sid/idle01.gif
	frame	data/chars/sid/idle02.gif
	frame	data/chars/sid/idle01.gif
	frame	data/chars/sid/idle00.gif
	frame	data/chars/sid/idle01.gif
	frame	data/chars/sid/idle02.gif
	frame	data/chars/sid/idle01.gif
	frame	data/chars/sid/idle00.gif
	frame	data/chars/sid/idle01.gif
	frame	data/chars/sid/idle02.gif
	frame	data/chars/sid/idle01.gif
	frame	data/chars/sid/idle00.gif
	delay	24
	frame	data/chars/sid/idle03.gif
	frame	data/chars/sid/idle04.gif
	frame	data/chars/sid/idle04.gif

anim walk
	loop	1
	delay	12
	offset	17 78
	bbox 9 6 24 72
	frame	data/chars/sid/walk00.gif
	frame	data/chars/sid/walk01.gif
	frame	data/chars/sid/walk02.gif
	frame	data/chars/sid/walk01.gif
	
anim run
	loop	1
	delay	12
	offset	17 78
	bbox 9 6 24 72
	frame	data/chars/sid/walk00.gif
	frame	data/chars/sid/walk01.gif
	frame	data/chars/sid/walk02.gif
	frame	data/chars/sid/walk01.gif

anim get
	loop	0
	delay	16
	offset	17 78
	bbox 8 27 26 51
	frame	data/chars/sid/get00.gif
	
anim grab
	loop	0
	delay	16
	offset	22 78
	bbox 9 6 24 72
	frame	data/chars/sid/grab00.gif

anim grabbed
	loop	0
	delay	8
	offset	26 79
	bbox 11 7 24 72
	frame	data/chars/sid/grabbed00.gif
	
anim jumpdelay
	loop	0
	delay	12
	offset	17 78
	bbox 9 6 24 72
	frame	data/chars/sid/jumpdelay00.gif
	
anim jump
	loop	0
	delay	12
	offset	16 71
	bbox 0 3 24 68
	sound	data/sounds/kof/Jump.wav
	frame	data/chars/sid/jump00.gif

anim walkoff
	loop	0
	delay	30
	offset	16 71
	bbox 0 3 24 68
	@cmd jump 1
	frame	data/chars/sid/jump00.gif
	
anim jumpland
	loop	0
	delay	12
	offset	16 71
	bbox 0 20 26 51
	sound	data/sounds/kof/Jumpland.wav
	frame	data/chars/sid/jumpland00.gif

anim pain #UP
	loop	0
	delay	20
	offset	20 78
	bbox 9 6 24 72
	frame	data/chars/sid/pain00.gif
	frame	data/chars/sid/pain00.gif

anim pain2 #DOWN
	loop	0
	delay	20
	offset	20 78
	bbox 9 6 24 72
	frame	data/chars/sid/pain200.gif
	frame	data/chars/sid/pain200.gif

# Dance frames
anim	pain3 
	delay	20
	offset	16 71
	frame	data/chars/sid/jumpland00.gif

anim	pain4 
	delay	20
	offset	17 78
	frame	data/chars/sid/walk00.gif

anim	pain5
	delay	20
	offset	17 78
	frame	data/chars/sid/walk01.gif

anim	pain6
	delay	20
	offset	17 78
	frame	data/chars/sid/a101.gif

anim	pain7
	delay	20
	offset	17 78
	frame	data/chars/sid/walk02.gif
# End of dance frames

anim fall #NORMAL
	landframe 1
	loop	0
	delay	999
	offset	89 66
	bbox 28 4 40 39
	@cmd depost 0
	@cmd finish 0 1 1 0 0 1
	frame	data/chars/sid/fall00.gif
	delay	8
	bbox 0 0 0 0
	sound	data/sounds/sf/Fall.wav
	frame	data/chars/sid/fall01.gif

anim burn #BURNED FALL
	landframe 2
	loop	1 0 2
	delay	3
	offset	89 66
	bbox 28 4 40 39
	@cmd depost 0
	@cmd finish 0 1 1 0 0 1
	drawmethod tintmode 6
	drawmethod tintcolor 255
	frame	data/chars/sid/fall00.gif
	@cmd spawn01 "smoke" 0 50 0
	drawmethod tintmode 2
	drawmethod tintcolor 255
	frame	data/chars/sid/fall00.gif
	delay	8
	bbox 	0 0 0 0
	nodrawmethod
	sound	data/sounds/sf/Fall.wav
	frame	data/chars/sid/fall01.gif

anim shock #SHOCKED FALL
	landframe 2
	loop	1 0 2
	delay	3
	offset	89 66
	bbox 28 4 40 39
	@cmd depost 0
	@cmd finish 0 1 1 0 0 1
	drawmethod tintmode 6
	drawmethod tintcolor -255
	frame	data/chars/sid/fall00.gif
	drawmethod tintmode 2
	drawmethod tintcolor -255
	frame	data/chars/sid/fall00.gif
	delay	8
	bbox 	0 0 0 0
	nodrawmethod
	sound	data/sounds/sf/Fall.wav
	frame	data/chars/sid/fall01.gif
	
anim fall6 #SPIN FALL
	landframe 4
	loop	1 0 4
	delay	3
	offset	89 66
	@cmd depost 0
	@cmd finish 0 1 1 0 0 1
	frame	data/chars/sid/fall600.gif
	frame	data/chars/sid/fall601.gif
	frame	data/chars/sid/fall602.gif
	frame	data/chars/sid/fall603.gif
	delay	8
	sound	data/sounds/sf/Fall.wav
	frame	data/chars/sid/fall01.gif

anim fall7 #SLAMSTART POSITION
	loop	0
	delay	1000
	offset	20 78
	bbox 0 12 40 39
	frame	data/chars/sid/fall700.gif
	frame	data/chars/sid/fall701.gif
	frame	data/chars/sid/fall702.gif
	frame	data/chars/sid/fall703.gif
	frame	data/chars/sid/fall704.gif
	frame	data/chars/sid/fall705.gif

anim fall8 #FINISH/THROW TYPE 3
	landframe 1
	loop	0
	delay	999
	offset	89 66
	bbox 28 4 40 39
	attack1 28 4 40 39 4 1 0 0 0 12
	frame	data/chars/sid/fall00.gif
	delay	8
	bbox 0 0 0 0
	sound	data/sounds/sf/Fall.wav
	attack1 0 0 0 0 0 0 0 0 0 0
	frame	data/chars/sid/fall01.gif

anim fall9 #FINISH/THROW TYPE 2
	landframe 1
	loop	0
	delay	999
	offset	24 66
	bbox 9 27 40 39
	attack1 9 27 40 39 4 1 0 0 0 12
	frame	data/chars/sid/fall900.gif
	delay	8
	bbox 0 0 0 0
	sound	data/sounds/sf/Fall.wav
	attack1 0 0 0 0 0 0 0 0 0 0
	offset	89 66
	frame	data/chars/sid/fall01.gif
	
anim	death
	delay   8
	offset	46 71
	spawnframe 0 0 0 0 0
	@cmd spawnM "zombie0" 0 0 0
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif	

anim rise
	loop	0
	delay	16
	offset	89 66
	frame	data/chars/sid/rise00.gif
	frame	data/chars/sid/rise01.gif
	frame	data/chars/sid/rise00.gif
	frame	data/chars/sid/rise02.gif
	frame	data/chars/sid/rise03.gif

anim freespecial #JUMPATTACK
	range 40 80
	rangea 0 100
	fastattack 1
	jugglecost 10
	forcedirection -1
	loop	0
	delay	4
	offset	21 86
	bbox 8 0 25 60
	jumpframe 0 3 3	
	hitfx	data/sounds/sf/HighKick.wav
	sound	data/sounds/sf/HighAttack.wav
	attack1 0 29 60 35 8 1 0 0 10 12
	frame	data/chars/sid/jumpatk00.gif
	sound	data/voices/signal/signal1.wav
	frame	data/chars/sid/jumpatk00.gif

anim attack1
	range 20 60
	rangea 0 100
	fastattack 1
	jugglecost 20
	forcedirection -1
	loop	0
	delay	6
	offset	17 78
	bbox 9 6 24 72
	sound	data/sounds/sf/MediumAttack.wav
	hitfx	data/sounds/sf/LowPunch.wav
	frame	data/chars/sid/a100.gif
	attack1 35 19 35 16 4 0 0 0 20 12
	frame	data/chars/sid/a101.gif
	delay	8
	attack1 0 0 0 0 0 0 0 0 0 0
	frame	data/chars/sid/a100.gif
	
anim attack2
	fastattack 1
	jugglecost 20
	forcedirection -1
	loop	0
	delay	8
	offset	21 87
	bbox 9 11 28 77
	sound	data/sounds/sf/HighAttack.wav
	hitfx	data/sounds/sf/HighPunch.wav
	frame	data/chars/sid/a200.gif
	delay	18
	attack1 28 6 46 26 8 1 0 0 10 12
	frame	data/chars/sid/a201.gif
	frame	data/chars/sid/a202.gif
	delay	12
	attack1 0 0 0 0 0 0 0 0 0 0
	frame	data/chars/sid/a202.gif
	frame	data/chars/sid/a201.gif
	
anim grabattack #THROW
	loop	0
	delay	12
	offset	17 78
	sound	data/voices/signal/signal1.wav
	@cmd slamstart
	@cmd position 0 24 0 0 0
	@cmd antiwall -30 30 0
	frame	data/chars/sid/grab00.gif
	@cmd position 5 12 25 0 0
	offset	39 78
	frame	data/chars/sid/throw00.gif
	delay	16
	@cmd position 2 -12 25 0 0
	frame	data/chars/sid/throw01.gif
	@cmd depost 0
	@cmd throw 12 2 2 3 0 0
	frame	data/chars/sid/throw01.gif
	delay	8
	@cmd flip
	frame	data/chars/sid/throw00.gif
	@cmd clearL
	frame	data/chars/sid/throw00.gif
	
anim grabattack2 #THROW
	loop	0
	delay	12
	offset	17 78
	sound	data/voices/signal/signal1.wav
	@cmd slamstart
	@cmd position 0 24 0 0 0
	@cmd antiwall -30 30 0
	frame	data/chars/sid/grab00.gif
	@cmd position 5 12 25 0 0
	frame	data/chars/sid/throw00.gif
	delay	16
	@cmd position 2 -12 25 0 0
	offset	39 78
	frame	data/chars/sid/throw01.gif
	@cmd depost 0
	@cmd throw 12 2 2 3 0 0
	frame	data/chars/sid/throw01.gif
	delay	8
	@cmd flip
	frame	data/chars/sid/throw00.gif
	@cmd clearL
	frame	data/chars/sid/throw00.gif
	
anim runattack #SLIDE
	range 20 80
	rangea 0 100
	fastattack 1
	jugglecost 10
	forcedirection -1
	energycost 0
	loop	0
	delay	16
	offset	21 78
	bbox 9 13 28 66
	frame	data/chars/sid/slide00.gif
	bbox 9 21 28 58
	frame	data/chars/sid/slide01.gif
	attack1 23 57 60 22 8 1 0 0 10 12
	@cmd dasher 2 0 0
	hitfx	data/sounds/sf/HighKick.wav
	sound	data/sounds/sf/Slide.wav
	frame	data/chars/sid/slide02.gif
	@cmd dasher 1 0 0
	frame	data/chars/sid/slide02.gif
	@cmd dasher 0.5 0 0
	frame	data/chars/sid/slide02.gif
	@cmd dasher 0 0 0
	attack1 0 0 0 0 0 0 0 0 0 0
	frame	data/chars/sid/slide01.gif
	bbox 9 13 28 66
	frame	data/chars/sid/slide00.gif

anim block
	loop	0
	delay	32
	offset	21 77
	bbox 9 0 28 77
	frame	data/chars/sid/block00.gif
Edit: It works better if I change runattack to freespecial2 here. I don't know why runattack is not accepted with this config?
 
That's a pity that jumpframe command doesn't activate jumpland when the entity is on floor.
Another question, I wish to prevent the Mac Agent shooting the player when they are offscreen.
rqn330H.png

Here is how is currently set their gun shoot:
Code:
anim freespecial3 #FRONT SHOOT
	range 120 400
	rangea 0 0
	loop	0
	delay	8
	offset	19 80
	bbox 8 0 23 80
	frame	data/chars/macleod/macleodhat/shoot00.gif
	frame	data/chars/macleod/macleodhat/shoot01.gif
	frame	data/chars/macleod/macleodhat/shoot02.gif
	@cmd shoot "common_shot" 39 60 0 5 0 0
	@cmd spawnToss "cartridge" 22 60 1 -0.2 1 0
	frame	data/chars/macleod/macleodhat/shoot01.gif
	frame	data/chars/macleod/macleodhat/shoot00.gif
Is there a possibility to make them shoot only whey they appear on screen?
And yes, General Ivan Petrov will be playable on a further developpment :).
 
But jumpframe and landframe aren't connected, as far as I know. And since they are different things, one should not trigger the second.

About the attack, check the manual for offscreen_noatk_factor
 
O Ilusionista: Sid doesn't want to use his jumpland for now, even with landframe command (tested with a long delay too):
Code:
anim freespecial #JUMPATTACK
	landframe 1 0
	range 40 80
	rangea 0 100
	fastattack 1
	jugglecost 10
	forcedirection -1
	loop	0
	delay	20
	offset	21 86
	bbox 8 0 25 60
	jumpframe 0 2.9 2	
	hitfx	data/sounds/sf/HighKick.wav
	sound	data/sounds/sf/HighAttack.wav
	attack1 0 29 60 35 8 1 0 0 10 12
	frame	data/chars/sid/jumpatk00.gif
	sound	data/voices/signal/signal1.wav
	frame	data/chars/sid/jumpatk00.gif

anim jumpland
	loop	0
	delay	12
	offset	16 71
	bbox 0 20 26 51
	sound	data/sounds/kof/Jumpland.wav
	frame	data/chars/sid/jumpland00.gif
Maybye I'm done something wrong?

Code:
offscreen_atk_factor   1
works perfectly, thanks for that :)
 
kimono, I believe you are confusing JUMPLAND and landframe, they are not the same thing at all. You wouldn't even want them to be, since it would force the same landing animation for everything. JUMPLAND plays when landing from a normal jump, or from an attack initiated during a normal jump. That's it. It's never used otherwise.

Landframe {frame} {dust} works in any animation. The next time entity reaches base altitude while falling, the animation skips ahead to {frame}. {dust} is optional. A model named {dust} spawns if you provide one.

So what you do is give the frame immediately before the landframe an infinite delay. You can do this by using a negative delay. Once the entity reaches the infinite delay, it will stay there until it lands, then it skips to landframe {frame}. You style that as your visual landing.

The whole thing looks like this:

Code:
anim <whatever>

jumpframe 1 1 1 0 jump_dust
landframe 5 land_dust

# Crouching down to jump.
delay 10
frame data/folder/sprite_0.png 

# Liftoff on this frame.
frame data/folder/sprite_1.png

# The attack action or whatever.
frame data/folder/sprite_2.png
frame data/folder/sprite_3.png

# Last frame before landing frames needs infinite delay. 
# Any negative delay works as an infinite. I like to use delay -1000 so I
# have some cushion to make global adjustments with script. 
# Example: I might want to make a slow effect by adding +10 to
# all delays, but that would make a delay of -1 into delay 9 and no 
# longer infinite, screwing up the animation. By using a delay 
# of -1000 it just becomes a delay of -990 and is still infinite. :) 
delay -1000
frame data/folder/sprite_4.png

# The landing frames. When entity touches base again, it will skip here no matter what part of animation it was in.
# Make sure to provide a normal delay again so it doesn't get stuck.
delay 15
frame data/folder/sprite_5.png

I might add, you can also use landframe {frame} to override JUMPLAND in the case of jump attacks. That way you could give different jump attacks different looking landings. Maybe a running jump attack takes longer to recover from.

One last thing - there is also dropframe {frame}. It works just like landframe, except the entity skips to {frame} at the peak of its flight. By using dropframe and landframe together in an animation, you can make the animations perfectly synced with flight path no matter the height, terrain, or whatever. The best example is to make nice looking fall animations when entities are thrown or knocked down.

DC
 
Back
Top Bottom