CoolSpy 9 Posted June 25, 2018 Hi folks, Thanks to your help, I am about to finish my VIP mission (all the rest is done except this)! Basically, a VIP needs to visit 2 spots out of 8 at random at the beginning of the round. After that he needs to escape. All the tasks are pretty much the same thing, the only thing that changes is location. He needs to stay 300 seconds in a 5m radius of an AI who won't move (to simulate negociations). I would please need advice to do the following: -Randomize 2 out of the 8 tasks -Delay the randomization of the tasks let's say 10 seconds after the VIP spawns (he needs to choose a spawn point between several but I don't want the VIP team to choose the nearest spawn) -I already named my tasks task1, task2 with create task and placed them in Eden so I would like to use them (if possible). If not, external scripts will do! -When 2 out of the 8 tasks are complete, move on to the next task which already exists (escape the island by plane). I already found a good video here but had trouble to make it INDEPENDANT side only and use time instead of distance to locations. TIA for your help guys! 1 Share this post Link to post Share on other sites
7erra 629 Posted June 25, 2018 2 hours ago, coolspy said: Randomize 2 out of the 8 tasks This will assign two random tasks which were created with the createTask module to all playable units: _taskArray = ["task1","task2","task3","task4",...]; _randomTasks = []; for "_i" from 1 to 2 do { _selectedTask = selectRandom _taskArray; _randomTasks pushBackUnique _selectedTask; _taskArray = _taskArray -[_selectedTask]; }; { [_x,true,["Task description",_x]] call BIS_fnc_setTask; } forEach _randomTasks; Put the code in the activation field of a trigger. Add the task IDs to _taskArray. You might need to adjust the other params of BIS_fnc_setTask. If you want to select more tasks you can change the from-to-loop from 2 to any number you want. 2 hours ago, coolspy said: Delay the randomization of the tasks let's say 10 seconds after the VIP spawns Trigger condition: alive VIP_man Set the countdown of the trigger to 10. I'm a bit worried about the task getting messed up and the trigger firing too early but I don't have your setup so testing is up to you. Works for me in a simple SP scenario. 2 Share this post Link to post Share on other sites
CoolSpy 9 Posted June 25, 2018 Thanks so much for your help! The countdown fires the randomization fine! But it does not display or use the tasks descriptions I had created beforehand with createTask but seems to create new empty ones. Not sure how to fix that but he mechanics seems to work. Share this post Link to post Share on other sites
7erra 629 Posted June 25, 2018 Take a look here: https://community.bistudio.com/wiki/BIS_fnc_setTask The third parameter is the description. Therefore any previous set descriptions have to be reapplied. If you have a destination set for the task then you have to pass it to the function as the fourth parameter as well. 1 Share this post Link to post Share on other sites
CoolSpy 9 Posted June 25, 2018 Ah, I see, thanks. Last question: how do I link the task where the vip needs to escape after the 2 random tasks are complete so it automatically selects it next ? Share this post Link to post Share on other sites
7erra 629 Posted June 25, 2018 Oh sorry forgot that one. Add this to the trigger activation: task_global_array = _randomTasks; publicVariable "task_global_array"; And create another trigger with the following condition: {_x} count (task_global_array apply {_x call BIS_fnc_taskCompleted}) == 2 This trigger can then be synced to the next task module. 1 Share this post Link to post Share on other sites
CoolSpy 9 Posted June 26, 2018 Works flawlessly!! Thanks so much, thanks to you and Grumpy Old Man... making my mission was possible! ^^ 1 Share this post Link to post Share on other sites
CoolSpy 9 Posted June 26, 2018 Well, I talked a bit too fast... I tested on my dedicated server with friends and it creates too many tasks for the VIP even if I had set it to 2 only.... that"s weird, when I test it in Eden locally it worked fine. Is this because of local / global parameters ? Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted June 27, 2018 3 hours ago, coolspy said: Well, I talked a bit too fast... I tested on my dedicated server with friends and it creates too many tasks for the VIP even if I had set it to 2 only.... that"s weird, when I test it in Eden locally it worked fine. Is this because of local / global parameters ? Might be caused by the trigger, try setting it to server only. Hard to tell without seeing the rest of it. Cheers Share this post Link to post Share on other sites
CoolSpy 9 Posted June 27, 2018 I think you nailed it.... I tested with all triggers set to 'server only' and it fixed my issue! thanks ;) For information in case future visiters of this thread need all the help and direction they can get, 7erra told me how to make the random tasks1-8 reserved for my VIP (who is the only player in the independant side) If you want to add the task only to players on the independent then you have to change that in the trigger: Trigger 1 From this: { [_x,true,["Task description",_x]] call BIS_fnc_setTask; } forEach _randomTasks; To this: { [_x,independent,["Task description",_x]] call BIS_fnc_setTask; } forEach _randomTasks; 2 Share this post Link to post Share on other sites