Dayzai with melee weapons

Discussion in 'DZAI' started by Victor_Cross, Aug 14, 2015.

  1. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
    Is it possible to get the dayzai to use melee weapons and if so how?
     
  2. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    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.
     
  3. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
    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";}];
     
  4. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    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.
     
  5. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    better solution ..
    checking out the "fired" event handler it will pass the weapon to the code you are executing. so you can check to see if the weapon is of a melee type.
    https://community.bistudio.com/wiki/ArmA_2:_Event_Handlers

    Code:
    _aiunit addEventHandler ["fired", {if (_this select 1 == "meleeweapon classname") then { (_this select 0) playActionNow "GestureSwing";};}];
    
     
  6. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
    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:(
     
  7. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    You did change the meleeweapon classname to the classname of your crowbar .... Right?
     
  8. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
    _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:(
     
  9. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
  10. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    What kind of errors are in your RPT files? the animation is probably on the client side so you have to browse to your client arma2oa.RPT

    [​IMG]
     
  11. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
    I dont know what you mean the ai just did not want to play the animation it held onto the hatchet and moved one of its fingers only.
     
  12. Victor_Cross

    Victor_Cross New Member

    Joined:
    Jul 6, 2015
    Messages:
    9
    Likes Received:
    0
    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.
     

Share This Page