Jump to content
Sign in to follow this  
Romeo_Delta

Task Status won't change upon completion

Recommended Posts

Need some help with my code. Basically, when a BLUFOR enters a trigger area, an objective is completed and a hostage is added to the player's group. The player also gains access to a helo extraction command thanks to Norrin's script. However, even though the hints pop up saying objective completed, the task status doesn't change. Here's what I've got:

Briefing.sqf

obj1 = player createSimpleTask ["Find hostage"];
obj1 setSimpleTaskDescription ["Fing where the hostage is being held", "Find hostage", ""];
obj1 setSimpleTaskDestination (getMarkerPos "hostage");
player setCurrentTask obj1;

Trigger On Act.

setcaptive false; [hostage] join rescuegrp; "obj1" objStatus "DONE"; tskobj1 setTaskState "SUCCEEDED"; publicVariable "Hostage"; taskhint ["Task Completed!\nHostage rescued!", [0, 1, 0, 1], "taskDone"]; player setVariable ["NORRN_taxiHeli", helicopter, true]; obj2 = player createSimpleTask ["Extract hostage"];  obj2 setSimpleTaskDescription ["Call in an extraction helicopter and get the hostage to safety", "Extract hostage", ""];  player setCurrentTask obj2;

I'd appreciate some help.

Share this post


Link to post
Share on other sites

maybe you need to add this when you create your task :

obj2 setTaskState "Created";

or

obj2 setTaskState "Assigned";

Share this post


Link to post
Share on other sites

I get an undefined variable in the expression error when I added that. And isn't it "Created" by default?

Share this post


Link to post
Share on other sites

"tskobj1" is an undefined variable. You need to use the variable that you actually assigned to the task, which is "obj1" in this case.

Also, the objStatus command is obsolete and does nothing. It will have no effect on the status of ArmA 2 tasks.

Share this post


Link to post
Share on other sites

as St_Dux and Ios already said, you need to assign the task a state first, and you need to use createsimpletask and settaskstate, not objstatus, those commands no longer work in arma 2

Share this post


Link to post
Share on other sites

I've got it working, thank you. Multiple tutorials I read/watched used the objStatus command, so I was unaware it was no longer in use. The reason I was getting an undefined variable error (besides calling it the wrong thing) was that I put it in my code before I defined it, so essentially I was trying to set the status to assign before it the task was even created. Silly me.

Thanks for the help.

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  

×