Jump to content
Sign in to follow this  
Deadfast

MultiTask - Multiplayer tasks made easy

Recommended Posts

And you quoted me late, because I had already proofread and fixed the reply before you hit submit, and I fixed it just for you.

Also I tried starting a new thread a while back and only Shk tried to help me with a 2 trigger system and I couldn't get it working. I tried a few times to bring the thread back up to the top, but it kept getting buried fast and nobody ever replied. Then when somebody finally came forward with some help, they basically linked to this post, which I accidentally replied to thinking that I was replying to my old thread.

http://forums.bistudio.com/showthread.php?t=106494

---------- Post added at 07:28 AM ---------- Previous post was at 07:23 AM ----------

You said that most people won't even bother reading my big long garble post. So I replied... "But you did". I was just being funny. I also read all of your script that was hard to decipher, but after pasting it into word it made more sense. I usually just use notepad. Hey, as long as I can get it to view somehow, I don't care what I need to open it with.

Share this post


Link to post
Share on other sites

Working MultiTask the just now seems nice so far.

Q: How would I add text to the Notes section in briefing in MultiTask?

Good Job,

Cheers

Share this post


Link to post
Share on other sites

Version 0.1.4 released.

ADDED: Tasks can now be assigned to specific side(s) only (DFS_setTaskSides, DFS_addTaskSide)

FIXED: DFS_taskHint would display task hint even on clients who did not have the task assigned

Share this post


Link to post
Share on other sites

howdy Deadfast,

just a quick question. Conceptually, what are the major differences between Multitask and Taskmaster2? Your work has a common context in terms of generating mission Tasks, but I'm thinking the approach is different?

cheers

Share this post


Link to post
Share on other sites

The major difference is that with MultiTask tasks can be added/changed/removed on every machine, not only the server. It's also fully stringtable compatible.

Behind the scenes MultiTask should be more network friendly when you have many tasks in the mission. You don't have to publicVariable a huge array every time a task changes.

That's about all I can think of. Frankly, when I made this I was not aware of Taskmaster.

Share this post


Link to post
Share on other sites

great thx for the info. I'm about to dive into task generation, so its good to see a number of different scripted approaches out there. Much appreciated.

cheers

Share this post


Link to post
Share on other sites

@Deadfast

I have started using Multitask. I set up my missions using your example mission. I am generating tasks as the mission runs and calling them via scripts.

Everything works great , but when I hosted a game the script ran on every machine causing Multitask to give an error.

Multitask was trying to created the task, X's the number of folks playing. I got around this problem by using ...if (isserver)... in all the scripts. I noticed in the example mission you did not do that.

