Jump to content
Sign in to follow this  
igneous01

A cheap method to make ai drag wounded soldiers

Recommended Posts

I dont know if people are still looking for ways to make ai drag wounded, but here is one method I found that works well and is easy to use.

first make sure the ai unit is nearby another unit - either giving him a doMove or waypoint to the unit in question.

then you need the ai to both play their respected dragging and being dragged animations:

_dragger playAction "grabDrag";
_injured playMove "AinjPpneMstpSnonWrflDb";    
Sleep (0.01);

waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")}; 

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured 
_injured setDir 180; // set injured to turn his back on dragger

that will make them both play their respected animations, and it wait until the animation has changed to where they are both in a drag and dragged state. after the injured unit is attached to the dragger, and has his direction set facing appropriate animation.

Now to make the dragger move: the easiest way to do this is to create another unit that acts like an invisible dummy, attach the dragger to the dummy unit, and make the dummy unit move, instead of the dragger.

_DummyClone = {
private ["_dummy", "_dummygrp", "_dragger"];
_dragger = _this;
// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
_dummygrp = createGroup EAST;
_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
_dummy setUnitPos "up";
_dummy hideobject true;
_dummy allowdammage false;
_dummy setBehaviour "CARELESS";
_dummy disableAI "FSM";
       _dummy forceSpeed 1.5;
_dragger attachTo [_dummy, [0, -0.2, 0]]; 
_dragger setDir 180;
// return dummy object
_dummy
};

this is just a quick function that spawns a dummy unit for the east side and is made invincible and invisible and has his fsm removed to make him not fight or engage. the dummy unit also has forcespeed set on him so that he doesnt start running or speedwalking, making the animation look silly. it is called via:

_dummy = dragger call _DummyClone

now you can control the dummy and give him move orders and it will look like the dragger is moving the wounded unit, however one more thing is missing: giving the dragger the dragging animation, simply do this:

_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM"; _dummy doMove somewhere

that will keep the dragger constantly in a dragging animation state, and the dummy will move to whatever position you specified for him.

if you dont want to use the dummyclone function, simply create a unit in the editor, add all the code from the dummyclone function that disables ai abilities, and attach the dragger to him using the code above, and give the dummy waypoints, it will work too.

Hope some find this useful - it isnt the most prettiest solution, but it works and its much easier to control. I am currently working on a MEDEVAC script that will use this dragging ability to drag wounded into a helicopter. And hopefully, getting it to work as an order in high command so that groups can go off on their own and find wounded people to drag and move to a position. Should make for interesting combat.

cheers

  • Like 1

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  

×