LifeSnatcher 2 Posted November 15, 2017 I have a function that i need to call when all the opfor is dead in a dynamically created trigger area. This function contains a sleep. I have tried all sorts of diff delays, all caused issues because i was using call in the dynamically created trigger statements. I have tried using a dynamically created trigger to create another trigger but for some reason it just kept creating triggers on load rather than after the opfor were dead. I have tried using spawn in both the int and the dynamically created trigger to fire the function for the first time. In the statement for the dynamically created trigger i used spawn to call the function that inevitably dynamically creates a new trigger. but for some reason like in my previous tests the trigger statement is getting activated on creation. i have been at this Arma 3 scripting for a week now and i keep running in to issues like this. I really could use some help on this. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted November 15, 2017 figured out that repeat activation was set to true, i turned that off which fix part of the problem but the script that is in the dynamically created trigger is still firing on creation of the trigger. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted November 15, 2017 i solved the issue with continuous spawning. the marker i was using to get the pos to spawn the dynamically created trigger was the wrong name, didn't exist. however, now that im using the spawn to call my function other parts of the function are throwing errors about a variables. if anyone can tell me a way to get a delay to work with a call please do, so i can go back to a working version of my code. Share this post Link to post Share on other sites
Tajin 349 Posted November 15, 2017 Always a good idea to actually post the code you want help on. Anyway, why create a trigger via script when you can also do the check directly? _areaUnits = allUnits select { (side _x == east) && {_x inArea _myArea}}; // find all opfor in the area waitUntil { sleep 1; ({ alive _x } count _areaUnits) == 0 }; // wait until every one of them is dead // continue with whatever... Share this post Link to post Share on other sites
LifeSnatcher 2 Posted November 15, 2017 I will def next time post my code. thank you so much for posting that. Im a newb, and you just helped me loads. thank you for taking the time. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted November 15, 2017 any idea how to make this work? having an issue getting the pos in the format that inArea requires. _myarea = [[500,500,0], getMarkerPos "SideMissionMarker", False]; _areaUnits = allUnits select { (side _x == east) && {_x inArea _myarea}}; // find all opfor in the area waitUntil { sleep 1; { alive _x } count _areaUnits == 0 }; // wait until every one of them is de Share this post Link to post Share on other sites
MKD3 27 Posted November 16, 2017 change _myArea to a position. Eg. [100,100,0]. what you have is a position, then a position then a boolean inside an array. Another way to do it would be to set a radius around the marker. private _centre = getMarkerPos "my_marker"; private _radius = 500; private _areaUnits = allunits select {( (side _x == EAST) && ((getpos _x) distance _centre < _radius) )}; waitUntil { sleep 1; { alive _x } count _areaUnits == 0 } Share this post Link to post Share on other sites
pierremgi 4905 Posted November 16, 2017 marker shape can be an ellipse or a rectangle. Then inArea is fine! Other method for polygons: use inPolygon along with drawPolygon or not. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted November 19, 2017 with the code you all provide i have adjusting my mission to accommodate. However im now trying to get this to work in a trigger. Im now looking for a way to detect a % of the enemy still alive in an area using just a trigger. So that when, say %10 of enemy are left alive the trigger will complete a task. ive been looking at this thread and another trying to find a way to not require a script in a .sqf. Its important to know that there can be multiple tasks with enemy active at the same time so i cant do all enemy on map, i have to do it just for the area. If someone knows how to do this with out an external script please share. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted January 3, 2018 ok so i suck at arma scripting. Im having trouble combining these two scripts. if someone with scripting knowledge could help me i would greatly appreciate it. private _centre = getMarkerPos "my_marker"; private _radius = 500; private _areaUnits = allunits select {( (side _x == EAST) && ((getpos _x) distance _centre < _radius) )}; waitUntil { sleep 1; { alive _x } count _areaUnits == 0 } other script ({not alive _x && side _x == east} count thisList) <= ((({alive _x && side _x == east} count thisList))*0.5); Share this post Link to post Share on other sites
pierremgi 4905 Posted January 3, 2018 Could you write your script? It's difficult to help you with parts of codes coming from nowhere. Just an example: thisList could return peanuts at start (even I imagine it's in a trigger's condition), Then 0 = 0 will fire. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted January 3, 2018 3 hours ago, pierremgi said: Could you write your script? It's difficult to help you with parts of codes coming from nowhere. Just an example: thisList could return peanuts at start (even I imagine it's in a trigger's condition), Then 0 = 0 will fire. this is a script im calling as a function. as you can see the parameters at the top. first id like the merge the two segments of code to create a working segement then im happy to put it where ever is best, on a trigger or logic module, or keep it in my script file as a function. Share this post Link to post Share on other sites
LifeSnatcher 2 Posted January 4, 2018 here is my function in its entirity. in its current state its not working. please help params ["_missionabrev", "_taskid"]; _v_taskname = _missionabrev + "EndTask"; _v_markername = _missionabrev + "Marker_1"; //create task SMEndTask = [west,[_v_taskname],["SideMission Update: Kill remaining Hostiles!", "SideMission Update: Kill remaining Hostiles!", "SideMission Update: Kill remaining Hostiles!"],getMarkerPos _v_markername,true,5,true,"attack",True] call BIS_fnc_taskCreate; private _centre = getMarkerPos _v_markername; private _radius = 500; SMareaUnits = allunits select {( (side _x == EAST) && ((getpos _x) distance _centre < _radius) )}; SMTrg_alldead = createTrigger ["EmptyDetector", getMarkerPos _v_markername]; SMTrg_alldead setTriggerArea [500, 500, 0, false]; SMTrg_alldead setTriggerActivation ["NONE", "NOT PRESENT", true]; SMTrg_alldead setTriggerStatements ["({not alive _x && side _x == east} count SMareaUnits) <= ((({alive _x && side _x == east} count SMareaUnits))*0.5);" , "SMEndTask = ['" + _v_taskname + "', 'SUCCEEDED',true] spawn BIS_fnc_taskSetState; ['" + _missionabrev + "', '" + _taskid + "'] call TLS_fnc_spawnEndSMFunc; ", ""]; SMTrg_alldead setTriggerTimeout [1, 1, 1, false] when a task is complete on a mission it calls this function to add kill the rest task. but i only want players to have to kill %80 of the bad guys cuz some get stuck or hide really well. Share this post Link to post Share on other sites