Jump to content
Sign in to follow this  
_qor

Check if task = succeeded

Recommended Posts

I want a trigger only to trigger if task3 or whichever has been accomplished!

So what do I have to write into the init-box of the trigger?

thx in advance!

Share this post


Link to post
Share on other sites

Using taskState or possibly triggerActivated

taskState tskSomeTask == "Succeeded"

Or have it check if a trigger that set the task completed was activated;

triggerActivated triggerName

Share this post


Link to post
Share on other sites

You make a trigger and in the condition field you put what will trigger the current task (e.g. Task4) as completed and task3, so for example

Condition: !alive someguy && Task3

OnAct: Task4 = true; settaskstate "SUCCEEDED"; player setcurrenttask task5 etc.

your OnAct for Task 3 being completed should have Task3 = true in it too so it knows it is completed.

Edited by clydefrog
  • Like 1

Share this post


Link to post
Share on other sites

Okay, for a more precise help:

After the mission is done so far, I want a HMMWV to bring me out of the area and trigger the end, when entering a trigger-area.

But this trigger should only trigger, if task3 is succeeded. Not before.

I put "([player1, HMMWV] in thislist)" into the condition-box of the end-trigger. But this could also happen if the previous task hasnt been accomplished.

So I also want to check, if the last task (task3) has been accomplished.

Could somebody write me a precise text for this? Because I dont get what clydefrog tried to tell me and kylania's proposals seem to need further modifications because I get "Type Bool, expected Nothing".

Share this post


Link to post
Share on other sites
Okay, for a more precise help:

After the mission is done so far, I want a HMMWV to bring me out of the area and trigger the end, when entering a trigger-area.

But this trigger should only trigger, if task3 is succeeded. Not before.

I put "([player1, HMMWV] in thislist)" into the condition-box of the end-trigger. But this could also happen if the previous task hasnt been accomplished.

So I also want to check, if the last task (task3) has been accomplished.

Could somebody write me a precise text for this? Because I dont get what clydefrog tried to tell me and kylania's proposals seem to need further modifications because I get "Type Bool, expected Nothing".

trigger settings:

anybody

present

condition: ([player1, HMMWV] in thislist) && task3

just make sure that in your task completion triggers that you have the name of the completed task set as true in the onAct field, e.g. in the trigger that fires to set task3 as complete and sets task 4 as the current task, type task3 = true (if task3 is the name of your third task) in the onAct field along with the code that sets it as complete and sets the next task i.e. task3 setTaskState "SUCCEEDED"; player setCurrentTask task4.

Share this post


Link to post
Share on other sites

Great! It doesnt work so far but thats a approach.

So what I did is:

