CorporateHammer 10 Posted January 22, 2015 I'm creating a co-op mission where you have to clear all OPFOR units from an area. The issue I'm having is when there are only a couple units left finding them can be quite a pain so to prevent the player from running around I would like to possibly attach mobile markers to the last 4 OPFOR units. I'm thinking of creating a trigger with (east countSide thislist <= 4) in the condition and calling a script that attaches mobile markers to the remaining units. I know how to attach marker to units like while{not isnull p1} do {"respawn_west" setmarkerpos getpos p1; sleep 0.5;}; my issue is I am spawning OPFOR AI that have no unit name. Is there a way to give the last 4 units a name in order to use the code to attach markers ? Or is there a different way I can go about preventing the player from searching for the last few AI guys ? Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted January 22, 2015 This is untested, so test if it works! Firstly, create a global array saving four markers: [color=#FF8040]opforMarkers [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]for[/b][/color] [color=#7A7A7A]"_i"[/color] [color=#191970][b]from[/b][/color] [color=#FF0000]0[/color] [color=#191970][b]to[/b][/color] [color=#FF0000]3[/color] [color=#191970][b]do[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_marker[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createMarker[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#191970][b]format[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"markerOpfor_%1"[/color][color=#8B3E2F][b],[/b][/color] [color=#1874CD]_i[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b],[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_marker[/color] [color=#191970][b]setMarkerColor[/b][/color] [color=#7A7A7A]"ColorRed"[/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_marker[/color] [color=#191970][b]setMarkerShape[/b][/color] [color=#7A7A7A]"ICON"[/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_marker[/color] [color=#191970][b]setMarkerText[/b][/color] [color=#7A7A7A]"OPFOR Unit"[/color][color=#8B3E2F][b];[/b][/color] opforMarkers [color=#191970][b]pushBack[/b][/color] [color=#1874CD]_marker[/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color] The markers will be in the very bottom left corner of the map. You may put them even outside the make so they are invisible. Then, put this in your trigger condition, yes the condition, because that way, the marker positions will be updated every 0.5 seconds. [color=#FF8040][color=#000000]east[/color] [color=#191970][b]countSide[/b][/color] thislist [color=#8B3E2F][b]<[/b][/color][color=#8B3E2F][b]=[/b][/color] [color=#FF0000]4[/color] [color=#8B3E2F][b]&[/b][/color][color=#8B3E2F][b]&[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_opforCount[/color] [color=#8B3E2F][b]=[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]if[/b][/color][color=#8B3E2F][b]([/b][/color][color=#191970][b]side[/b][/color] [color=#000000]_x[/color] [color=#191970][b]isEqualTo[/b][/color] [color=#000000]opfor[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_marker[/color] [color=#8B3E2F][b]=[/b][/color] opforMarkers [color=#191970][b]select[/b][/color] [color=#1874CD]_opforCount[/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_marker[/color] [color=#191970][b]setMarkerPos[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#191970][b]getPosATL[/b][/color] [color=#000000]_x[/color][color=#8B3E2F][b])[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_opforCount[/color] [color=#8B3E2F][b]=[/b][/color] [color=#1874CD]_opforCount[/color] [color=#8B3E2F][b]+[/b][/color] [color=#FF0000]1[/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color] [color=#191970][b]forEach[/b][/color] thisList[color=#8B3E2F][b];[/b][/color] opforMarkers [color=#191970][b]resize[/b][/color] [color=#1874CD]_opforCount[/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. Share this post Link to post Share on other sites