Jump to content
Sign in to follow this  
frankfranconi

Simple tasks are a pain in the ass

Recommended Posts

I didn't really know where to post this, as it's a cry for help and a rant at the same time. Sorry about this unfortunate combination.

I recently discovered the new "Sector" module and wanted to create a mission based around capturing different sectors and advancing towards a final target. The sector module is quite solid, it pretty much works for me and I was able to create two sectors.

But that was when the problems started. I didn't want to simply place players on the map and tell them to capture sectors. So I managed to get a parachute insertion followed by a land-based transport to the AO running.

In order to do this properly, I was thinking of two tasks, one for steering the parachute to the LZ and the other for driving near the first sector, before I'd activate the sectors and let the module handle this part of the mission.

First, I tried the new tasks module, because it allows me to do everything from inside the editor instead of going through the schizophrenic process of having stuff in the editor and tons of scripts outside the game. I can't belive it's still impossible to edit scripts from inside the game. Anyway, while I got the task module to work in a previous mission (after a lot of fiddling around due to its bugginess), it plain screwed me this time. Depending on which task I placed first, the other one wouldn't show up in the mission, although I double checked everything and did it exactly the same as in my other missions. After trying all possible and impossible combinations in the editor, I finally gave up on the completely bugged task module.

How did something like this even make it into the release?

So I resorted to good old scripting and put all the stuff in briefing.sqf

waitUntil { !isNil {player} };
waitUntil { player == player };

switch (side player) do 
{
case WEST:
{
	player createDiaryRecord ["Diary", ["Execution", "This is simple. Remove the enemy at all cost and deal with General Agha in a way that seems appropriate to you. We could take him prisoner, but this would cause a long trial and who wants that? So we'd appreciate it if you could just execute him. We'll say he was armed and it was self-defense. Then we'll throw him overboard in the middle of the sea and everybody's gonna be happy. Okay?"]];
	player createDiaryRecord ["Diary", ["Situation", "The Iranians offered their help in removing General Agha, but having foreign troops in our AO would be inacceptable. That's why we're dealing with the problem ourselves."]];
	player createDiaryRecord ["Diary", ["Mission", "General Agha of the Iranian Armed Forces has gone rogue and is occupying part of the island with his troops. He acted against the direct orders of his government, we are currently not at war with Iran."]];

	[player, "tLand", ["Land at the designated LZ","Land", "Land"], getMarkerPos "mLand", "Assigned", 1] call BIS_fnc_taskCreate;
	[player, "tDrive", ["Drive near the AO","Drive", "Drive"], getMarkerPos "mDrive", "Created", 2] call BIS_fnc_taskCreate;

};

case EAST:
{ 
};

case RESISTANCE:
{ 
};

case CIVILIAN:
{ 
};

};

Despite SQF being the abomination it has always been, this stuff just works. All the tasks were showing up and I could easily place a trigger activated by BLUFOR presence that did

["tLand", "Succeeded"] call BIS_fnc_taskSetState;
["tDrive", "Created"] call BIS_fnc_taskSetState;
["tDrive", "Assigned"] call BIS_fnc_taskSetState;

on activation. At first however, I only let it do

["tLand", "Succeeded"] call BIS_fnc_taskSetState;
["tDrive", "Assigned"] call BIS_fnc_taskSetState;

because the second task is already created in briefing.sqf and I don't see the need to set its state to "Created" again before assigning it. But without setting the state to "Created" again, the notification that it has been assigned wouldn't show up. It would simply say the first task has been done and assign the second one, without showing a notification.

But anyway, with this problem fixed, everything seemed fine and the mission was ready to be tested with another player. It went well until the first task was changed to "Succeeded". This worked, but shortly after the notification showed up again and the "Task assigned" for the second task also showed up twice.

Now, I'm aware that each script is executed on every machine locally, which makes scripting in missions with many players very difficult. Could this be the cause of my problem?

I really feel like quitting this mission, because it seems to me as though ArmA 3 tries to sabotage my efforts each time possible, which is unbelievably frustrating. Perhaps you know that feeling.

