Samcot 12 Posted November 11, 2019 Hey guys. I have placed an object in the editor with the following code in the init - (The code lets me inspect the weapons and plays a cool little sound when activated). this addAction ["Inspect the weapons", { params ["_object","_caller","_ID"]; _object say3D "01"; }]; I want to create a task where I have to inspect the weapons, using the create task module. Is there a way to automatically set the task to "Succeeded" once I have manually clicked "Inspected the weapons" on my object? preferably using setTaskState? I'm kinda new to scripting so if someone would be kind enough to change my code which I pasted above to go straight into the object init that would be great. Thanks in advance. Share this post Link to post Share on other sites
wogz187 1085 Posted November 11, 2019 @Samcot, Quote Is there a way to automatically set the task to "Succeeded" once I have manually clicked "Inspected the weapons" on my object? Like this, inspector= player addAction ["Inspect", "[""task1"",""SUCCEEDED""] call BIS_fnc_taskSetState"]; Have fun! Share this post Link to post Share on other sites
Samcot 12 Posted November 11, 2019 28 minutes ago, wogz187 said: @Samcot, Like this, inspector= player addAction ["Inspect", "[""task1"",""SUCCEEDED""] call BIS_fnc_taskSetState"]; Have fun! That looks great, I'll test it soon. @wogz187 Would you please be able to edit the code so it also includes the command to play my sound? _object say3D "01"; ? Thank you very much for your help :) Share this post Link to post Share on other sites
wogz187 1085 Posted November 11, 2019 @Samcot, Added sound, params and cleaned up. player addAction ["Inspect", { params ["_object","_caller","_ID"]; ["task1","SUCCEEDED"] call BIS_fnc_taskSetState; _object say3D "01"; }]; Have fun! 4 Share this post Link to post Share on other sites
pierremgi 4738 Posted November 11, 2019 you can use code { } instead double quote " " in addAction. It's far easier in any sqf editor for tracking errors. And the quadruple quote "" "" will stay double " ". Side note: before the quadruple, even if it works, you could use the single one ' '. So working hierarchy is: " ' "" "" ' ". Where you can use code { " ' ' " }. 3 Share this post Link to post Share on other sites
Samcot 12 Posted November 11, 2019 26 minutes ago, wogz187 said: @Samcot, Added sound, params and cleaned up. player addAction ["Inspect", { params ["_object","_caller","_ID"]; ["task1","SUCCEEDED"] call BIS_fnc_taskSetState; _object say3D "01"; }]; Have fun! Thanks so much wogz! I need to learn about params as I have no clue what they do. :) Share this post Link to post Share on other sites
Vandeanson 1676 Posted November 11, 2019 1 minute ago, Samcot said: I need to learn about params YES! trust me it is a game-changer and it will lift unnecessary restrictions and complications you would otherwise put yourself under. PM me if you want to dig into it, i am happy to help and share what i know. Cheers Vd 3 Share this post Link to post Share on other sites
Samcot 12 Posted November 11, 2019 1 minute ago, Vandeanson said: YES! trust me it is a game-changer and it will lift unnecessary restrictions and complications you would otherwise put yourself under. PM me if you want to dig into it, i am happy to help and share what i know. Cheers Vd Thanks for offering to help out man! I might just do that later on today. :) Share this post Link to post Share on other sites
wogz187 1085 Posted November 11, 2019 @Samcot, Quote I need to learn about params as I have no clue what they do... Check this out, Have fun! 3 Share this post Link to post Share on other sites