hectrol 4 Posted April 14 Spawn civilian hostage with init, and problem with addAction. The addAction does not work, I have tried several calls like... _x, _this, this, leader CIV_REHEN_NAMUVAKA_1... and nothig. Helpme please and thanks. //nul = [] execVM "spawns\CIV_REHEN_NAMUVAKA_Loop_1.sqf"; //while {true} do { [west, ["Task_CIV_REHEN_NAMUVAKA_1B"], ["Protect the hostages. - Proteja a los rehenes.","Protect the hostages. - Proteja a los rehenes."], none, "CREATED", 2, true] call BIS_fnc_taskCreate; systemchat "CIV_REHEN_NAMUVAKA_1"; CIV_REHEN_NAMUVAKA_1 = [getPos player, civilian, ["C_Man_formal_4_F_tanoan"]] call BIS_fnc_spawnGroup; //{_x doMove ASLtoATL getPosASL PenBLU_OTANDESERT_MEN_Obj_1; _x allowFleeing 0; _x setCombatMode "RED"; _x setskill ["courage",1];_x setUnitPos "UP"; } forEach units CIV_REHEN_NAMUVAKA_1; //{ _x setCombatBehaviour "SAFE"; [group _x, getPos _x, 10] call BIS_fnc_TaskPatrol; } forEach units CIV_REHEN_NAMUVAKA_1; { _x disableAI "PATH"; _x setCaptive true; _x setUnitPos "MIDDLE"; // Add rescue action _x addAction [":: Rescue - Rescatar :: ", { ["Task_CIV_REHEN_NAMUVAKA_1","succeeded"] call bis_fnc_tasksetstate; {_x setCaptive false; _x enableAI "PATH"; _x setUnitPos "AUTO"; {[_x] joinSilent group player;} forEach units CIV_REHEN_NAMUVAKA_1; } ]; } forEach units CIV_REHEN_NAMUVAKA_1; waitUntil {({alive _x} count units CIV_REHEN_NAMUVAKA_1) < 1;}; ["Task_CIV_REHEN_NAMUVAKA_1B","CANCELED"] call bis_fnc_tasksetstate; //}; Share this post Link to post Share on other sites
Schatten 275 Posted April 15 13 hours ago, hectrol said: The addAction does not work That's because your code is wrong. I guess it should be like this (pay attention to the formatting and readability): _x addAction [ ":: Rescue - Rescatar :: ", { ["Task_CIV_REHEN_NAMUVAKA_1", "SUCCEEDED"] call BIS_fnc_taskSetState; { _x setCaptive false; _x enableAI "PATH"; _x setUnitPos "AUTO"; } forEach (units CIV_REHEN_NAMUVAKA_1); (units CIV_REHEN_NAMUVAKA_1) joinSilent (group player); } ]; Share this post Link to post Share on other sites
hectrol 4 Posted April 15 Thanks Schatten for the cleanup BUT when the civilian spawns the addAction still doesn't work. //nul = [] execVM "spawns\CIV_REHEN_NAMUVAKA_Loop_1.sqf"; //while {true} do { [west, ["Task_CIV_REHEN_NAMUVAKA_1B"], ["Protect the hostages. - Proteja a los rehenes.","Protect the hostages. - Proteja a los rehenes."], none, "CREATED", 2, true] call BIS_fnc_taskCreate; systemchat "CIV_REHEN_NAMUVAKA_1"; CIV_REHEN_NAMUVAKA_1 = [getPos player, civilian, ["C_Man_formal_4_F_tanoan"]] call BIS_fnc_spawnGroup; //"C_Man_formal_4_F_tanoan" createUnit [position player, group CIV_REHEN_NAMUVAKA_1]; //{_x doMove ASLtoATL getPosASL PenBLU_OTANDESERT_MEN_Obj_1; _x allowFleeing 0; _x setCombatMode "RED"; _x setskill ["courage",1];_x setUnitPos "UP"; } forEach units CIV_REHEN_NAMUVAKA_1; //{ _x setCombatBehaviour "SAFE"; [group _x, getPos _x, 10] call BIS_fnc_TaskPatrol; } forEach units CIV_REHEN_NAMUVAKA_1; { _x disableAI "PATH"; _x setCaptive true; _x setUnitPos "MIDDLE"; _x addAction [ ":: Rescue - Rescatar :: ", { ["Task_CIV_REHEN_NAMUVAKA_1", "SUCCEEDED"] call BIS_fnc_taskSetState; { _x setCaptive false; _x enableAI "PATH"; _x setUnitPos "AUTO"; } forEach (units CIV_REHEN_NAMUVAKA_1); (units CIV_REHEN_NAMUVAKA_1) joinSilent (group player); } ]; } forEach CIV_REHEN_NAMUVAKA_1; waitUntil {({alive _x} count units CIV_REHEN_NAMUVAKA_1) < 1;}; ["Task_CIV_REHEN_NAMUVAKA_1B","CANCELED"] call bis_fnc_tasksetstate; //}; Share this post Link to post Share on other sites
Schatten 275 Posted April 15 26 minutes ago, hectrol said: forEach CIV_REHEN_NAMUVAKA_1; CIV_REHEN_NAMUVAKA_1 is not an array, but a group. Revert this code as it was originally. Share this post Link to post Share on other sites
hectrol 4 Posted April 15 Yes, now works perfect, Schatten you have saved my life like a hostage. ^_^ Thanker very much. You will appear in the acknowledgments of the scenary. //nul = [] execVM "spawns\CIV_REHEN_NAMUVAKA_Loop_1.sqf"; //while {true} do { [west, ["Task_CIV_REHEN_NAMUVAKA_1B"], ["Protect the hostages. - Proteja a los rehenes.","Protect the hostages. - Proteja a los rehenes."], none, "CREATED", 2, true] call BIS_fnc_taskCreate; systemchat "CIV_REHEN_NAMUVAKA_1"; CIV_REHEN_NAMUVAKA_1 = [getPos player, civilian, ["C_Man_formal_4_F_tanoan"]] call BIS_fnc_spawnGroup; //"C_Man_formal_4_F_tanoan" createUnit [position player, group CIV_REHEN_NAMUVAKA_1]; //{_x doMove ASLtoATL getPosASL PenBLU_OTANDESERT_MEN_Obj_1; _x allowFleeing 0; _x setCombatMode "RED"; _x setskill ["courage",1];_x setUnitPos "UP"; } forEach units CIV_REHEN_NAMUVAKA_1; //{ _x setCombatBehaviour "SAFE"; [group _x, getPos _x, 10] call BIS_fnc_TaskPatrol; } forEach units CIV_REHEN_NAMUVAKA_1; { _x disableAI "PATH"; _x setCaptive true; _x setUnitPos "MIDDLE"; _x addAction [ ":: Rescue - Rescatar :: ", { ["Task_CIV_REHEN_NAMUVAKA_1", "SUCCEEDED"] call BIS_fnc_taskSetState; { _x setCaptive false; _x enableAI "PATH"; _x setUnitPos "AUTO"; } forEach (units CIV_REHEN_NAMUVAKA_1); (units CIV_REHEN_NAMUVAKA_1) joinSilent (group player); } ]; } forEach units CIV_REHEN_NAMUVAKA_1; waitUntil {({alive _x} count units CIV_REHEN_NAMUVAKA_1) < 1;}; ["Task_CIV_REHEN_NAMUVAKA_1B","CANCELED"] call bis_fnc_tasksetstate; //}; Share this post Link to post Share on other sites