daniel-davies 10 Posted June 5, 2016 Hi, I know there's been topics created about this issue in the past but I'm having issues even after looking at previous solutions. I'm creating three warehouses in my function. The loop loops 3 times and each time it creates two triggers: private _threeWarehouses = []; private _warehouseList = ["marker_warehousesite1","marker_warehousesite2","marker_warehousesite3","marker_warehousesite4","marker_warehousesite5","marker_warehousesite6","marker_warehousesite7","marker_warehousesite8","marker_warehousesite9","marker_warehousesite10","marker_warehousesite11"]; for "_i" from 1 to 3 do { private _trg = _warehouseList call BIS_fnc_selectRandom; _warehouseList = _warehouseList - [_trg]; _threeWarehouses pushBack _trg; _trg setMarkerType "mil_unknown"; _msg = format ["Warehouse location %1", _i]; _trg setMarkerText _msg; _trg setMarkerColor "ColorRED"; _msg2 = format ["markerWarehouseZone%1", _i]; _zoneMarker = createMarker [_msg2, getMarkerPos _trg]; _zoneMarker setMarkerShape "ELLIPSE"; _zoneMarker setMarkerSize [125,125]; _zoneMarker setMarkerColor "ColorOPFOR"; _zoneMarker setMarkerBrush "FDiagonal"; [getMarkerPos(_trg), (ceil (random 2)), 150] call DAN_fnc_spawnRandomInfantry; _buildings = nearestObjects [getMarkerPos _trg, ["Land_i_shed_ind_F"], 100]; //object array _enemies = nearestObjects [getMarkerPos _trg, ["Man"], 150]; _nul = [getMarkerPos _trg,_enemies, 150] execVM "scripts\shk_buildingpos.sqf"; {[_x] joinSilent grpNull; doStop _x; _x setDir random 360; if ((random 1) > 0.5) then { _x setUnitPos "UP"; } else { _x setUnitPos "MIDDLE"; }; } forEach _enemies; [getMarkerPos(_trg), (ceil (random 2)), 60] call DAN_fnc_spawnRandomInfantry; _loopRandom = 1 + (ceil (random 4)); private _flagPos = [(getMarkerPos _trg), 2, 6, 3, 0, 20, 0] call BIS_fnc_findSafePos; _flag = "Flag_AAF_F" createVehicle _flagPos; for "_j" from 1 to _loopRandom do { private _safeLoc = [(getMarkerPos _trg), 4, 60, 3, 0, 20, 0] call BIS_fnc_findSafePos; private _veh = ["I_MRAP_03_F","I_Truck_02_Transport_F","I_Truck_02_Covered_F"] call BIS_fnc_selectRandom; _ambientVehicle = _veh createVehicle _safeLoc; _ambientVehicle setVehicleLock "LOCKED"; _ambientVehicle setDir (random 360); _nearRoads = _safeLoc nearRoads 10; if(count _nearRoads > 0) then { _road = _nearRoads select 0; _roadConnectedTo = roadsConnectedTo _road; _connectedRoad = _roadConnectedTo select 0; _direction = [_road, _connectedRoad] call BIS_fnc_DirTo; }; clearBackpackCargoGlobal _ambientVehicle; clearItemCargoGlobal _ambientVehicle; clearWeaponCargoGlobal _ambientVehicle; clearMagazineCargoGlobal _ambientVehicle; }; _newtrg = createTrigger ["EmptyDetector", getMarkerPos _trg]; _newtrg setTriggerArea [125, 125, 0, false]; _newtrg setTriggerActivation ["WEST", "PRESENT", true]; _newtrg setTriggerStatements ["this", "{if ((side _x) == INDEPENDENT) then { if ((leader (group _x))==_x) then { [group _x, getPos _x, 250] call bis_fnc_taskPatrol; }; }; } forEach thisList;", ""]; _newtrg2 = createTrigger ["EmptyDetector", getMarkerPos _trg]; _newtrg2 setTriggerArea [125, 125, 0, false]; _newtrg2 setTriggerActivation ["GUER", "NOT PRESENT", true]; _newtrg2 setTriggerStatements ["this",(format ["%1 setMarkerColor ""ColorRed""; %2 setMarkerColor ""ColorRed"";",_trg,_zoneMarker]),""]; }; This doesn't work - the marker is correct (I used a hint to check) but nothing happens (the colour is not changed). Could anyone help? Share this post Link to post Share on other sites
kylania 568 Posted June 5, 2016 There's a few new commands that replace functions you might be interested in specifically selectRandom and getRelDir. For the trigger maybe try: _newtrg2Statements = format ["'%1' setMarkerColor 'ColorRed'; '%2' setMarkerColor 'ColorRed';",_trg,_zoneMarker]; _newtrg2 setTriggerStatements ["this",_newtrg2Statements,""]; Share this post Link to post Share on other sites