Jump to content
Sign in to follow this  
3l0ckad3

Switching action

Recommended Posts

I have looked around and have tried a few things, but I can't get him out of the surrender action after I capture the HVT and he joins my team, below is the syntax I'm using.. Is there also a way of making him surrender if he runs out of ammo ? Not important,, would just add the right spice and emersion 


surrenderOfO1.sqf
This script makes the hvt surrender or fire

 if (round random 100 < 50) then 

{ 
dummyweaponholder = createVehicle ["GroundWeaponHolder", ([getposatl o1, 1.3, getdir o1] call bis_fnc_relPos), [], 0, "CAN_COLLIDE"];
o1 action ["PutWeapon", dummyweaponholder, currentweapon o1];
sleep 3;//try trial and error of this number to the appropiate time
removeallweapons o1;
o1 disableai "move"; 
o1 setcaptive true; 
o1 action ["Surrender", o1]; 
hint "works";
[o1] join p1;}

called on act via trigger when bodyguards are dead

null = [] execVM "surrenderOfO1.sqf"

The HVT's init

this disableAI "move";
this setunitpos "middle"; this addaction ["Capture the Leader",{[o1] join (_this select 1); o1 setcaptive false; o1 setunitpos "auto";
o1 enableAI "Move";o1 removeAction 0;removeallweapons o1}];

Share this post


Link to post
Share on other sites

To free the HVT from anim o1 switchmove ""

 

And about the ammo i would suggest something like _ammo = o1 ammo (currentWeapon o1); _magazines = count magazines o1; if ((_ammo ==0)&&(_magazines==0)) then {do stuff here};

 

Edit: counting magazines like that won't work correctly, it'll count every type atm..

while {true} do{
sleep 1;
_ammo = player ammo (currentWeapon player);
_count = primaryWeaponMagazine player;
_magazines = {_x == _count select 0} count magazines player;
if ((_ammo ==0)&&(_magazines==0)) exitWith {systemChat "empty"};
};

Tried something like this, but it doesnt count the magazine in the weapon.

  • Like 1

Share this post


Link to post
Share on other sites

To free the HVT from anim o1 switchmove ""

 

And about the ammo i would suggest something like _ammo = o1 ammo (currentWeapon o1); _magazines = count magazines o1; if ((_ammo ==0)&&(_magazines==0)) then {do stuff here};

 

Edit: counting magazines like that won't work correctly, it'll count every type atm..

while {true} do{
sleep 1;
_ammo = player ammo (currentWeapon player);
_count = primaryWeaponMagazine player;
_magazines = {_x == _count select 0} count magazines player;
if ((_ammo ==0)&&(_magazines==0)) exitWith {systemChat "empty"};
};

Tried something like this, but it doesnt count the magazine in the weapon.

Thank you so much!

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  

×