panicsferd 25 Posted December 2, 2014 I am currently working on a mission where the beginning part you are training for the various battles and I would like to know (if it is at all possible) to have it where a task will complete after the player shoots three target dummies that are in a section? Share this post Link to post Share on other sites
jshock 513 Posted December 2, 2014 (edited) In your init.sqf: missionNamespace setVariable ["3TargetCount", 0]; And a Hit EH in each of your target init fields: //sort of pseudo this addEventHandler ["Hit", { if (missionNamespace getVariable "3TargetCount" >=3) then { ["TaskName","Succeeded",true] call BIS_fnc_taskSetState; (_this select 0) removeAllEventHandlers "Hit"; } else { missionNamespace setVariable ["3TargetCount", (missionNamespace getVariable "3TargetCount") + 1]; }; }]; Edited December 2, 2014 by JShock Share this post Link to post Share on other sites
Larrow 2822 Posted December 3, 2014 Only slight problem with your code JShock is that you could hit 1 dummy multiple times and complete the task, also you would have to hit 4 dummies to complete as your check is before adding the recent hit. In one of the dummies init field place the code below, just fill out the first array with the name of all your dummies. Just thought this would make it easier than having to paste code in all the dummies. dummies = [ dum1, dum2, dum3 ]; { _x setVariable [ "HitID", _x addEventHandler [ "Hit", { missionNamespace setVariable [ "numDummies", ( missionNamespace getVariable [ "numDummies", 0 ] ) + 1 ]; if ( numDummies == 3 ) then { [ "TaskName", "Succeeded", true ] call BIS_fnc_taskSetState; }; _dummy = _this select 0; _dummy removeEventHandler [ "Hit", _dummy getVariable "HitID" ]; }]]; }forEach dummies; No need for any init.sqf setup as getVaraible numDummies defaults to 0 if the variable has not been defined yet. Share this post Link to post Share on other sites
jshock 513 Posted December 3, 2014 Only slight problem with your code JShock is that you could hit 1 dummy multiple times and complete the task, also you would have to hit 4 dummies to complete as your check is before adding the recent hit.In one of the dummies init field place the code below, just fill out the first array with the name of all your dummies. Just thought this would make it easier than having to paste code in all the dummies.No need for any init.sqf setup as getVaraible numDummies defaults to 0 if the variable has not been defined yet. Thanks Larrow, that is what I was going after in the first place, just didn't put much thought into after the fact :p. Share this post Link to post Share on other sites
panicsferd 25 Posted December 3, 2014 Thanks a lot for the help (I still haven't gotten to test it though, but I will probably test it either later today/tonight or tomorrow. Share this post Link to post Share on other sites