satexas69 0 Posted October 1, 2007 I have a mission where I have a vehicle named "MCU" that has a marker that follows it on the map. I do this because it's my "mobile respawn point", and it works GREAT. HOWEVER... when you respawn, you respawn "under" my MCU (which is a URAL)... which is annoying. How can I adjust this script to make the marker move back about 5-10 yards off the rear of my MCU/Marker? NOTE: My "MCU" never dies (invincible), so only the "alive" part comes into play in the script below. <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 : ; ; 1. Create a marker named after the vehicle you want to track. The marker style and color doesn't matter ; because the script is going to change it anyway. ; In my example, the NAME of my unit is "MCU" so I call my marker "MCU" ; ; 2. In the init.sqs file, put this line ; [MCU,"MCU"] exec "scripts\vehicletracker.sqs" ; 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 = "Flag1" ;_warningmarkertype = "Warning" _warningmarkertype = "Flag1" _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 = getdammage _Vehicle1 #Alive ; Determine whether the vehicle is alive, hurt, or dead ? (((getdammage _Vehicle1) > _olddamage) and (alive _Vehicle1)) : goto "Warning" ? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdammage _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 ; _Marker1 setmarkercolor "ColorRed" ? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdammage _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 "ColorGreen" ~_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
dr_eyeball 16 Posted October 2, 2007 Try something like this throughout: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehDir = getDir _vehicle1 _Marker1 setmarkerpos [_vehiclex+10*sin(_vehDir), _vehicley+10*cos(_vehDir), _vehiclez] 10 being 10m (Can't remember which way the cos and sin calls go. Perhaps it's the other way?) Share this post Link to post Share on other sites