BittleRyan 10 Posted May 29, 2010 How do i attach a marker to an object? Lets say i named the car tank1. Where ever that car went the marker would appear on top of it on the map. Thank you. Share this post Link to post Share on other sites
Militant1006 11 Posted May 29, 2010 Would this attachTo [tank1, [0,0,0]]; work? or does it only attach physical objects Share this post Link to post Share on other sites
Citizen Society RPG 11 Posted May 29, 2010 Would work? or does it only attach physical objects This will only attach physical objects to the named unit Share this post Link to post Share on other sites
Nemorz 11 Posted May 29, 2010 http://community.bistudio.com/wiki/setMarkerPos "MarkerName" setMarkerPos getPos ObjectName Be sure the Marker is quotes, while the Object is not. 1 Share this post Link to post Share on other sites
Citizen Society RPG 11 Posted May 29, 2010 http://community.bistudio.com/wiki/setMarkerPos"MarkerName" setMarkerPos getPos ObjectName Be sure the Marker is quotes, while the Object is not. this is local only, does not work on a server. Share this post Link to post Share on other sites
Bon 12 Posted May 29, 2010 this is local only, does not work on a server. Of course it sets it globally. There is an extra command to do that only locally: setMarkerPosLocal. What it does not do is to send the actual marker positions to a jip client (join in progress). If you want a marker to be attached to an object the whole mission time, just put the following code into your init.sqf: if(isServer) then{ [] spawn { While{not isNull <unit>; sleep 0.5} do{ "Markername" setMarkerPos getPos <unit>; }; }; }; The server machine now re-sets the markerposition to the object's position every 0.5 seconds, though that happens for jip players as well. 1 Share this post Link to post Share on other sites
Citizen Society RPG 11 Posted May 29, 2010 Of course it sets it globally. There is an extra command to do that only locally: setMarkerPosLocal.What it does not do is to send the actual marker positions to a jip client (join in progress). If you want a marker to be attached to an object the whole mission time, just put the following code into your init.sqf: if(isServer) then{ [] spawn { While{not isNull <unit>; sleep 0.5} do{ "Markername" setMarkerPos getPos <unit>; }; }; }; The server machine now re-sets the markerposition to the object's position every 0.5 seconds, though that happens for jip players as well. Im sure this will work.. I find that this code is usefull for making the marker follow the vehicle and/or object from the start to the finish of the mission. while {true} do { "carmarker" setmarkerpos (getpos car); sleep 3; }; 1 Share this post Link to post Share on other sites
galzohar 31 Posted May 29, 2010 You may want to create and update the marker locally on each machine rather than have the server do it and broadcast it constantly, causing unneeded network traffic. Though then in some cases when the object is very far away from the player the server might not update the object's position and then the client will not update the marker position (well, it'll update but it'll place it on the current known object position which is not up to date). Still, with the local method the marker will always be where the client sees the object. Share this post Link to post Share on other sites
SpiritedMachine 10 Posted July 10, 2010 while {not isnull Unit1} do {"mkr_unit1" setmarkerpos getpos Unit1; sleep .5;}; If I place this code in my init.sqf, it works fine, but nothing after this code works. I assume this is because it's a while loop, and it never exits the loop, tying up the game. How could I have this working, but still be able to process other code? Share this post Link to post Share on other sites
shuko 59 Posted July 10, 2010 [] spawn { while {not isnull Unit1} do { "mkr_unit1" setmarkerpos getpos Unit1; sleep 0.5; }; }; Share this post Link to post Share on other sites
SpiritedMachine 10 Posted July 10, 2010 Thanks very much, both of you. Share this post Link to post Share on other sites
KC Grimes 79 Posted July 19, 2010 So, let's say I want a marker called 'HQ Element' to be attached to the leader of the HQ squad. The leader is s1, the 2nd in command is s2, and 3rd in command is s3. The marker normally attaches to s1. If s1 dies, I want the marker to be on s2. If s1 and s2 die, I want it to be on s3. This is what I tried: [] spawn { if (alive s1) then while {not isnull s1} do { "mkr_s1" setmarkerpos getpos s1; sleep 0.5; }; else if (alive s2) then while {not isnull s2} do { "mkr_s1" setmarkerpos getpos s3; sleep 0.5; }; else if (alive s3) then while {not isnull s2} do { "mkr_s1" setmarkerpos getpos s3; sleep 0.5; }; }; But the marker didn't even attach to s1 at round start. Can anyone help me with this? Share this post Link to post Share on other sites
kylania 568 Posted July 30, 2010 [] spawn { while {not isnull leader hqTeam} do { "mkr_unit1" setmarkerpos getpos leader hqTeam; sleep 0.5; }; }; Share this post Link to post Share on other sites
A-SUICIDAL 11 Posted August 27, 2010 I have a plane circling around at height 5000, a trigger connected to each player that detects if the player is alive and moves them in cargo, once objective 1 is captured the triggers connected to each player are all deleted and the player then respawn at the newly captured objective 1 area and the marker called "US Current" then moves from being attached to the plane to the newly captured area. The problem is, I can't get the marker to attach to the plane. Right now the marker just sits where the plane first starts, but once objective 1 is captured the marker does move to the new location. If my plane is called "plane1" and the marker is called "respawn_west", how would I script this to stay attached to the plane? I tried some of the examples from this thread which I added to my init.sqs file but I just couldn't get it to work in my coop mission. I tried: "respawn_west" setmarkerpos getpos helo1; I also tried: [] spawn { while {not isnull helo1} do { "respawn_west" setmarkerpos getpos helo1; sleep 0.5; }; }; What am I doing wrong? Share this post Link to post Share on other sites
A-SUICIDAL 11 Posted August 27, 2010 nobody wants to help me lately :( I couldn't get the above to work at all. For some reason, anything with a sleep command in my scripts always gives me errors. Makes no sense. I copy the script exactly as shown and use it in my mission and always the sleep thing gives me errors. I remember how I made a camera scene for one of my missions a while back, then I thought I would try scripting the attached marker another way. #loop "respawn_west" setmarkerpos getpos plane1; ~0.5 goto "loop"; ...and it worked. But is this going to cause the server to lag when it keeps looping? Share this post Link to post Share on other sites
Przemek_kondor 13 Posted August 27, 2010 Some time ago I've created script (some small system for tracking units using markers): http://dev-heaven.net/attachments/download/5987/kndr_unit_markers.sqf For running just: //this will start system of tracking: call compile preprocessFile "kndr_unit_markers.sqf"; // and here are examples of adding units to the tracking system: [player] call kndr_assignMarker; [car2, "Dot"] call kndr_assignMarker; [car3, "Air", "ColorRed"] call kndr_assignMarker; Passing marker class is optional (if not passed, then script use proper marker class for given object - "car", "air" etc) Other optional parameters are: sizeX, sizeY, text If unit died / dammage == 1 then marker is removed automatically - but you can also specify function which decides when remove marker - just overwrite kndr_needsRemove function Share this post Link to post Share on other sites
KC Grimes 79 Posted August 29, 2010 Can't seem to ever find the answer to this question... but how do I define a group as say, hqTeam? Share this post Link to post Share on other sites
kylania 568 Posted August 29, 2010 ;1735076']Can't seem to ever find the answer to this question... but how do I define a group as say' date=' hqTeam?[/quote']Using hqTeam = group this. :) Share this post Link to post Share on other sites
KC Grimes 79 Posted August 29, 2010 You and your website of readily amazing goodness. Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 11, 2015 This is not working. It says _veh not defined: What if I spawn units through script?: // Spawn enemy officer _groupHVT = createGroup west; _veh = this select 0; _veh = _groupHVT createUnit ["B_officer_F", getMarkerPos "side_area", [], 0, "NONE"]; _veh setRank "COLONEL"; _veh setSkill 1; _groupHVT setBehaviour "SAFE"; [_groupHVT, getMarkerPos "side_area", 100] call BIS_fnc_taskPatrol; // add marker on target _marker = createMarker ["hvt", _sidepos]; _markerHVT setMarkerShape "ICON"; _markerHVT setMarkerType "b_support"; [] spawn { while {not isnull _veh} do { "hvt" setmarkerpos getpos _veh; sleep 0.5; }; }; Share this post Link to post Share on other sites
opusfmspol 280 Posted November 11, 2015 This is not working. It sayd _veh not defined: What if I spawn units through script? When spawning by script, use _this. _veh = _this select 0; And if it still comes back with an error, put this line above it: diag_log format ["%1",_this]; Then run once and check the .rpt log to see what variables are being passed into the script. Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 12, 2015 When spawning by script, use _this. _veh = _this select 0; And if it still comes back with an error, put this line above it: diag_log format ["%1",_this]; Then run once and check the .rpt log to see what variables are being passed into the script. Thank you very much. So this means that now my code should look like this: // Spawn enemy officer _groupHVT = createGroup west; diag_log format ["%1",_this]; _veh = this select 0; _veh = _groupHVT createUnit ["B_officer_F", getMarkerPos "side_area", [], 0, "NONE"]; _veh setRank "COLONEL"; _veh setSkill 1; _groupHVT setBehaviour "SAFE"; [_groupHVT, getMarkerPos "side_area", 100] call BIS_fnc_taskPatrol; // add marker on target _marker = createMarker ["hvt", _sidepos]; _markerHVT setMarkerShape "ICON"; _markerHVT setMarkerType "b_support"; [] spawn { while {not isnull _this} do { "hvt" setmarkerpos getpos _this; sleep 0.5; }; }; Share this post Link to post Share on other sites
opusfmspol 280 Posted November 12, 2015 No, what I am saying is that you have a global "this" instead of a local "_this" in line 3, where it has: // Spawn enemy officer _groupHVT = createGroup west; _veh = this select 0; // <------- here!!!! _veh = _groupHVT createUnit ["B_officer_F", getMarkerPos "side_area", [], 0, "NONE"]; The global "this" is used in editor to reference the editor object; The local "_this" is used in scripts to reference whatever has been passed into the script. So when your script encounters "_veh = this select 0", it has no global "this" to define it with. But it looks like the line is not needed, since you are using createUnit to define _veh in the very next line. Try removing your line 3 to see if the error goes away: // Spawn enemy officer _groupHVT = createGroup west; _veh = _groupHVT createUnit ["B_officer_F", getMarkerPos "side_area", [], 0, "NONE"]; _veh setRank "COLONEL"; _veh setSkill 1; _groupHVT setBehaviour "SAFE"; [_groupHVT, getMarkerPos "side_area", 100] call BIS_fnc_taskPatrol; // add marker on target _marker = createMarker ["hvt", _sidepos]; _markerHVT setMarkerShape "ICON"; _markerHVT setMarkerType "b_support"; [] spawn { while {not isnull _veh} do { "hvt" setmarkerpos getpos _veh; sleep 0.5; }; }; 1 Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 13, 2015 No, what I am saying is that you have a global "this" instead of a local "_this" in line 3, where it has: // Spawn enemy officer _groupHVT = createGroup west; _veh = this select 0; // <------- here!!!! _veh = _groupHVT createUnit ["B_officer_F", getMarkerPos "side_area", [], 0, "NONE"]; The global "this" is used in editor to reference the editor object; The local "_this" is used in scripts to reference whatever has been passed into the script. So when your script encounters "_veh = this select 0", it has no global "this" to define it with. But it looks like the line is not needed, since you are using createUnit to define _veh in the very next line. Try removing your line 3 to see if the error goes away: // Spawn enemy officer _groupHVT = createGroup west; _veh = _groupHVT createUnit ["B_officer_F", getMarkerPos "side_area", [], 0, "NONE"]; _veh setRank "COLONEL"; _veh setSkill 1; _groupHVT setBehaviour "SAFE"; [_groupHVT, getMarkerPos "side_area", 100] call BIS_fnc_taskPatrol; // add marker on target _marker = createMarker ["hvt", _sidepos]; _markerHVT setMarkerShape "ICON"; _markerHVT setMarkerType "b_support"; [] spawn { while {not isnull _veh} do { "hvt" setmarkerpos getpos _veh; sleep 0.5; }; }; Thank you man :) Share this post Link to post Share on other sites