Jump to content
Sign in to follow this  

Recommended Posts

How can I set a marker to follow a vehicle as it moves over the map.

I have a map with three sides (forces), and I want to hide the markers that don't have to do with that side but show the ones that do have something to do with them.

Share this post


Link to post
Share on other sites

You need 2 scripts. 1 that loops and sets the marker to the vehicle position and 1 that checks the side and hides the markers to those not ion the right side.

Share this post


Link to post
Share on other sites

The first 1 should be...

#loop

"MarkerName" setMarkerPos GetPos "VehicleName"

~1

goto "loop"

The second

?side player = west : goto "west"

?side player = east : goto "east"

?side player = resistance : "resistance"

#west

"MarkerName" SetMarkerType "empty"

"MarkerName" SetMarkerType "flag"

exit

#east

"MarkerName" SetMarkerType "empty"

"MarkerName" SetMarkerType "flag"

exit

#resistance

"MarkerName" SetMarkerType "empty"

"MarkerName" SetMarkerType "flag"

exit

Im no scripting guru but thats my best shot. If its off Im sure someone else can help out.

Share this post


Link to post
Share on other sites

you could try this one made by TargetPractice:

edit: i just tested it and it works nice. just make your vehicle and name it something, for example an M1A1 and name it tank1. next make a marker and name it whatever, like empty and name it marker1. now put in the init field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[tank1,"marker1"] exec "vehicletracker.sqs"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

; Script Name : vehicletracker.sqs v1.1

; Script Author : TargetPractice

; (with version 1.1 updates by Blanco - see demo mission briefing for details)

; Script Description :

; This script will associate a marker with a vehicle. As the vehicle moves around the map the

; marker's position on the map will be updated in realtime.

; Script Invokation :

; To execute this script from the mission.sqm file you use the following format :

; [vehicleid,markerid] exec ""vehicletracker.sqs""

; To execute this script from another sqs file you use the following format :

; [vehicleid,markerid] exec "vehicletracker.sqs"

;

; where :

; vehicleid is the value of the text field for the vehicle you want to track

; markerid is the value of the name field (including quotes) for the marker you want

; to use for tracking

;

; Example :

; [myvehicle,""MyMarker""] exec ""vehicletracker.sqs"" (calling from mission.sqm)

; [myvehicle,"MyMarker"] exec "vehicletracker.sqs" (calling from another sqs file)

; Extract the vehicle identifier and the marker identifier from the argument list

_Vehicle1 = _this select 0

_Marker1 = _this select 1

; Marker types to use at differet health levels of the vehicle

_alivemarkertype = "Start"

_warningmarkertype = "Warning"

_killedmarkertype = "Marker"

; How often to update the map. The smaller the number the faster the updating at the

; expense of processor speed. In seconds or fractions of seconds.

_updatetime = 0.1

; Get the initial health of the vehicle

_olddamage = getdamage _Vehicle1

#Alive

; Determine whether the vehicle is alive, hurt, or dead

? (((getdamage _Vehicle1) > _olddamage) and (alive _Vehicle1)) : goto "Warning"

? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdamage _Vehicle1) == 1)) : goto "Killed"

_vehiclepos = getPos _Vehicle1

_vehiclex = _vehiclepos select 0

_vehicley = _vehiclepos select 1

_vehiclez = _vehiclepos select 2

_Marker1 setmarkertype _alivemarkertype

_Marker1 setmarkerpos [_vehiclex, _vehicley, _vehiclez]

~_updatetime

goto "Alive"

#Warning

? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdamage _Vehicle1) == 1)) : goto "Killed"

_vehiclepos = getPos _Vehicle1

_vehiclex = _vehiclepos select 0

_vehicley = _vehiclepos select 1

_vehiclez = _vehiclepos select 2

_Marker1 setmarkertype _warningmarkertype

_Marker1 setmarkerpos [_vehiclex, _vehicley, _vehiclez]

_Marker1 setmarkercolor "ColorRed"

~_updatetime

goto "Warning"

#Killed

_vehiclepos = getPos _Vehicle1

_vehiclex = _vehiclepos select 0

_vehicley = _vehiclepos select 1

_vehiclez = _vehiclepos select 2

_Marker1 setmarkertype _killedmarkertype

_Marker1 setmarkerpos [_vehiclex, _vehicley, _vehiclez]

exit

Share this post


Link to post
Share on other sites

smoke52 - Works just fine, thanks. When the vehicle dies will the marker disappear and then when it respawns, will it return to track it.

Op4 BuhBye - How do I call upon the marker script that hides and shows them.

Share this post


Link to post
Share on other sites

i didnt write the script so do not know. i think if the respawned vehicle has the same name it should work. im sure theres some kind of variable you could use or something, but im not too savvy with scripting yet smile_o.gif

Share this post


Link to post
Share on other sites

Thats cool. I know you said you didn't write the script but it gives me an error when playing the game. I still works and all but keeps giving me this error.

? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdamage |#|_Vehicle1) == 1))

OR

? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((|#|getdamage _Vehicle1) == 1))

Share this post


Link to post
Share on other sites
Thats cool. I know you said you didn't write the script but it gives me an error when playing the game. I still works and all but keeps giving me this error.

? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdamage |#|_Vehicle1) == 1))

OR

? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((|#|getdamage _Vehicle1) == 1))

not sure, but maybe try getDammage? ---double 'm'?

Share this post


Link to post
Share on other sites
Op4 BuhBye - How do I call upon the marker script that hides and shows them.

Got it to work using:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?side player == west : goto "west"

?side player == east : goto "east"

?side player == resistance : goto "resistance"

#west

"SLA Main" setmarkersize [0,0]

"SLA Main" setmarkertext ""

"SLA Mobile" setmarkersize [0,0]

"SLA Mobile" setmarkertext ""

"RACS Main" setmarkersize [0,0]

"RACS Main" setmarkertext ""

"RACS Mobile" setmarkersize [0,0]

"RACS Mobile" setmarkertext ""

exit

#east

"US Main" setmarkersize [0,0]

"US Main" setmarkertext ""

"US Mobile" setmarkersize [0,0]

"US Mobile" setmarkertext ""

"RACS Main" setmarkersize [0,0]

"RACS Main" setmarkertext ""

"RACS Mobile" setmarkersize [0,0]

"RACS Mobile" setmarkertext ""

exit

#resistance

"US Main" setmarkersize [0,0]

"US Main" setmarkertext ""

"US Mobile" setmarkersize [0,0]

"US Mobile" setmarkertext ""

"SLA Main" setmarkersize [0,0]

"SLA Main" setmarkertext ""

"SLA Mobile" setmarkersize [0,0]

"SLA Mobile" setmarkertext ""

exit

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  

×