Jump to content
Mynock

Cannot set task as completed, am I stupid or something?

Recommended Posts

You'd figure after 2 years of playing Arma I wouldn't be this stupid still, but alas, I am a special breed of stupid...

 

Usually I use the modules, but since the task types are broken in the editor, and I want child tasks for this mission, I've been making tasks with scripts instead using createSimpleTask. Why can't I figure out how to change the task to "succeeded" when a triggers conditions are met? I've tried setTaskState and BIS_fnc_taskSetState in the On Activation fields of triggers but neither do anything for me. I'm not using local variables for my tasks and this is for single player only.

 

To make it crystal clear, in a script that runs from the init.sqf I have:

tsk1 = player createSimpleTask ["myTask"];
tsk2 = player createSimpleTask ["myTask",tsk1];

and then in my trigger's on activation field I've tried for both parent and child tasks:

["tsk1", "Succeeded"] call BIS_fnc_taskSetState; 

or

tsk1 setTaskState "Succeeded";

as examples (obviously if I only want the child task to complete I'd use tsk2 instead of tsk1).

 

Why don't either of those work? Is it because it's from a trigger? Am I going to have to make like 25 mini-scripts for each tasks to get them to complete?

Share this post


Link to post
Share on other sites

That thread is sort of different from what I was asking about, that's why I didn't look in there. I'm not worried about the child tasks all completing with the parent, because I couldn't even get any of them to complete.

 

Sure would have been nice to have seen in the biki that you can't complete createSimpleTasks with anything... Waste of time for me to write my entire script now. Have to essentially start over since the formatting is different and requires a lot more parameters. If only my 3 hours of stupidity could be refunded.

 

Thanks for the help with what you wrote after the thread link, sorry to be such a retard.

Share this post


Link to post
Share on other sites
waitUntil  {time > 0};

private _tsp = player createSimpleTask ["Parent"];
private _tsc = player createSimpleTask ["Child", _tsp];


player addAction ["Complete Parent Task", {
	params ["_trg", "_clr", "_aid", "_arg"];
	_trg removeAction _aid;
	_arg setTaskState "Succeeded"
}, _tsp];


player addAction ["Complete Child Task", {
	params ["_trg", "_clr", "_aid", "_arg"];
	_trg removeAction _aid;
	_arg setTaskState "Succeeded"
}, _tsc];

 

Sample mission (VR map, two actions to complete parent and child task) - just tested and works fine

Share this post


Link to post
Share on other sites

I don't understand why it won't work from a trigger then if it works the way you posted it. Makes no sense and like I said I'm not using local variables in the script so it should work through a trigger in theory.

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

×