Even with the error the tasks still worked and with ,...if (isserver) then {..., I do not get any errors.

I guess I am wondering if I need to do something else.

example:

In a trigger: ...tsk = execvm "tasks\task1.sqf";

scripts :

if (isserver) then {

hint "Tasks Updated";

["DFS_task_sweep",'"Sweep Village"'] call DFS_createSimpleTask; // Create task, global effect

["DFS_task_sweep", '"Take a chopper to LZ Xray, Sweep the Village,Destory weapons cache found"', '"Sweep Village for weapons"', '"Sweep Village for weapons"'] call DFS_setSimpleTaskDescription; // Change description, global effect

["DFS_task_sweep", getMarkerPos "village"] call DFS_setSimpleTaskDestination; // Change destination (where the "marker" is), global effect

"DFS_task_sweep" call DFS_taskCommit; // Commit changes to the task for all connected players

"DFS_task_sweep" call DFS_taskHint; // Show a pretty notification for all connected players

["DFS_task_sweep", "Assigned"] call DFS_setTaskState;

"ap1" setMarkerAlpha 1;

"ap1_1" setMarkerAlpha 1;

"ap1_2" setMarkerAlpha 1;

"LZX" setMarkerAlpha 1;

};

sleep 1;

player setcurrenttask DFS_task_sweep;

I put the last line it outside of the if..then to setcurrent the task to each person playing, so they don't have to. I know if they revive/respawn it does not always work but that is ok.

Share this post


Link to post
Share on other sites

It really depends on how you execute those commands.

In the example mission you can see the init.sqf (which is run on every machine) does have the isServer condition. On the other hand in docsTake.sqf no such condition is needed (and in fact cannot be there) as the script will only get executed on one machine - the client who activates the action on the briefcase.

Share this post


Link to post
Share on other sites

@Deadfast

I missed the isserver in the init.sqf. I also didn't think about the addaction being local to the machine that activated it, so can't have isserver. So , it makes sense now.

I never new what scripting was until I bought ArmaII so I am still trying to wrap my head around alot of this stuff. Just making sure I was not causing any unforeseen problems with multitask.

Thanks for your time and thanks for Multitask.

Nomadd

Share this post


Link to post
Share on other sites

Hi Deadfast,

I have experience of using your script successfully in my last mission, albeit manually typing out all the DFS_ commands in the mission file or seperate small SQF files. Being a fan of the script in my next mission design I am cobbling together an even lazier 'framework' for adding / updating tasks, which compliments your script and the use of stringtables.

As I begin to use MultiTask more I am seeing some issues. For example, I can create a fully fledged task (with marker, status, description, title etc) which works fine and seems to sync well. However, upon some operations such as simply updating the task state for an existing state (to "succeeded", say) it seems to wipe out the task ("any" replaces all fields ingame).

I am no scripting wizard, but would appreciate it if you could look over this simple script and explain why updating the task causes mayhem:

My script

Example use in a mission

Example stringtable

As you can see from the simple script, to update a task with "successful" it does the same DFS_setTaskState + DFS_taskCommit + DFS_taskHint as "assigned" (creating the task), yet one works, one does not?

Whilst my expertise is limited, I have also encountered similar issues in my last mission when it came to updating task state and hinting, so not sure if there is something I'm doing or if there's a bug?

Appreciate any feedback / ideas. edit - Oh, and thanks for the awesome work!! :)

Edited by TangoCharlie

Share this post


Link to post
Share on other sites

Only a quick look for now but from what I can see there is a major flaw within your stringtable system - it will get localized on the server and the server only. That means the tasks will be in whatever language the server is set up to use, not the client's.

As for actual errors, those two lines are wrong:

[_taskstr, "_task_title"] call DFS_createSimpleTask;
[_taskstr, "_task_descr", "_task_mapcap", "_task_mapcap"] call DFS_setSimpleTaskDescription;

These _task_* variables are limited to the scope where it was declared. I believe that's where the Any stuff is coming from.

In any case I shall have a closer look at this tomorrow if you are still struggling with it.

Share this post


Link to post
Share on other sites

Wow, that was quick response - thanks!

With regards to language and localization, that isn't really a major concern (yet). The main reason for using stringtables is lazy / readable editing of the task content.

I'm probably a bit out of my depth understand the scope of variable declarations, certainly in a client/server environment. However, this said, the "assigned" creation code you quoted DOES work, whereas the simple "succeeded" code (which doesn't reference any of the highlighted _task_* variables) DOESN'T?

However, even though I may be missing the point, you may have flicked a switch on in my head in terms of thinking about the locality and scope of variables.

EDIT - Additional:

Made a quick empty mockup mission in editor to test with and demo the problem (alternatively, separate files here).

Most interestingly, using the radio triggers if you create task 1 then task 3 (alpha, charlie) they both work fine and stack up, but if you then radio bravo to 'succeed' at task 1, it will locate the correct task and make it 'successful' but just the other fields are lost.

I think this may be what you were trying to tell me, but I cannot understand why just updating the status requires the task to recall how the other fields were constructed. Surely it just relays the command to all clients to "turn task1 green and signify it is successful"? My belief was once the Task object had been constructed using the script it is 'done' - however, is it that the Task object retains all the component strings, variables, references and such bundled up, and this is why updating it causes it to be lost like you say?

