Bsilenced Posted February 2, 2010 Share Posted February 2, 2010 i been working on this for awhile i have tried many dif ways of doing it and i cant seem to figure it out createMarker["atv4m",[0,0,0]]; "atv4m" setMarkerShape "ICON"; "atv4m" setMarkerType "DOT"; "atv4m" setMarkerColor "ColorBlack"; "atv4m" setMarkerText "atv4"; while {alive atv4} do { "atv4m" setmarkerpos [getpos atv4 select 0, getpos atv4 select 1]; sleep 1;}; this works but after vehicle respawns it disapears Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 2, 2010 Share Posted February 2, 2010 That is because once the vehicle is destroyed, the while statement ends and it will no longer move your marker around. This also does not show how your marker is spawned or how the vehicle is respawned so I can't evaluate. Link to comment Share on other sites More sharing options...
Bsilenced Posted February 2, 2010 Author Share Posted February 2, 2010 this is whats in the init line of the unit null0 = this execVM "markers.sqf";handle = [this, 5] execVM "x_scripts\x_vehirespawn.sqf" markers sqf is the script i posted first, the revive script is the revive script out of dimination Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 2, 2010 Share Posted February 2, 2010 Does x_vehirespawn.sqf know that it needs to rebuild and execute the markers.sqf command upon recreating the vehicle? Link to comment Share on other sites More sharing options...
Bsilenced Posted February 2, 2010 Author Share Posted February 2, 2010 (edited) no it doesnt, i was hoping to avoid that because i dont understand everything thats going on in there. so is that what i should do just add the script to that? keep in mind im gonna be adding multiple markers.. heres the vehicle revive script // by Xeno private ["_delay","_disabled","_moved","_newveh","_startdir","_startpos","_type","_vehicle"]; if (!isServer) exitWith{}; _vehicle = _this select 0; _delay = _this select 1; _moved = false; _startpos = getpos _vehicle; _startdir = getdir _vehicle; _type = typeof _vehicle; while {true} do { sleep (_delay + random 15); _moved = (if (_vehicle distance _startpos > 5) then {true} else {false}); _empty = (if (({alive _x} count (crew _vehicle)) > 0) then {false} else {true}); _disabled = (if (damage _vehicle > 0) then {true} else {false}); if ((_disabled && _empty) || (_moved && _empty) || (_empty && !(alive _vehicle))) then { deletevehicle _vehicle; _vehicle = objNull; sleep 0.5; _vehicle = _type createvehicle _startpos; _vehicle setpos _startpos; _vehicle setdir _startdir; }; }; Edited February 2, 2010 by Bsilenced Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 2, 2010 Share Posted February 2, 2010 Yes. Basically, when the respawn kicks in, it creates a new vehicle. But as you can see from the last few lines, it doesn't retain all of the values, only the starting position, and the direction. _vehicle = _type createvehicle _startpos; _vehicle setpos _startpos; _vehicle setdir _startdir; It is missing information related to the initialization, etc. Link to comment Share on other sites More sharing options...
Bsilenced Posted February 2, 2010 Author Share Posted February 2, 2010 (edited) so would i be wrong to create seperate respawn scripts for each vehicle type so the corresponding marker would be created or would there be a better way of doing it? sorry its been a long time since i did my lat editing "ofp" Edited February 2, 2010 by Bsilenced Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 2, 2010 Share Posted February 2, 2010 The better way would be to go to Armaholic or Bohemia forums and just download existing scripts instead of reinventing the wheel. This is a very common one. Link to comment Share on other sites More sharing options...
Bsilenced Posted February 2, 2010 Author Share Posted February 2, 2010 wheres the fun in that? Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 2, 2010 Share Posted February 2, 2010 Best way I have seen is to use FSM's for both the spawning and markers. It's fast and reliable. However, this kind of code runs on the client and will continually ping the server for the latest position of a vehicle. That means extra network traffic for every player. Do it on too many vehicles or have too many players connected and you better hope your CPU and server bandwidth can hold up or else you get Dsync issues and people disconnecting. Link to comment Share on other sites More sharing options...
MH6~SPARTA~ Posted February 2, 2010 Share Posted February 2, 2010 Best way I have seen is to use FSM's for both the spawning and markers. It's fast and reliable. However, this kind of code runs on the client and will continually ping the server for the latest position of a vehicle. That means extra network traffic for every player. Do it on too many vehicles or have too many players connected and you better hope your CPU and server bandwidth can hold up or else you get Dsync issues and people disconnecting. I really hope not. They way I see it is vehicles are ghosted to clients, and then getPos returns the ghost of that vehicle's position on the caller machine. If it's the host machine (not necessarily the server--the host machine in a chopper is the pilot, for instance, which is why you never see network lag when flying but when gunning you do) it will be the true vehicle, but if it isn't it will be that client's rendition of that vehicle and where it thinks it is. At least I hope that's the way it works. Any other way is pretty damn stupid. Then again, knowing BIS, that may be exactly how it works. Link to comment Share on other sites More sharing options...
Bsilenced Posted February 3, 2010 Author Share Posted February 3, 2010 well i looked around an i dont see any script that respawns vehicles and remakes the marker, since i only need 5 or 6 i will probably just combine the 2 scripts and rename for whatever is the case like at4respan.sqf etc Link to comment Share on other sites More sharing options...
ChiefRedCloud Posted February 9, 2010 Share Posted February 9, 2010 If I might jump in here. I've been looking around for a solution to a problem we've come apon in our AGE Dom Server. We've added a few vehicles to the Dom list and all seemed well till they either crashed or were destroyed. The wrecks though there (were ever they came to rest) were not showing on the maps. Where would we look for this and how would we change it to reflect on the map where the wreck is so we can recover it? Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 9, 2010 Share Posted February 9, 2010 I'm not looking at the code right now, but my gut guess is x_scripts/x_wreckmarkers.sqf. Link to comment Share on other sites More sharing options...
KalXen~SPARTA~ Posted February 9, 2010 Share Posted February 9, 2010 Actually, the line is in x_scripts\x_getbonus.sqf So in theory you could put in your vehicle's init line something like this to create a wreck that can be repaired to a normally placed vehicle in the mission editor: _handle=[this] execFSM "fsms\Wreckmarker.fsm"; Link to comment Share on other sites More sharing options...
Recommended Posts