dalia 13 Posted April 30, 2011 Hi, So i would like when player take ennemi radar, they can use it. So when they use on map at 400 m around the radar they can see on the mpa all ennemi icon. I tried with setgroupicon but only allied appaear on map. Thanks Share this post Link to post Share on other sites
demonized 20 Posted April 30, 2011 you can create a marker for every enemy using distance, side, isKindof createMarker and using various colors, symbols etc. You will see more marker options on the wiki page. and then you can run a while loop to track the unit with the marker, using markername setMarkerPos getPos objectname; as long as the objektname is within the scan distance of the radar. Share this post Link to post Share on other sites
dalia 13 Posted May 1, 2011 no, ennemy spawn, so i cannot give name at units, all units in a 400 m around radar must be visible on the map. I cannot create marker for all units, there is 300 units who come during game. Share this post Link to post Share on other sites
demonized 20 Posted May 1, 2011 Allunits will return all units and dont need any name. {if ((_x distance radar) < 400) then {createmarker.}} foreach allUnits; Share this post Link to post Share on other sites
dalia 13 Posted May 1, 2011 ahhh ok :), thanks, i dont know scripting so i didn't understand, thanks i will try :) Share this post Link to post Share on other sites
demonized 20 Posted May 1, 2011 this will work even better than allUnits: http://community.bistudio.com/wiki/nearestObjects Share this post Link to post Share on other sites
dalia 13 Posted May 1, 2011 ok so i have this you are ok? {if ((_x distance aa) < 400) then {createmarker["Marker1", position _x]}} foreach allUnits; marker1 setMarkerShape "ICON"; "marker1" setMarkerType "DOT"; marker1 setMarkerColor "ColorOrange"; soon, i have one marker :), but red. And the marker (i dont know if its the random or not) choose the switchteam guy. Share this post Link to post Share on other sites
demonized 20 Posted May 1, 2011 (edited) here is a indebt example working, i have commented the various parts so you can see what does what, also you can delete or change what extra details you want etc.. save as radar_markers.sqf /* radar markers by range and side. by Demonized execute with in a trigger or a script: _null = [radarobject,[sidesToDetect],range] execVM "radar_markers.sqf"; _null = [radar,[east],400] execVM "radar_markers.sqf"; _null = [radar,[east,west,resistance],1500] execVM "radar_markers.sqf"; */ _radar = _this select 0; _sides = _this select 1; _range = _this select 2; radar_specific_detected = []; radar_specific_nr = 0; while {(getDammage _radar) < 1} do { _near = nearestObjects [(getPos _radar), ["AllVehicles"], _range]; { // if side of detected unit is correct and object is not in the already detected array and object is not dead then proceed to create marker else do nothing. if ((side _x) in _sides AND (!((vehicle _x) in radar_specific_detected)) AND alive (vehicle _x)) then { // add object detected to the array so we dont create doubles later on. radar_specific_detected = radar_specific_detected + [(vehicle _x)]; // create a unique name for the new marker. _name = format["radar_markers_%1",radar_specific_nr]; radar_specific_nr = (radar_specific_nr + 1); // set color to match side of unit. _color = "ColorBlue"; // this is default color for west units. if ((side _x) == east) then {_color = "ColorRed"}; if ((side _x) == resistance) then {_color = "ColorOrange"}; if ((side _x) == civilian) then {_color = "ColorBlack"}; // create the marker. _marker = createMarker [_name,(getPos (vehicle _x))]; _marker setMarkerShape "ICON"; _marker setMarkerColor _color; // if its a car change markertype to car. if ((vehicle _x) isKindOf "Car") then { _marker setMarkerType "Car"; }; // if its a tank change markertype to tank. if ((vehicle _x) isKindOf "Tank") then { _marker setMarkerType "Tank"; }; // if its a Air vehicle change markertype to Air. if ((vehicle _x) isKindOf "Air") then { _marker setMarkerType "Air"; }; // if its a Man change markertype to Man. if ((vehicle _x) isKindOf "Man") then { _marker setMarkerType "Man"; }; // here we will launch a seperate script to track the unit while its in range. _track = [(vehicle _x),_marker,_radar,_range] spawn { _object = _this select 0; _marker = _this select 1; _radar = _this select 2; _range = _this select 3; // while radar is not dead, and object is not dead, and object is within detect range specidied. while {(getDammage _radar) < 1 AND (getDammage _object) < 1 AND (_object distance _radar) <= _range} do { // set the marker to the position of the object. _marker setMarkerPos (getPos _object); sleep 1; }; // when radar or object is dead or object is out of range we delete the marker and remove the object from the detected array. deleteMarker _marker; radar_specific_detected = radar_specific_detected - [_object]; }; }; } foreach _near; sleep 5; // update new targets every 5 seconds. }; Edited May 1, 2011 by Demonized Share this post Link to post Share on other sites
dalia 13 Posted May 1, 2011 Ok it's done, thanks for your help ---------- Post added at 06:00 AM ---------- Previous post was at 05:07 AM ---------- So i tried to stop after 5 seconds, i explain, the player ask at the radar if they control it to send on map the ennemi movement, so after 20 seconds the markers disapear, so i tried to add, but don't stop. So can you say me what i must write, i don't find after my test. Thanks sleep 3;_null = [radar,[east],400] execVM "radar_markers.sqf"; hint 'gg'; exit; }; Share this post Link to post Share on other sites
demonized 20 Posted May 1, 2011 this will only run once and you can set timeToDelete to how many seconds you want in top of script. /* radar markers by range and side. by Demonized execute with in a trigger or a script: _null = [radarobject,[sidesToDetect],range] execVM "radar_markers.sqf"; _null = [radar,[east],400] execVM "radar_markers.sqf"; _null = [radar,[east,west,resistance],1500] execVM "radar_markers.sqf"; */ _radar = _this select 0; _sides = _this select 1; _range = _this select 2; _timeToDelete = 20; // x amount seconds markers will be shown, then script will exit. radar_specific_detected = []; radar_specific_nr = 0; _near = nearestObjects [(getPos _radar), ["AllVehicles"], _range]; { // if side of detected unit is correct and object is not in the already detected array and object is not dead then proceed to create marker else do nothing. if ((side _x) in _sides AND (!((vehicle _x) in radar_specific_detected)) AND alive (vehicle _x)) then { // add object detected to the array so we dont create doubles later on. radar_specific_detected = radar_specific_detected + [(vehicle _x)]; // create a unique name for the new marker. _name = format["radar_markers_%1",radar_specific_nr]; radar_specific_nr = (radar_specific_nr + 1); // set color to match side of unit. _color = "ColorBlue"; // this is default color for west units. if ((side _x) == east) then {_color = "ColorRed"}; if ((side _x) == resistance) then {_color = "ColorOrange"}; if ((side _x) == civilian) then {_color = "ColorBlack"}; // create the marker. _marker = createMarker [_name,(getPos (vehicle _x))]; _marker setMarkerShape "ICON"; _marker setMarkerColor _color; // if its a car change markertype to car. if ((vehicle _x) isKindOf "Car") then { _marker setMarkerType "Car"; }; // if its a tank change markertype to tank. if ((vehicle _x) isKindOf "Tank") then { _marker setMarkerType "Tank"; }; // if its a Air vehicle change markertype to Air. if ((vehicle _x) isKindOf "Air") then { _marker setMarkerType "Air"; }; // if its a Man change markertype to Man. if ((vehicle _x) isKindOf "Man") then { _marker setMarkerType "Man"; }; // here we will launch a seperate script to track the unit while its in range. _track = [(vehicle _x),_marker,_radar,_range,_timeToDelete] spawn { _object = _this select 0; _marker = _this select 1; _radar = _this select 2; _range = _this select 3; _timeOut = _this select 4; _timer = _time; // while radar is not dead, and object is not dead, and object is within detect range specidied. while {(getDammage _radar) < 1 AND (getDammage _object) < 1 AND (_object distance _radar) <= _range AND (_timer + _timeOut) > _time} do { // set the marker to the position of the object. _marker setMarkerPos (getPos _object); sleep 1; }; // when radar or object is dead or object is out of range we delete the marker and remove the object from the detected array. deleteMarker _marker; radar_specific_detected = radar_specific_detected - [_object]; }; }; } foreach _near; Share this post Link to post Share on other sites
dalia 13 Posted May 1, 2011 thanks :), but doesn't work, the markers appear 1 second and after hide. Share this post Link to post Share on other sites
dalia 13 Posted May 1, 2011 i found the trouble : _timer = 0; // while radar is not dead, and object is not dead, and object is within detect range specidied. while {(getDammage _radar) < 1 AND (getDammage _object) < 1 AND (_object distance _radar) <= _range AND (_timer < _timeOut) } do { // set the marker to the position of the object. _marker setMarkerPos (getPos _object); _timer = _timer + 1; sleep 1; }; Thanks for your help it's perfect. Share this post Link to post Share on other sites