Jump to content
Sign in to follow this  
Ekre

Mobile HQ

Recommended Posts

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

Share this post


Link to post
Share on other sites

fixed, now its working as intended :)

Share this post


Link to post
Share on other sites
fixed, now its working as intended :)

would you mind saying how you fixed it please im having the same thing with the spawn once it blows out the marker drops back to the bottam of the map and i can then only teleport in to water.

any if any one else nows a fix please reply.

thanks

Share this post


Link to post
Share on other sites
would you mind saying how you fixed it please im having the same thing with the spawn once it blows out the marker drops back to the bottam of the map and i can then only teleport in to water.

any if any one else nows a fix please reply.

thanks

use these scripts to respawning your MHQ(s) with the marker(s)

vehi_respawn.sqs - Myke's respawn script, i just added processInitCommands and the initveh lines.

if you change the script's name, dont forget to do that in the last line as well (and the same for SpawnScript.sqs)!!!

; Vehicle Respawn Script by {nBs**-Myke-{CO**
; Usage: [this, 60, [0, 0], 180] exec "vehi_respawn.sqs"
; this: refers to the vehicle. Enter vehicle name when not using in Vehicles Init line
; 60: Time until respawn in seconds.
; [0, 0] Enter XY coordinates for manual respawn place setting or just enter 0 (no square brackets) for automatic detection
; 180: Enter Vehicle heading manually. For automatic detection enter 361
; aslong Units are inside, vehicle will not respawn and can be repaired

?! (local server): exit

_vehicle = _this select 0
_delay = _this select 1
_pos = _this select 2
_dir = _this select 3
_initVeh = _this exec "SpawnScript.sqs"
_vehicle setVehicleInit _initVeh
processInitCommands

; defining possible vehicle positions
_driver = _vehicle emptypositions "driver"
_gunner = _vehicle emptypositions "gunner"
_commander = _vehicle emptypositions "Commander"
_crew = _vehicle emptypositions "Cargo"

? (_pos == 0): _startpos = getpos _vehicle
? (_dir == 361): _startdir = getdir _vehicle

#waiting
; waiting for Vehicle is disabled
@ !(canmove _vehicle) &! (canfire _vehicle)

; checking if vehicle still is manned

@ (isnull driver _vehicle) && (isnull gunner _vehicle) && (isnull commander _vehicle)

~_delay
? (canmove _vehicle) && (canfire _vehicle): goto "waiting"
_new = typeof _vehicle
deletevehicle _vehicle
_newveh = _new createvehicle _startpos
_newveh setpos _startpos
_newveh setdir _startdir
[_newveh, _delay, _pos, _dir] exec "vehi_respawn.sqs"
exit

and now the "SpawnScript.sqs" script (forgot the authors name (maybe it was Squuezee, sorry, i forgot your name), found that on a forum)

change "m_WestSpawn1" to your HQ's marker name

;SpawnScript.sqs
_veh = _this select 0

#Loop
~1
?(!alive _veh):exit
"m_WestSpawn1" setMarkerPos getpos _veh 
goto "Loop"

put this into your MHQ's init line:

[this, 10, 0, 255] exec "vehi_respawn.sqs";

(10 sec respawn delay, 255 azimut)

if you have multiple MHQ's, then you will need 1-1 script for each MHQ.

for example, you have 2 MHQ, then you need "vehi_respawn.sqs", "SpawnScript.sqs" for MHQ1, and "vehi_respawn1.sqs", "SpawnScript1.sqs" for MHQ2, with the proper changes in the scripts (marker name in SpawnScript file and the script names in vehi_respawn)

Edited by Ekre

Share this post


Link to post
Share on other sites

thanks you so so much that works great...now for the but..lol

if im in the mobile HQ and die i now respawn at the bottam of the map but the spawn is back on base that works great with the marker,

dont see how my players are respawning in the middle of nowhere and not back on the base only thing i changed was to the in init within the mhq and the 2 sqs from above, nothing else got changed.

-=Edit =-

never mind it was a error within the init file fixed that now.

thanks so much again.

Edited by zipman

Share this post


Link to post
Share on other sites

Will this script work for MP? I am trying to implement mobile spawns, 2 per team, and so far, any markers I set in the editor are able to be seen by both teams, and my Russian can use a US mobile spawn. I used a marker relocated to a vehicle's position, and a radio command that would put a player into the cargo position of the vehicle. Worked great till I added everything in for the other team.

If this works for MP, I will be HAPPY!

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  

×