Jump to content
Sign in to follow this  
anthonyfromtheuk

Marker showing the direction the unit is facing or moving in real time

Recommended Posts

How do I make marker showing the direction a unit is facing in real time. I can make a marker to show where the unit is with the code below. but have no idea how to show the direction it is facing, anybody help please?

[] spawn {while{not isnull UNIT} do {"MARKER" setmarkerpos getpos UNIT; sleep 0.1;};};

Share this post


Link to post
Share on other sites

This should work:

while {!isnull UNIT} do {
"MARKER" setmarkerpos (position UNIT); 
"MARKER" setmarkerDir (getDir UNIT);
sleep 0.1;
};

Share this post


Link to post
Share on other sites

Thats works perfectly, thank you sir! but you can only have one instance of it, why does it only show one unit

while {!isnull enemy1} do {

"MARKER" setmarkerpos (position enemy1);

"MARKER" setmarkerDir (getDir enemy1);

sleep 0.1;

};

while {!isnull enemy2} do {

"MARKER2" setmarkerpos (position enemy2);

"MARKER2" setmarkerDir (getDir enemy2);

sleep 0.1;

};

Edited by Anthonyfromtheuk

Share this post


Link to post
Share on other sites

Because if you write it that way, the second marker will only show up once the first enemy is dead, as the script will be stuck in the first loop until then.

try this:

[this,"MARKER"] spawn {
while{not isnull (_this select 0)} do {(_this select 1) setmarkerpos getpos (_this select 0); sleep 0.1;};
}; 

put it in the init of each unit you want to track, just modify the "MARKER" name.

Or if you need it more often you could put it all in one script that would also handle the creation/deletion of those markers. Mine is just a simple example.

You can also do some searching, I'm sure there are several full functional tracking-scripts available that you could use.

Share this post


Link to post
Share on other sites
Because if you write it that way, the second marker will only show up once the first enemy is dead, as the script will be stuck in the first loop until then.

try this:

[this,"MARKER"] spawn {
while{not isnull (_this select 0)} do {(_this select 1) setmarkerpos getpos (_this select 0); sleep 0.1;};
}; 

put it in the init of each unit you want to track, just modify the "MARKER" name.

Or if you need it more often you could put it all in one script that would also handle the creation/deletion of those markers. Mine is just a simple example.

You can also do some searching, I'm sure there are several full functional tracking-scripts available that you could use.

That didn't work, says "type script, expected nothing" when I try put it in to unit init. Does that include the direction unit is facing it doesn't look like it to me. but I don't have a good understanding if any of php.

Share this post


Link to post
Share on other sites

It was just a rough example regarding the problem that only one marker was shown.

The point is that you'll have to run a separate instance of the script for each unit.

Here, try this for example:

http://www.armaholic.com/page.php?id=21365

Or look at this topic:

http://forums.bistudio.com/showthread.php?80967-Attaching-moveable-map-markers-to-units

Like I said: Plenty scripts for that aleady exist, you'll just have to do some searches.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×