It really sucks, because I know it's possible to create awesome missions in ArmA and the game itself has so much potential. But because the game's so badly made in some respects, the experience never really lives up to that potential. It starts deep down with ArmAs inability to use more than one processor core (which I didn't think is still a thing today), goes on with the fact that you have to switch between the game and your file system to script missions and ends with stuff like non-functioning task modules in the editor.

I really love this game, but sometimes I can't help but hate it and can't understand how something can suck so much.

Share this post


Link to post
Share on other sites

Take it easy bro just covering the basics first. I experienced this pain also. It's good that you made the task locally that way the notification shouldn't show up more than once for players. I don't personally use "BIS_fnc_taskCreate"

I use BIS_fnc_setTask. The setTask function has the notification parameter as well as making the task local or not. Look into using that one. It's pretty much the same as taskCreate with more options. If you know what you're doing I would say create the task in the trigger instead of the briefing.sqf.

Share this post


Link to post
Share on other sites

I use Shuko's Taskmaster. I really don't see any loss of control when using it either.

I have so far found no locality issues in MP - using both scripts and triggers to call/update the tasks.

Although its not for everyone.

Share this post


Link to post
Share on other sites

@Johnson11B2P

I'd give BIS_fnc_setTask a go, but unfortunately it isn't very well-documented. The BI Wiki doesn't have a page on it and the only helpful one of the four sites I found with Google was your thread where you apparently struggled with a similar problem. I didn't find any finished solution though, I'd be very grateful if you could share the meaning of all the parameters or post an example of a working BIS_fnc_setTask.

@KevsnoTrev

Thanks for the hint, if I can't find a simple solution I'll definitely try Taskmaster.

Thanks and good night everyone!

Share this post


Link to post
Share on other sites

Use the function button in the editor where you can find the documentation for BIS_fnc_setTask. I'll copy it here and show you an example.

BIS_fnc_SetTask;
/*
Author: Karel Moricky

Description:
Set a task parameters.
Create the task when it doesn't exist.

Parameters:
	0: STRING or ARRAY - Task ID or array in the format [task ID, parent task ID]
	1: Task owner(s)
		BOOL - true to set task of all playable units
		OBJECT - set task of a specific object
		GROUP - set tasks of all objects in the group
		SIDE - set tasks of all objects of the given side
		ARRAY - collection of above types
	2: ARRAY - Task description in the format ["description", "title", "marker"]
	3: Task destination
		OBJECT
		ARRAY - either position in format [x,y,z], or [object,precision] as used by setSimpleTaskTarget command
	4: Task state
		STRING - one of "CREATED", "ASSIGNED", "SUCCEEDED", "FAILED" or "CANCELED"
		BOOL - true to set the task as current
	5: NUMBER - priority. When a current task is completed, system select a next one with the larges priority >= 0
	6: BOOL - true to show notification (default), false to disable it
	7: BOOL - true to set task globally (default), false to set it only locally

Returns:
STRING - Task ID
*/

/*Your Code*/

[player, "tDrive", ["Drive near the AO","Drive", "Drive"], getMarkerPos "mDrive", "Created", 2] call BIS_fnc_taskCreate;

/*BIS_fnc_setTask*/

["tDrive",player,"Drive near the AO","Drive","Drive"],[(Place a invisible helipad where you want the objective to be located),true],"ASSIGNED",2,true,false] call BIS_fnc_setTask;

The tricky part about any task is how it is being called. If you make a task inside a basic trigger with a condition of this you need to make sure the task is local not global. The only time I would use global is if only one player executed a sqf that had another task inside. That way everyone will get the task when only one player activated the task.

Share this post


Link to post
Share on other sites

BIS_fnc_setTask is called BY BIS_fnc_taskCreate. You don't need to call it manually, it'll be done by the task system.

Just use BIS_fnc_taskCreate.

Share this post


Link to post
Share on other sites

@Johnson11B2P

Yeah, just figured out the function viewer myself. Great tool, especially since the biki is lacking sometimes. Thanks!

@kylania

Yeah, I noticed while looking at BIS_fnc_taskCreate's code. Thanks for giving me a hand. The longer I look at all the SQF stuff the more I understand

Share this post


Link to post
Share on other sites

