Ekre
Jun 28 2009, 13:36
i would like to make a mobile hq with respawn.
its almost done, but i have a bug with it.
the mobile hq is working, i can respawn to its actual location, until its get destroyed. when its get destroyed, the marker's location wont update to the right location, its just set the marker's location to the bottom left edge of the map.
im using scripts made by the Community (much much thanks for you guys!!!)
for locating the MHQ and set the marker's location to the MHQ, im using IceBreakR's script:
#Loop
PRIPRAVLJEN = FALSE
~5
lockjawready = TRUE
PUBLICVARIABLE "lockjawready"
_POLOZAJ_1 = GetPos hq
"m_WestSpawn1" setmarkerpos _POLOZAJ_1
goto "Loop"
i have a marker, called "m_WestSpawn1", which follows the LAV-25HQ called "hq" by the script above.
for vehicle respawn, im using Norrin's vehicle respawn script (using it with v = [this, "hq", 10] execVM "vrs_AI_general.sqf" in the LAV-25HQ's init)
private ["_vcl","_respawndelay","_dir","_pos","_type","_run","_delay"];
if (!local Server) exitWith {};
_vcl = _this select 0;
_name_vcl = _this select 1;
_respawndelay = _this select 2;
_dir = Getdir _vcl;
_pos = Getpos _vcl;
_type = typeOf _vcl;
_run = TRUE;
sleep 5;
for [{}, {_run}, {_run}] do
{
while {canMove _vcl || canFire _vcl} do
{
sleep 1;
};
while {!canMove _vcl && count crew _vcl > 0 || !canFire _vcl && count crew _vcl > 0} do
{
sleep 1;
};
_delay = Time + _respawndelay;
while {!canMove _vcl && Time < _delay && count crew _vcl == 0 || !canFire _vcl && Time < _delay && count crew _vcl == 0} do
{
sleep 1;
};
if (!canMove _vcl && Time >= _delay && count crew _vcl == 0 || !canFire _vcl && Time >= _delay && count crew _vcl == 0) then
{
deleteVehicle _vcl;
_vcl = _type createVehicle _pos;
_vcl setVehicleVarName _name_vcl;
_vcl setdir _dir;
sleep 1;
_vcl setvelocity [0,0,0];
_vcl setpos _pos;
sleep 1;
_vcl setvelocity [0,0,0];
sleep 2;
};
};
also tried it with Mr. Murray's vehicle respawn script (it gives a name to the respawning vehicle too), but its just did the same. was fine until the vehicle has to respawn.
till it destroyed, everything is fine. the marker follows the HQ, i can respawn to its position. after its get destroyed, its just loose its marker.
any help appreciated, thanks!
ps.: Sorry for my crappy english
its almost done, but i have a bug with it.
the mobile hq is working, i can respawn to its actual location, until its get destroyed. when its get destroyed, the marker's location wont update to the right location, its just set the marker's location to the bottom left edge of the map.
im using scripts made by the Community (much much thanks for you guys!!!)
for locating the MHQ and set the marker's location to the MHQ, im using IceBreakR's script:
#Loop
PRIPRAVLJEN = FALSE
~5
lockjawready = TRUE
PUBLICVARIABLE "lockjawready"
_POLOZAJ_1 = GetPos hq
"m_WestSpawn1" setmarkerpos _POLOZAJ_1
goto "Loop"
i have a marker, called "m_WestSpawn1", which follows the LAV-25HQ called "hq" by the script above.
for vehicle respawn, im using Norrin's vehicle respawn script (using it with v = [this, "hq", 10] execVM "vrs_AI_general.sqf" in the LAV-25HQ's init)
private ["_vcl","_respawndelay","_dir","_pos","_type","_run","_delay"];
if (!local Server) exitWith {};
_vcl = _this select 0;
_name_vcl = _this select 1;
_respawndelay = _this select 2;
_dir = Getdir _vcl;
_pos = Getpos _vcl;
_type = typeOf _vcl;
_run = TRUE;
sleep 5;
for [{}, {_run}, {_run}] do
{
while {canMove _vcl || canFire _vcl} do
{
sleep 1;
};
while {!canMove _vcl && count crew _vcl > 0 || !canFire _vcl && count crew _vcl > 0} do
{
sleep 1;
};
_delay = Time + _respawndelay;
while {!canMove _vcl && Time < _delay && count crew _vcl == 0 || !canFire _vcl && Time < _delay && count crew _vcl == 0} do
{
sleep 1;
};
if (!canMove _vcl && Time >= _delay && count crew _vcl == 0 || !canFire _vcl && Time >= _delay && count crew _vcl == 0) then
{
deleteVehicle _vcl;
_vcl = _type createVehicle _pos;
_vcl setVehicleVarName _name_vcl;
_vcl setdir _dir;
sleep 1;
_vcl setvelocity [0,0,0];
_vcl setpos _pos;
sleep 1;
_vcl setvelocity [0,0,0];
sleep 2;
};
};
also tried it with Mr. Murray's vehicle respawn script (it gives a name to the respawning vehicle too), but its just did the same. was fine until the vehicle has to respawn.
till it destroyed, everything is fine. the marker follows the HQ, i can respawn to its position. after its get destroyed, its just loose its marker.
any help appreciated, thanks!
ps.: Sorry for my crappy english