Jump to content
Spartans Home

scripting question


Bsilenced
 Share

Recommended Posts

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

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 by Bsilenced
Link to comment
Share on other sites

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

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 by Bsilenced
Link to comment
Share on other sites

:) 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

:) 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. :rolleyes:

Link to comment
Share on other sites

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

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

 Share

×
×
  • Create New...