Once the new dev branch hits the modules for tasks might be a good method to use too. They've combined a lot of things into the CreateTask module so you don't need to have 3 separate modules for one task create anymore. Just put the module where you want the destination, choose who gets it, what to start it as and all that jazz.

Share this post


Link to post
Share on other sites

Since I'm subscribed to the dev branch I already noticed their efforts to simplify this. I really like where this is going, but as of now I was still unable to really use it since it bugged me out. But it's great they're working on it!

Share this post


Link to post
Share on other sites

I have used the new task module since it has come over to the stable branch which works up to a point. It is creating the task and putting a marker/waypoint on the map. It isn't notifying when a task has been completed or when a new task has been created. When you look at the tasks, the completed task has been removed and only the current task is there. Is this how it is supposed to work or am I missing something?

Share this post


Link to post
Share on other sites

You need to tell the system when a task has been completed by synching a taskState module to both the CreateTask module and the trigger determining when it's completed.

Tasks shouldn't be removed while using modules though.

Share this post


Link to post
Share on other sites

Task modules working with JIP - CO-OP - Hosted stable

Thought I would start a new thread as this may help some ppeps

I have just been messing with the task modules and have managed to get it working in a mission I made (8 player CO-OP, hosted, stable build). Mission starts first task is autamatically assigned to all players - if someone joins BEFORE task 1 is completed the they also get task 1 assigned to them. Once task 1 completes it automatically assigns task 2 to all players If someone joins AFTER task 1 has been completed then they get TASK 2 assigned. It was a bit hit and miss getting it to work but it seems to work perfectly and is JIP compatible

we have one squad of 8 blufor

Task 1 was simply to destroy Anti Air vehicle

make a CREATE TASK MOD synched to grp leader

make a SET TASK STATE MOD set to ASSIGNED synched to CREATE TASK MOD

make a SET TASK DESTINATION synched to CREATE TASK MOD and placed near the AA vehicle

make a second SET TASK STATE MOD set to SUCCEED and synched to a trigger thats is checking !alive aa1 and ALSO synched to CREATE TASK MOD

Task 2 was to go to a location

Make a second CREATE TASK MOD synched to grp leader (this will be task 2)

Make third SET TASK STATE MOD set to ASSIGNED synched to the tirgger mentioned above (checking !alive aa1) AND synched to the second CREATE TASK MOD

Make a second SET TASK DESTINATION synched to the second CREATE TASK MOD and placed near the location blufor need to get to.

Make a forth SET TASK STATE MOD (this is 4 so far) set to SUCCEED synched to a NEW trigger that is checking for blue players to be present in an area and to the second CREATE TASK MOD

and so on.

The trigger that checks when the Anti Air is destroyed does two things. It sets task 1 to suceeded and sets task 2 to assigned

Just to note I did not use any SET TASK DESCRIPTION MODS (I couldnt really work out what they were for) and it makes the editor look a mess with blue lines all over the place but it does work with jip.

It did appear that you have to setup ALL tasks before they appear correctly on HOSTED - from the editor it all looked ok when I was testing them out even though I had only setup 3 of the 5 tasks but when I tested on hosted the tasks appeared in the wrong order. Once I went back into editor and completed setting up the remaining two tasks then it worked fine on hosted.

Hope this helps

Share this post


Link to post
Share on other sites

I have used a create task module placed on the site of the task with the state set to assigned. A trigger is used for when the task has been completed. The trigger is synced with a task state (succeeded) module which is synced to the task created module. The trigger is also synced to the createtask module for the next task. One thought I have just had is that the task succeeded modules were placed before yesterday's update. Perhaps I need to delete them and put new ones down, although the task created modules automatically changed to the new style without having to do that.

Share this post


Link to post
Share on other sites

I just set up a example exactly how you describe alky_lee and it's working for me. The only thing I don't like is the 2nd task is created before the first task is completed task hint wise, but otherwise it's all good.

Share this post


Link to post
Share on other sites

I will redo the succeeded modules later. I can't run Arma 3 on this PC.

Share this post


Link to post
Share on other sites

I have solved my problem, I think. The task ID fields in the new create task modules were empty. This meant only one task could run at a time and not necessarily in the right order.

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  

×