Forum Jump :

Author Message


Posts: 2
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2017-12-19 03:02        
     
I'm having trouble removing the action once its completed. probably something simple but I'm very new to scripting
(script below)

this disableAI "move"; this setcaptive true; this addaction ["Extract", {[hostage] join (_this select 1); hostage setunitpos "auto"; hostage enableAI "Move"; hostage removeaction "Extract"; }];

the game wont recognise the action id, again I've probably done something obviously wrong but I cant work it out.

This post was edited by Rather_Smashing (2017-12-20 01:08, 273 days ago)


Author Message


Posts: 143
Rank:


Level: Member

Country: us
Location: Pennsylvania
Occupation:
Age:
In-game name: Xian

 
#2 Posted at 2017-12-19 12:37        
     
Try this, can't test it but should work:

this setcaptive true;
this addaction ["Extract", {
	_action = _this select 2;
    [hostage] join (_this select 1);
    hostage setunitpos "auto";
    hostage enableAI "Move";
    hostage removeaction _action;
    }
];

And in case you wanted to use the new Hold Action styles which work great for hostage situations:
[
    hostage,
    "Extract",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
    "_this distance _target < 3",
    "_caller distance _target < 3",
    {},    
    {},                      
    {
        [hostage] join (_this select 1);
        hostage setunitPos "AUTO";
        hostage enableAI "MOVE";
    },
    {},   
    [],      
    2.5,
    0,
    true,   
    false
] remoteExec ["BIS_fnc_holdActionAdd",0,hostage];
That should auto remove the action when you complete it.

This post was edited by XianGrim (2017-12-19 14:14, 273 days ago)


Advertisement


Author Message


Posts: 2
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2017-12-20 01:08        
     
# XianGrim : Try this, can't test it but should work:

this setcaptive true;
this addaction ["Extract", {
	_action = _this select 2;
    [hostage] join (_this select 1);
    hostage setunitpos "auto";
    hostage enableAI "Move";
    hostage removeaction _action;
    }
];

And in case you wanted to use the new Hold Action styles which work great for hostage situations:
[
    hostage,
    "Extract",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
    "_this distance _target < 3",
    "_caller distance _target < 3",
    {},    
    {},                      
    {
        [hostage] join (_this select 1);
        hostage setunitPos "AUTO";
        hostage enableAI "MOVE";
    },
    {},   
    [],      
    2.5,
    0,
    true,   
    false
] remoteExec ["BIS_fnc_holdActionAdd",0,hostage];
That should auto remove the action when you complete it.

ive ended up using the first solution, but ill probably try out the other another time. thanks very much :)