Jump to content

Recommended Posts

Hello, guys. I want to create a coop mission. For now, all tasks are going to be for destruction. A friend gave me such a script:

 

BIS_fnc_setTask and BIS_fnc_taskSetState:

["soTaskDemo",true,["Destroy the SAM","Demolition","destroy"],[],"Assigned",0,true,true,"destroy",false] call BIS_fnc_setTask;
while{(alive soDemoTarget)}do{sleep 3};
["soTaskDemo","SUCCEEDED",true] call BIS_fnc_taskSetState;

This script creates an MP task named "soTaskDemo". It is completed when an object called soDemoTarget is not alive.

["soTaskDemo","SUCCEEDED",true] call BIS_fnc_taskSetState; 

This script sets the state to complete.

 

But I don't understand where to put each part of the script, I tried with a trigger and I got an error and just 1 notification for Task completed, although I also created an object named like in the script. Please, tell me where to put what. And what else should I do/create, step by step, to succeed. I know that in MP or Coop I don't need to create the Create Task module and it should work only with scripts. Do I put this script in any .sqf file or what? No idea, so I'd appreciate any help. Thank you. Cheers!

Share this post


Link to post
Share on other sites
1 hour ago, black_hawk_mw2_87 said:

Hello, guys. I want to create a coop mission. For now, all tasks are going to be for destruction. A friend gave me such a script:

 

BIS_fnc_setTask and BIS_fnc_taskSetState:

["soTaskDemo",true,["Destroy the SAM","Demolition","destroy"],[],"Assigned",0,true,true,"destroy",false] call BIS_fnc_setTask;
while{(alive soDemoTarget)}do{sleep 3};
["soTaskDemo","SUCCEEDED",true] call BIS_fnc_taskSetState;

This script creates an MP task named "soTaskDemo". It is completed when an object called soDemoTarget is not alive.

["soTaskDemo","SUCCEEDED",true] call BIS_fnc_taskSetState; 

This script sets the state to complete.

 

But I don't understand where to put each part of the script, I tried with a trigger and I got an error and just 1 notification for Task completed, although I also created an object named like in the script. Please, tell me where to put what. And what else should I do/create, step by step, to succeed. I know that in MP or Coop I don't need to create the Create Task module and it should work only with scripts. Do I put this script in any .sqf file or what? No idea, so I'd appreciate any help. Thank you. Cheers!

 

 

 

You just have to run the code in a scheduled scope.(That means it must run in parallel for some suspension (sleep), so spawned or execVMed, but not called as is from a trigger).

 

You can use the task module, even for MP. There is no problem with that. Someone prefers code for better clarity....

 

Anyway, just test (in a trigger or init.sqf):

0 = [] spawn {

   ["soTaskDemo",true,["Destroy the SAM","Demolition","destroy"],[],"Assigned",0,true,true,"destroy",false] call BIS_fnc_setTask;
   while{(alive soDemoTarget)}do{sleep 3};
   ["soTaskDemo","SUCCEEDED",true] call BIS_fnc_taskSetState;
};

 

   while{(alive soDemoTarget)}do{sleep 3}; .... you can write  waitUntil {uiSleep 3; !alive soDemoTarget};     as well.

 

 

 

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

×