Axelsson 0 Posted April 12, 2007 So, im doing a fairly basic script of having a marker that follows the position of an object (in this case a helicopter). It works great... As long as it is only 1 helicopter, when there are multiple, it only works on the "last" one. This is ofcourse because markers needs uniqe names. So, i need to get the script to name the markers for each of the (currently 3, should not matter) objects that are being "tracked" by the markers. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> // Marker create code _marker = createMarker [_helopos,[_pos select 0, _pos select 1]] So, i think i need to define something else instead of <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _helopos = "chopper" So what do i replace that with? to get a name based on vehicle name or something that is uniqe All help appreciated! Share this post Link to post Share on other sites
shuko 59 Posted April 12, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> call compile format ["_helo%1pos = ""chopper%1""",_i]; call compile format ["_marker%1 = createMarker [_helo%1pos,[_pos select 0, _pos select 1]]",_i]; There might be some error, since I didnt try it out, but hopefully you see the idea. If you set _i to 1, it will result in: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _helo1pos = "chopper1" _marker1 = createMarker [_helo1pos,[_pos select 0, _pos select 1]] Share this post Link to post Share on other sites
kronzky 5 Posted April 12, 2007 So, im doing a fairly basic script of having a marker that follows the position of an object (in this case a helicopter). It works great... As long as it is only 1 helicopter, when there are multiple, it only works on the "last" one. This is ofcourse because markers needs uniqe names. So, i need to get the script to name the markers for each of the (currently 3, should not matter) objects that are being "tracked" by the markers. You're right that every marker needs to have its own, unique name. ArmA doesn't complain if you create two markers with the same name, but after creation they will just be treated as one and the same. Now, the value it returns (the variable in front of the createMarker command) does not matter much. You will always only refer to the marker by it's given name. So you can use that variable over and over again. So, you could do something like this: e.g.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_marker=createMarker["Mchopper1",getPos chopper1]; _marker=createMarker["Mchopper2",getPos chopper2]; _marker=createMarker["Mchopper3",getPos chopper3]; Then, later, you update its position via the "Mchopper_" name:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"Mchopper1" setMarkerPos getPos chopper1; "Mchopper2" setMarkerPos getPos chopper2; "Mchopper3" setMarkerPos getPos chopper3; You could do all this a bit more efficient by using forEach arrays, but for your three units it doesn't really matter much... You can look up how it's done in my tracker script. Also - you're more likely to get help if you use a descriptive post title (e.g. not just "need help", but more along the lines of "How do I create multiple markers" or something like that). Share this post Link to post Share on other sites
Axelsson 0 Posted April 13, 2007 Reading thru it, it looks like its exactly what i need. Im gonna try it out first thing tomorrow. I have the tracker script, and have read thru it. But with my rather limited knowledge of these things, not much made any sense. So, since we are on the topic, Creating markers for players, showing position + Player name. Can that be done as simple or will that require more advanced code? And another stupid follow up question. I do the location of the choppers with something similar to <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _pos = getpos _unit your referal to "Chopper1" in <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _marker=createMarker["Mchopper1",getPos chopper1]; Do i just type "chopper1" in the name field of the editor, or do i need to do something else? Thanks again for your help, and ill be sure to make a more suitable topic next time. cheers Share this post Link to post Share on other sites
kronzky 5 Posted April 13, 2007 The tag that's next to a marker (like in the image below) is done via the command setMarkerText. So, in your example it would be <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"Mchopper1" setMarkerText "chopper one" This is how these labels were created: To name a unit you just enter it into the name field in the editor window (4th field on the right): Share this post Link to post Share on other sites
Axelsson 0 Posted April 13, 2007 Cool stuff, ill get on with right now =) Share this post Link to post Share on other sites