I put "([player2, HMMWV] in thislist) && task3;" into the trigger in whose area player2 and HMMWV has to be, to end the mission (Type=End#1).

And I put "task3=true" into the trigger, which fires that task 3 has been succeeded when 2 vehicles has been destroyed.

So this trigger fires definitively(I get a hint when fired), but even so player2 and HMMWV are within the predefined area, the mission doesnt end.

Did I forget something?

Share this post


Link to post
Share on other sites
Okay, for a more precise help:

After the mission is done so far, I want a HMMWV to bring me out of the area and trigger the end, when entering a trigger-area.

But this trigger should only trigger, if task3 is succeeded. Not before.

I put "([player1, HMMWV] in thislist)" into the condition-box of the end-trigger. But this could also happen if the previous task hasnt been accomplished.

So I also want to check, if the last task (task3) has been accomplished.

Could somebody write me a precise text for this? Because I dont get what clydefrog tried to tell me and kylania's proposals seem to need further modifications because I get "Type Bool, expected Nothing".

trigger condition returns a boolean, taskState == SUCCEEDED also returns a boolean, true if its succeeded, and false if not.

are you sure you put that code into the trigger activation field?

this is how you do multiple conditions:

([player1, HHMWV] in thisList) && taskState task1 == "SUCCEEDED"

could also do taskCompleted task1 instead

Share this post


Link to post
Share on other sites

So here is what I put into the trigger which checks if vehicles have been destroyed:

Condition:{alive _x} count [ural1,ural2] == 0

OnAct:task3 setTaskState "succeeded"; hint "Well done, stored arms should be destroyed. Meet HMMWV at strangeling-line and get out of there!"; task3=true

and the trigger which shoudl check if task3 is succeeded and player1 and HMMWV is in its area:

([player1, HMMWV] in thislist) && TaskState task3 == "suceeded";

I am standing right next to the HMMWV and in the trigger's area. Then I request artillery to destroy the two urals. Then I get the hint of the first trigger, but np end is coming.

So far it doesnt work...

Share this post


Link to post
Share on other sites
So here is what I put into the trigger which checks if vehicles have been destroyed:

Condition:{alive _x} count [ural1,ural2] == 0

OnAct:task3 setTaskState "succeeded"; hint "Well done, stored arms should be destroyed. Meet HMMWV at strangeling-line and get out of there!"; task3=true

and the trigger which shoudl check if task3 is succeeded and player1 and HMMWV is in its area:

([player1, HMMWV] in thislist) && TaskState task3 == "suceeded";

I am standing right next to the HMMWV and in the trigger's area. Then I request artillery to destroy the two urals. Then I get the hint of the first trigger, but np end is coming.

So far it doesnt work...

Did you copy that code from your game? If so you've spelt "succeeded" wrong in the in the last bit. Also since you've delcared that task3= true, you should only need to type && task 3.

What does that "==0" bit do by the way?

Edited by clydefrog

Share this post


Link to post
Share on other sites

changed it, doesnt work anyway, unfortunately.

even not if I change it to "([player1, HMMWV] in thislist) && task3;"

Share this post


Link to post
Share on other sites
So here is what I put into the trigger which checks if vehicles have been destroyed:

Condition:{alive _x} count [ural1,ural2] == 0

OnAct:task3 setTaskState "succeeded"; hint "Well done, stored arms should be destroyed. Meet HMMWV at strangeling-line and get out of there!"; task3=true

and the trigger which shoudl check if task3 is succeeded and player1 and HMMWV is in its area:

([player1, HMMWV] in thislist) && TaskState task3 == "suceeded";

I am standing right next to the HMMWV and in the trigger's area. Then I request artillery to destroy the two urals. Then I get the hint of the first trigger, but np end is coming.

So far it doesnt work...

task3 = true

thats why its not working, your changing the variable task from a task to a boolean. take this out.

Share this post


Link to post
Share on other sites
task3 = true

thats why its not working, your changing the variable task from a task to a boolean. take this out.

Every mission objective tutorial I've seen has said to use e.g "task3=true" on that tasks completion, also publicVariable = "task3", so you can then refer back to it being completed in other triggers e.g. "&& Task3" to say "and task3 is completed". So you shouldn't use it? I've tried not using the task=true bit before and it hasn't worked when I've tried to refer to the task as being complete in the same way this guy wants to do it.

Edited by clydefrog

Share this post


Link to post
Share on other sites
Every mission objective tutorial I've seen has said to use e.g "task3=true" on that tasks completion, also publicVariable = "task3", so you can then refer back to it being completed in other triggers e.g. "&& Task3" to say "and task3 is completed". So you shouldn't use it? I've tried not using the task=true bit before and it hasn't worked when I've tried to refer to the task as being complete in the same way this guy wants to do it.

i think he meant that for MP, you should have another variable called task3pub that you publicvariable. but its better to use multiplayer framework for this.

This works for me:

init.sqf

task1 = player createSimpleTask ["Obj1"];

task1 setSimpleTaskDescription ["This is obj1", "Obj1", ""];

task2 = player createSimpleTask ["Obj2"];

task2 setSimpleTaskDescription ["This is obj2", "Obj2", ""];

trigger

blufor present

cond: this

act: task1 setTaskState "SUCCEEDED";

place down another man, call him objMan (civilian so he doesnt shoot back at you)

trigger

cond: !alive objMan && taskState task1 == "SUCCEEDED"

on act:task2 setTaskState "SUCCEEDED"

no need for anything else. Perhaps your triggers are not firing off at the right time?

Share this post


Link to post
Share on other sites

Still no solution. Same problem in another mission.

But trigger doesnt fire even if condition is only set to: ([player1,UH60]) in thislist)

