Dayzai with melee weapons

try adding the weapon in the ai config
files ...,see what happens. since the hatchet is a reskinned shotgun (or it used to be) the ai will probably try to shoot it from a distance.
 
I tried your suggestion but the AI ran up with the axe and there was no swinging animation I got damaged alright and the ai even closed in the attack again when i got out of range which was good.I read on the epoch forums that this was needed in order for the ai to play the animation when swinging melee weapon.
Where would I need to put this line.
And it has to swing only melee weapons so if the ai is equiped with a gun I don't want it to swing it.
Thanks also for the reply guys:)
_aiunit addEventHandler ["fired", {(_this select 0) playActionNow "GestureSwing";}];
 
that would go in the dzai code where the unit is created.
https://github.com/dayzai/DZAI/blob/master/DZAI/spawn_functions/spawnBandits.sqf
there are a bunch of spawn scripts in dzai depending on what the circumstances are.
The addeventhandler would execute that code whenever that event occurs, so then .. yes, it would do that animation when they shot a weapon.
What you could do is add code to this
{(_this select 0) playActionNow "GestureSwing";}
that checks the targets range so the 'GestureSwing" will only be shown when they are attacking a player that is less than 3 meters away. Of course they would then swing their pistol at you when face-to-face shooting too.
 
I gave it a go and put the:_aiunit addEventHandler ["fired", {if (_this select 1 == "meleeweapon classname") then { (_this select 0) playActionNow "GestureSwing";};}];
In the spawn_functions/spawnBandits.sqf
but the ai still didnt want to play the animations I tested it out with a ai that had a crowbar:(
 
_aiunit addEventHandler ["fired", {if (_this select 1 == "MeleeHatchet") then { (_this select 0) playActionNow "GestureSwing";};}];
Thats what I put in and changed the weapon to hatchet to make it easyer.
Still no go:(
 
I just wanted to add this to dzai so it would add a bit more versatility to the ai units spawned in and make it a little bit easyer on the players at the same time.
 
Top