Think I'm slowly getting there but still so very confused! :( Still, thanks for the pointers. Slowly the cogs in my brain are turning...

Edited by TangoCharlie

Share this post


Link to post
Share on other sites

I am working on a new version that will employ much less call compile format's, I will help you out with your trouble once it's out (should be later today).

Share this post


Link to post
Share on other sites

Oh, excellent, appreciated. I hope I haven't unnecessarily made you update the script on my account. :o

EDIT: Fixed! After a brainwave when digesting the above ramblings, I came to realise that upon re-commit'ing a task, it will re-parse the entirety of the task including all text, not just the changes. And it would seem it retains all the referenced variable names, so hence upon running my "successful" 'if' statement it no longer held any record of those strings. Simply by moving the string-table -> var statements to the top of the script, the taskState and taskCommit was able to rebuild the tasks and sync them in their entirety with all the expected text. Thanks for nudging me along in the right direction.

Edited by TangoCharlie

Share this post


Link to post
Share on other sites

MultiTask v0.2.1 released.

Attention, all global variables have been re-tagged from DFS_ to A2S_

Attention #2, instead of using "string of code" it now uses code directly

For example:

["TAG_task_retreat", """Retreat"""] call DFS_createSimpleTask;

Now has to be:

["TAG_task_retreat", {"Retreat"}] call A2S_createSimpleTask;

Share this post


Link to post
Share on other sites

Thanks for the update Deadfast, nice work! :)

To aid my own laziness with the development of a few new multiplayer missions, I have finished developing my LazyTasks script. If you don't mind, I have linked below a link to the script.

LazyTasks, for MultiTask

================

If anyone else is looking for simple and/or lazy creation of tasks with one line of code, this might interest you. I figure this might be of use for amateur mission makers or scripters looking to use tasks with the minimal of fuss. It eliminates the need to get involved with all the complexities of the code and the various tasks commands.

Particularly, a certain individual who derailed this thread and had a fit of frustraton may be the ideal target audience... ;)

LAZY TASKS script
=================
- An easy 'MultiTask' handler for quick and lazy task management in m/p or s/p.
- This script by TC. Heavily dependant on the MultiTask code by Deadfast.
- v1.2, 19th Feb 2011


* Who is this script for and what does it do?
---------------------------------------------
- It allows for the super easy creation, assignment and update of tasks.
- Requires no knowledge of the various separate BIS or MultiTask commands.
- Simple one-line call to the script for all task commands.
- Uses the power of Multitask to make tasks sync in multiplayer & JIP.
- No expertise required with arma scripting - can be called from the editor.
- Task information is stored in the stringtable for easy content editing.

For example, using the script you can type out your task information in the stringtable file using your favourite text editor and then with ONE command:

* Create a fully featured task:
[1, "rescuers", "Assigned", true, true] execVM "LazyTasks.sqf";

  - Create a new "assigned" Task1 for the "rescuers" squad
  (which includes full description, title, hint, map marker and caption),
  will set it as the current task, and fire an additional hint popup.

* Update a task:
[1, "rescuers", "Succeeded"] execVM "LazyTasks.sqf";

  - Update Task1 as "succeeded" for the "rescuers" squad.

Further / full information can be found in the README (click).

Included are full installation and usage instructions, which I have tried to keep as simple as possible.

You can DOWNLOAD the script here (click). The RAR file includes the Readme, LazyTasks 1.2, MultiTask 0.2.1, 'example use' file, an example stringtable.csv and a very basic example mission demonstrating it's use (LazyTask-Example.Takistan).

This may seem pretty pointless for advanced users happy to manually code in all the task information, I wont deny. But if you are phased by complex scripting or if you have a LOT of tasks (as does one of my current projects), this may make life that little bit easier.

Edited by TangoCharlie
v1.2 released

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
Sign in to follow this  

×