Jump to content
Sign in to follow this  
sweden fidde

help!! Marker Follow Player

Recommended Posts

Hi i am working on a big mission here. I am a pilot how is shoot down behind enemys lines and the enemy ai will try to find me and kill me.,

In the mission am i using the UPS script for the enemys insted of waypoints.

my plan is like this.

i have a marker that are following me and it is like 500m X 500m big and its called for exampel playermarker.

can i make the marker to follow me and also use it for the ups script so the enemy ai are always patrol the area that i am in.

So the enemy are near me but they dont know my exactly positon

plzz help me i think it would be aswome if it works plzz you can send me a demo mission alsoe if you can:) i am a litel noob on this things so help me.) ARMA ROCKS

Share this post


Link to post
Share on other sites

#top

"MarkerName" setMarkerPos getpos UnitName

~40 //Seconds it refreshes, best to have some type of wait otherwise itll continually loop

goto "top"

copy/paste that into marker.sqs

then add a Civilian well out of harms way (or just add this allowDamage false in his init line so he can't die) and this exec "marker.sqs"

That's a very simple solution I had working. If you die it stops working but for the purpose of your mission, it should suffice

Share this post


Link to post
Share on other sites

Hi thx for the quick respond Nemorz;) But it dident work for me at al .. the game was shout down when i run the script. i am using Arma 2 also if that mathers. so plz help me i still need help

but thx any way from Fredrik Swe

HELP:)

Share this post


Link to post
Share on other sites

This will work:

while {alive player} do
{
"playermarker" setMarkerPos (getPos player);
sleep 5;
};

Share this post


Link to post
Share on other sites

JW's version is better, that should work well ;)

I think I'll rob that also. *YOINK*

Share this post


Link to post
Share on other sites

Hi, I have problems with this same matter and no idea how to get it work...

marker.sqf:

while {alive convoy1} do
{
"Convoy" setMarkerPos (getPos convoy1);
sleep 5;
};

convoy1 is enemy vehicle, Convoy is marker

Where and how should I put 'execVM "marker.sqf";' ? I've tried init.sqf, Civilian's init -field, trigger's, but can't get it to work.. :/

Share this post


Link to post
Share on other sites

Try just putting the code below into your init.sqf:

if (isServer) then {
    waitUntil {!(isNil convoy1)};
    while {alive convoy1} do {
         "Convoy" setMarkerPos (getPos convoy1);
         sleep 5;
    };
};

That might be wrong - haven't scripted in ARMA for quite a while. :S

Share this post


Link to post
Share on other sites
Try just putting the code below into your init.sqf:

if (isServer) then {
    waitUntil {!(isNil convoy1)};
    while {alive convoy1} do {
         "Convoy" setMarkerPos (getPos convoy1);
         sleep 5;
    };
};

That might be wrong - haven't scripted in ARMA for quite a while. :S

Didn't work either.. I'm starting to think if there's some stupid fail in my files, so here's the whole init.sqf:

execVM "briefing.sqf";
execVM "respawnOnLeader.sqf";

if (isServer) then {
    waitUntil {!(isNil convoy1)};
    while {alive convoy1} do {
         "Convoy" setMarkerPos (getPos convoy1);
         sleep 5;
    };
};

if(true)exitWith{};

Does it seem right?

Btw, the Convoy -marker is also in briefing.sqf as tskobj_1's marker, if it matters anything?

And if I put that code, which was on my first post, straight to f.ex civilian's init -field, the game freezes. (Keeps just looping?)

Share this post


Link to post
Share on other sites

@Sweden_fidde

[] spawn {

while {not isnull pilot} do { "mkr_pilotpos" setmarkerpos getpos pilot; sleep 0.5; };

};

Try that out where the player name is 'pilot' and the marker name is 'mkr_pilotpos'. Change the sleep time to whatever you want.

I know this will make the marker follow you, but I do not know how UPS will handle this.

@SpunFIN

What do you mean by those didn't work? I am just guessing that it is only moving the marker a single time or is not allowing anything else below it in the file to execute. Try this:

