Jump to content
thirith

Spawning tasks in MP, locality, JIP: any standard solutions?

Recommended Posts

I'm currently working on my first MP mission ever, and it's been a steep but exciting learning curve. However, I realise now that I was perhaps too ambitious with respect to what I can do in a first mission. I'm getting there, but in hindsight I might not have done a couple of things the way I chose to do them in the end.

 

The main thing that's currently giving me headaches is this: I'm creating tasks based on certain triggers and Event Handlers. However, I only realised this weekend that these tasks aren't assigned to all playable units but only to the ones that are currently being played. I then thought I'd use a forEach playableUnits loop - but if I create a task and assign it a handle (e.g. {task1 = _x createSimpleTask ["taskName1"]} forEach playableUnits;), I run into the problem that I can only have one task1 at a time.

 

Anyway, to cut things short: for the mission I'm currently doing, which is a six-player coop mission, I'll use a brute-force fix, i.e. I'll name all six players (player_a, player_b, player_c etc.) and I'll basically create six versions of each task (task1a, task1b, task1c etc.), which, if I understand correctly, should allow me to create and update tasks specifically for each of the playable units. I hope it'll work, but it's obviously far from elegant - and if I wanted to create a mission with much larger numbers of playable units, I wouldn't want to do it like this.

 

Which is where my question comes in: by now, is there a standard way of handling tasks in MP missions that allow for respawn and/or JIP? I've heard about TaskMaster, for instance, but haven't looked into it yet, and I don't know whether it also handles respawn/JIP situations.

Share this post


Link to post
Share on other sites

I use setTask and haven't had any issues with it with JIP or respawns, in one of the recent arma 3 updates there was a big Task Overhaul where they fixed a lot of the MP/JIP issues.

You just have to run the code on the server (can be via trigger set to server only) and it will add it to all players (also JIP). Make sure you set the right target!

Share this post


Link to post
Share on other sites

From the page you've linked to, do I understand correctly that these new features are Arma 3-only? For the moment I'm stuck with A2/OA (at least with respect to my coop group), since the people I'm playing with are new to Arma and first want to find out if they actually like the game before they shell out on A3.

Share this post


Link to post
Share on other sites

Yep, arma 3 only, didn't read the topic location, sorry :P

 

Then yea Taskmaster is your best option, I've used it in the past with arma 2 and arma 3 (before overhaul) and its great.

Share this post


Link to post
Share on other sites

Cool, cheers. I'll check out Taskmaster for my next mission that has somewhat complex tasks - though I think I'll do a simple, quick'n'easy one next as a palate cleanser of sorts.

Share this post


Link to post
Share on other sites

I'm not playing on a dedicated server, I'm afraid... Thanks for the offer, though!

Share this post


Link to post
Share on other sites

Hi thirith!

 

I am also quite new in editing and scripting, but I guess that you don't have to create tasks for every player manually. There is an easier way to do it, which I found on this forum:

 

For example: You want to set two tasks: first is destroying SCUD missile launcher, and second is evacuation. So put this in init field of the leader of your group:

{tsk1 = _x createSimpleTask ["scud"];
tsk1 setSimpleTaskDescription ["Destroy Scud missile launcher", "Destroy Scud", ""];
_x setCurrentTask tsk1;
tsk1 setTaskState "Assigned";
tsk2 = _x createSimpleTask ["evac"];
tsk2 setSimpleTaskDescription ["Evacuate from the area of operation", "Evacuation", ""];
tsk2 setTaskState "Created";} forEach playableUnits;

Remember that you can have only one name per one task. Because of this, first task is called tsk1, and second tsk2. 

 

But I still can't find out how to set state of this tasks as succeeded. Putting:

{tsk1 setTaskState "Succeeded";} forEach playableUnits;

or

tsk1 setTaskState "Succeeded";

in trigger on act field do nothing  :( Maybe some other user could find a solution to this  :)

  • Like 1

Share this post


Link to post
Share on other sites
{
tsk1 setTaskState "Succeeded";
} forEach playableUnits;

// or

tsk1 setTaskState "Succeeded";

tsk1 is GLOBAL, so you should try  _tsk1 and "Local player" in Trigger condition to make it locally.

Btw i think you should write your complex scripts using a word processor like Wordpad or Notepad and leave the trigger Condition editor alone.

Just use:  d = [] execVM "myscript.sqf"

  • Like 2

Share this post


Link to post
Share on other sites

I assume the d = is only necessary if the script returns something, right? If it just puts certain things in action, is a variable needed?

Share this post


Link to post
Share on other sites

Thank you very much, Spunkmeyer!

 

 

Also, thirith: when you get familiar with the editor, you could use A2B Editor, to avoid misspelling in commands such as setSimpleTaskDescription etc. But remember to put lines generated with aforementioned application in {} and add forEach playableUnits in the code ;)

Share this post


Link to post
Share on other sites

Cheers. I'm currently using Notepad++ with the Arma-specific plug-in, but I've had some weird crashing problems with edited script, so I'm a bit apprehensive.

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

×