And both units are in the area of the trigger!

So I also tried this:

creating a UH60 with the name "abc", and a player with the name "player2"

creating a trigger with:

ACTIVATION:BLUFOR, Present

Type:End#1

Condition: ([player2, abc]in thislist)

But the trigger doesnt fire, although both units are right within its area. WTF?

Edited by _qoR

Share this post


Link to post
Share on other sites

aaaaaaaaah

okay great, now all the stuff works! thanks to you ;)

cheered to soon...

It doesnt work with "moveInCargo" init of the player.

So there is a UH60 and a player with a group which is in cargo of UH60 by "{_x moveInCargo UH60} forEach units group this". That seems to disturb the trigger.

If I take that command away, the trigger fires.

Trigger's setup:player1 in thisList AND UH60 in thisList

How do I solve this?

Edited by _qoR

Share this post


Link to post
Share on other sites

Viktor Reznov has already helped me to solve this problem, but I'll leave the details below in case it ever helps anyone else. Thanks Viktor!!

Here is how I did it:

1. In the "Name" cell in each of the triggers, I gave them each names

t1 for the trigger corresponding to task1

t2 for task2, etc.

Note, when I named the triggers task1, task2, etc. it did not work. Same publicVariable name or something I guess.

Then in the trigger for task5 "Retreat to Safety" I have this:

Condition: this && (triggerActivated t1) && (triggerActivated t2) && (triggerActivated t3)

On Act.: ["task5","succeeded"] call FHQ_TT_setTaskState; taskhint ["Sheerai Veffudahr has struck the enemy and retreated back to safety!", [0.600000,0.839215,0.466666,1], "taskDone"];

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Having some trouble with a trigger that is dependent on previous triggers firing. It is similar to the topic of this thread so hope I'm not out of line to 'resurrect' an older thread.

I'm using some newer and rather specialized script to handle a coop environment (FHQTT); so I can't quite make sense of the help in this thread as it relates to my stuff. Appreciate any help.

Players are five Independent Takistani Local soldiers named "p1", "p2", "p3", "p4", and "p5".

//task1: Rescue comrade

//"p5" has this:

Initialization: _null = [this] execVM "Hostage_male.sqf"; null = [this] execVM "loadoutUnarmed.sqf";

//where Hostage_male.sqf is taco's hostage script

//Associated trigger is like this

Condition: !captive p5

On. Act.: ["task1","succeeded"] call FHQ_TT_setTaskState; taskhint ["Our comrade is free! Faith is rewarded!!", [0.600000,0.839215,0.466666,1], "taskDone"];

//WORKS GREAT--task switches to green in the briefing and popup messages occur as intended. Hostage gets untied

//and joins my group (hope this will work in coop with the hostage as a player).

-=-=-=-=-

//task2: Assassinate officer

Condition: !alive e1

//where "e1" is the enemy officer

On Act.: ["task2","succeeded"] call FHQ_TT_setTaskState; taskhint ["The outpost commander is dead. Allah be praised!", [0.600000,0.839215,0.466666,1], "taskDone"];

//WORKS GREAT--task switches to green in the briefing and popup messages occur as intended

-=-=-=-=

//task3 Sieze Gear . . . players are Mujahideen who start with very little gear

Activation: Independent present in a 15m radius around an ammo crate

Condition: this && ((p1 hasWeapon "ACE_Map") or (!alive p1)) && ((p2 hasWeapon "ACE_Map") or (!alive p2)) && ((p3 hasWeapon "ACE_Map") or (!alive p3)) && ((p4 hasWeapon "ACE_Map") or (!alive p4)) && ((p5 hasWeapon "ACE_Map") or (!alive p5))

//I want this trigger to fire when the players gear up with better gear in the ammo crate. I figure

// everyone will

//grab at least a map and since only the SL has one at start this is working as intended