[] spawn {

while {alive convoy1} do {

while {not isnull pilot} do { "mkr_pilotpos" setmarkerpos getpos pilot; sleep 0.5; };

};

};

If that doesn't work, try switching the alive convoy and the spawn line (Switch line 1 with line 2). I haven't tested any of this, but it ought to work.

Edited by Grimes [3rd ID]

Share this post


Link to post
Share on other sites

@Grimes [3rd ID]

;1687371']What do you mean by those didn't work? I am just guessing that it is only moving the marker a single time or is not allowing anything else below it in the file to execute.

The marker doesn't move at all.. :/

;1687371']

If that doesn't work' date=' try switching the alive convoy and the spawn line (Switch line 1 with line 2). I haven't tested any of this, but it ought to work.[/quote']

I tried your code, still nothing.. Switching those lines also didn't help, though it made a huge lag. :F

What am I doing wrong? :D :F :S

Could someone send a short example mission with a marker following a unit?

Share this post


Link to post
Share on other sites

Simplest possible implementation:

1) Place a unit, place a waypoint (just to check)

2) Place a marker called "marker1"

3) Add this into the units init: nul = [this,"marker1",1] execVM "mark_unit.sqf";

4) Create an sqf called "mark_unit.sqf" in the mission folder:

_unit = _this select 0;
_marker = _this select 1;
_delay = _this select 2;

while { alive _unit } do { _marker setMarkerPos getPos _unit; sleep _delay; };

If you cant get it to work, you're doing it wrong!

Share this post


Link to post
Share on other sites
@Grimes [3rd ID]

The marker doesn't move at all.. :/

I tried your code, still nothing.. Switching those lines also didn't help, though it made a huge lag. :F

What am I doing wrong? :D :F :S

Could someone send a short example mission with a marker following a unit?

Whoops, sorry man, I got confused between whos script was whos.

[] spawn {

while {alive convoy1} do {

while {not isnull convoy1} do { "mkr_convoy1pos" setmarkerpos getpos convoy1; sleep 0.5; };

};

};

Try that, assuming convoy1 is the name of a vehicle. If that doesn't work, remove the while alive convoy line to make sure you named everything right and then work backwards, maybe using a trigger instead. That script goes in the init by the way.

Share this post


Link to post
Share on other sites

@Murklor & Grimes [3rd ID]

;1687466']Whoops' date=' sorry man, I got confused between whos script was whos.

Try that, assuming convoy1 is the name of a vehicle. If that doesn't work, remove the while alive convoy line to make sure you named everything right and then work backwards, maybe using a trigger instead. That script goes in the init by the way.[/quote']

Still didn't work.. :F

Simplest possible implementation:

1) Place a unit, place a waypoint (just to check)

2) Place a marker called "marker1"

3) Add this into the units init: nul = [this,"marker1",1] execVM "mark_unit.sqf";

4) Create an sqf called "mark_unit.sqf" in the mission folder:

_unit = _this select 0;
_marker = _this select 1;
_delay = _this select 2;
while { alive _unit } do { _marker setMarkerPos getPos _unit; sleep _delay; };

If you cant get it to work, you're doing it wrong!

With this method I got it to work... FINALLY \o/ Thanks!

Next problem is: how do I make briefing.sqf to follow the same marker?

tskobj_1 setSimpleTaskDestination (getMarkerPos "Convoy");

is the basic line in it, but how to execute mark_unit.sqf there?

Share this post


Link to post
Share on other sites
;1687561']http://forums.bistudio.com/showthread.php?t=99669&

Not sure why the method I suggested isn't working for you' date=' works fine for me.

#include might be your best bet, but I'm not sure. Assuming execVM doesn't work there.[/quote']

Gotta try tomorrow again when I'm sober (hopefully)..

Maybe I just make this mission tonight with this Murklor's method, f.ex adding marker for every convoys' unit and changing the tskobj_x -marker with triggers close to convoy's waypoints.

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  

×