Jump to content
Sign in to follow this  
GIJOE94

Kill with weapon strike

Recommended Posts

Is it possible to have my player use the strike with weapon action using the actions menue? If so, how?

Share this post


Link to post
Share on other sites

Not without scripts. There aren't any "strike" animations in ArmA that I know of, so while it's possible to script, it will look dorky.

Here are unchanged scripts from my DM Zombies, note that long lines are broken to the next line by the forum.

zombieattack.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;zombie attack script by Celery

_wait=0.05

attackactive=0

#loop

~_wait

_wait=0.05

?!alive player or !(player iskindof "Civil_Undead_1"):goto "loop"

enemies=nearestobjects [player,["Man"],100]

;?(count enemies)<=1:goto "loop"

enemie=enemies select 1

attackarray=(actionKeys "ToggleWeapons")

_keyname=keyimage (attackarray select 0)

;;;;;;;;;;

#dir

_arc=160

_withinarc=0

_pdir=getdir player

_dir=[((getpos enemie select 0)-(getpos player select 0)),((getpos enemie select 1)-(getpos player select 1)),0]

_dir=(_dir select 0) atan2 (_dir select 1)

?_dir<0:_dir=360+_dir

?_dir<180 and _pdir>180:_pdir=_pdir-360

?_dir>180 and _pdir<180:_dir=_dir-360

_dif=abs (_pdir-_dir)

?_dif<=(_arc/2):_withinarc=1

?attackactive==1:goto "attack"

;;;;;;;;;;

_dist=2

?prone==1:_dist=2.5

?attackactive==0 and _withinarc==1 and alive enemie and player distance enemie<_dist and ((getpos player select 2)>0.1 or ((animationstate player)=="amovpercmstpsnonwnondnon") or ((animationstate player)=="amovppnemstpsnonwnondnon")):canattack=0;attackactive=1;titletext [format["Attack\n\n%1",_keyname],"plain down",1];goto "attack"

goto "loop"

#attack

?attack==0:canattack=1

?((getpos player select 2)>0.3) and speed player>10):attack=1;canattack=1

?attack==1 and canattack==1:[player] exec "maul.sqs";_wait=1;goto "loop"

?!alive player or _withinarc==0 or !alive enemie or player distance enemie>_dist or ((getpos player select 2)<0.1 and ((animationstate player)!="amovpercmstpsnonwnondnon") and ((animationstate player)!="amovppnemstpsnonwnondnon")):attackactive=0;titletext ["","plain down",1];goto "loop"

~0.01

goto "dir"

;goto "attack"

maul.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?attackedtarget==enemie:exit

attackedtarget=enemie

attackedtarget setdammage 1

attackactive=0

?(getpos player select 2)>0.1:goto "skip"

_rn=random 3

?ceil _rn==1:player setvehicleinit "this say ""atk_1"""

?ceil _rn==2:player setvehicleinit "this say ""atk_2"""

?ceil _rn==3:player setvehicleinit "this say ""atk_3"""

#skip

titletext [format["You killed %1",name attackedtarget],"plain down",0.3]

?enemie iskindof "Civil_Undead_1":titletext [format["You killed the living corpse of %1",name attackedtarget],"plain down",0.3]

~0.2

player setvehicleinit ""

@!alive attackedtarget

player addscore 1

killed=attackedtarget;publicvariable "killed"

killer=player;publicvariable "killer"

attackedtarget=objnull

exit

This method doesn't play an animation because I didn't find a suitable one.

Share this post


Link to post
Share on other sites

The CZM zombies "strike" effect was simply the throwing of a grenade. It looked pretty realistic, but not a strike or a punch.

Also, and I'm going out on a limb here, but possibly the animation could be taken from the karate moves for a punch (is that stored in an RTM file somewhere perhaps)?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×