On Act.: ["task3","succeeded"] call FHQ_TT_setTaskState; taskhint ["We have seized Russian weapons & equipment!", [0.600000,0.839215,0.466666,1], "taskDone"];

//Again, Works Great--Task goes green in briefing and popups occur as intended.

-=-=-=-=

//There will also be a task4 to ambush a convoy, but it is unnecessary to go into the details of that

//here. Now the one that

//is not working task5 Retreat to Safety; this task is intended to be the final task which will allow Mission

//Accomplished some 20 seconds after.

-=-=-=-=-

//task5: Retreat to Safety

20m x 25m Independent Present trigger grouped to player group and set to "Any Group Member"

Condition: this && taskState task1 == "SUCCEEDED" && taskState task2 == "SUCCEEDED" && task3 == "SUCCEEDED";

//later when I add task4 in there will also be a dependency on that one too

On Act.: ["task5","succeeded"] call FHQ_TT_setTaskState; taskhint ["Sheerai Veffudahr has struck the enemy and retreated back to safety!", [0.600000,0.839215,0.466666,1], "taskDone"];

//This task does not fire as I would intend. I'm just testing (no opposition set and everything is grouped very close on

//the map) and I can in 2min get tasks 1, 2, and 3 to fire as intended. However, when I run the group over to the

//compound with task5 trigger area I'm not getting it to fire.

//If I have each task named (task1, task2, task3, task4, etc.) in the Name cell in each trigger, can I instead use:

Condition: this && task1 == true && task2 == true && task3 == true

??

Edited by Anthropoid

Share this post


Link to post
Share on other sites

This is how I accomplish what your trying to do, although I'm not sure why your way is not working.

Objective triggers only on server

cond.

isServer && !alive something 

act.

tskObj1done=true; publicVariable "tskObj1done";

setTask is done in trigger that is !isDedicated

cond.

!isDedicated  && !(isNil "tskObj1done") 

act.

tskObj1 setTaskState "SUCCEEDED"; playSound ""; sideChat ""; taskHint; blabla..

Then i can reference this in briefing for respawn cause I don't use taskmaster, but also reference in trigger like your trying to do

!(isNil "tskObj1done") && !(isNil "tskObj2done") && !(isNil "tskObj3done")

Hope this helps, also I didn't come up with this on my own, just copied the format cause I liked it :)

Edited by PlacidPaul

Share this post


Link to post
Share on other sites

Ah thanks Paul, I'll have to wrap my brains around that. Might have some questions for you when I'm not half asleep ;)

Share this post


Link to post
Share on other sites
Condition: this && ((p1 hasWeapon "ACE_Map") or (!alive p1)) && ((p2 hasWeapon "ACE_Map") or (!alive p2)) && ((p3 hasWeapon "ACE_Map") or (!alive p3)) && ((p4 hasWeapon "ACE_Map") or (!alive p4)) && ((p5 hasWeapon "ACE_Map") or (!alive p5))

//I want this trigger to fire when the players gear up with better gear in the ammo crate. I figure

// everyone will

//grab at least a map and since only the SL has one at start this is working as intended

This kind of setup will fail if not all player positions are taken or if one of the players dies before reaching this point in the mission. In multiplayer one cannot be certain whether all positions are in fact taken and one cannot assume all units will stay alive so it is important to devise conditions that do not depend on the presence of a range of playable units all being there or all having certain gear. In this instance counting the number of magazines or weapons present in the crate and checking whether that count is lower than the known original one would work more dependably. For absolute foolproofness the crate should be made invulnerable or a check introduced to see if the crate has not been destroyed. Murphy's law provides the constitution in MP.

Regards,

Sander

Share this post


Link to post
Share on other sites

could also do taskCompleted task1 instead

Sorry to resurrect this post but its one of the first matches on Google when searching this subject. Just to confirm taskCompleted doesn't appear to work in Arma 3 with the new Task Modules. I know this is the A2 forum but the vast majority of quality editing info is under A2 and so most A3 Editors look there first so just thought I'd FYI for everyone reading this and getting frustrated.

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  

×