Hydric 1 Posted October 15, 2020 Overview I was trying to create an ArmA 3 OPTRE mission, where the player needs to trace data from a communications relay/tower and get the locations of two additional objectives they need to complete in order to extract and complete the mission. The mission is single-player (so far) but will have multiplayer integration in the future. I have the addAction set up to remove itself once the player interacts and executes the code inside the addAction as well, not only that but I also have markers, and a diary record get created when the player interacts with the addAction command. Problem I have a task created whenever the player clears out the communications relay of hostiles (Eridanus Rebel Insurrectionists), the task ID and variable name are both TASK2 (because it's the second task in the scenario) and it's position is also synchronized with the communications tower. The problem that I've been having is an "Expected Task, Got Object" Error from the code in the addAction. The code is listed below. communications_relay addAction ["Learn Objective Locations", {player createDiaryRecord ["Diary", ["Objective Locations", "Intel Recovery: <br />Convoy Assault:]]; "intel_recovery" setMarkerType "hd_objective"; communications_relay removeAction 0; TASK2 setTaskState "Succeeded"}]; Post Now, I'm pretty new to ArmA 3 scripting, so I didn't particularly feel like putting all of the code inside of an external SQF file, mainly because of the fact I didn't wanna deal with passing all of the variables to the script file and then doing it that way. Also, if it's not too much to ask for, I ask for you to please explain what the code solution you send does so I can understand it better. Thanks in advance for the help! Share this post Link to post Share on other sites
Larrow 2820 Posted October 15, 2020 3 hours ago, Hydric said: TASK2 setTaskState "Succeeded" You cannot use the old task commands( setTaskState ) with task IDs created by BI's modules/functions. Instead use the function BIS_fnc_taskSetState to complete the task. Replace with... [ "TASK2", "SUCCEEDED" ] call BIS_fnc_taskSetState Share this post Link to post Share on other sites
Hydric 1 Posted October 15, 2020 28 minutes ago, Larrow said: You cannot use the old task commands( setTaskState ) with task IDs created by BI's modules/functions. Instead use the function BIS_fnc_taskSetState to complete the task. Replace with... [ "TASK2", "SUCCEEDED" ] call BIS_fnc_taskSetState hey! Thanks for the help, this solution helped. I'll be sure to keep this in mind for later. Have a good one! Share this post Link to post Share on other sites
Larrow 2820 Posted October 15, 2020 4 hours ago, Hydric said: communications_relay removeAction 0 Also this ^^ cannot guarantee the action ID is 0. Instead use the params passed to the action to remove the correct ID. On separating out your action onto multiple lines I notice you also have a missing closing " on the tasks description... communications_relay addAction[ "Learn Objective Locations", { //Get passed parameters params[ "_target", "_caller", "_ID", "_args" ]; //_caller person using the addAction _caller createDiaryRecord[ "Diary", [ "Objective Locations", "Intel Recovery: <br />Convoy Assault:" ]]; //<-- missing closing "" "intel_recovery" setMarkerType "hd_objective"; //_target the object the addAction is on, _ID this addActions specific ID _target removeAction _ID; [ "TASK2", "Succeeded" ] call BIS_fnc_taskSetState; }]; 2 Share this post Link to post Share on other sites
Hydric 1 Posted October 17, 2020 On 10/15/2020 at 5:52 AM, Larrow said: Also this ^^ cannot guarantee the action ID is 0. Instead use the params passed to the action to remove the correct ID. On separating out your action onto multiple lines I notice you also have a missing closing " on the tasks description... communications_relay addAction[ "Learn Objective Locations", { //Get passed parameters params[ "_target", "_caller", "_ID", "_args" ]; //_caller person using the addAction _caller createDiaryRecord[ "Diary", [ "Objective Locations", "Intel Recovery: <br />Convoy Assault:" ]]; //<-- missing closing "" "intel_recovery" setMarkerType "hd_objective"; //_target the object the addAction is on, _ID this addActions specific ID _target removeAction _ID; [ "TASK2", "Succeeded" ] call BIS_fnc_taskSetState; }]; yeah, it took me a little bit more to understand this little bit of code, mainly because I had never seem something like it before (at the beginning and stuffs). But I've been doing my research and this has helped a LOT while I worked on my mission. I'm gonna try using external SQF files instead of using the trigger "OnActivation" field from now on, mainly due to the fact that I feel I can do a lot more with SQF files instead of using the on board activation system. Anyways, have a great day and thanks for the wonderful help! (EDIT) For future reference, how would I do the code highlighting for the SQF you put in there? 1 Share this post Link to post Share on other sites
Larrow 2820 Posted October 19, 2020 On 10/17/2020 at 8:21 AM, Hydric said: how would I do the code highlighting for the SQF you put in there? In a new post choose <> from the tool bar to place a code window. In the code window, bottom right, change language section from HTML to C Language. It is not a sqf highlighter so only gives you comment and string highlighting, but will quite often show mistake even before you post. Look out for red dots which show unknown characters which can be a problem when C&P from forum code. Share this post Link to post Share on other sites