Jump to content
Sign in to follow this  
zipman

help - mhq blownup

Recommended Posts

ok made a mhq with all the weapons and ammo in it,

but when the mhq blown up it respawns but without all the ammo and weapons in,

in the mhq i have added

[this, 20, 0, 255] exec "vehi_respawn.sqs"; null0 = this execVM "ammo.sqf";

but no weapons or ammo

plz help

Share this post


Link to post
Share on other sites

Sure it doesn't. If this is in the init line of your blown-up MHQ, then the scriptf tries to fill this one instead of the respawned.

Open the vehi_respawn.sqs and head to the end, there should be a line with a createvehicle command. This line starts (wild guess since i don't see the script) with a local variable:

_name_of_variable = .....createVehicle....

from here you have to call your ammo script:

_nul = _name_of_variable execVM "ammo.sqf";

This way your MHQ should be re-equipped with the weapons and ammo you wished.

Share this post


Link to post
Share on other sites

thanks for the reply this is whats inside the vehi_respawn.sqs

?! (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

---------- Post added at 07:01 AM ---------- Previous post was at 06:34 AM ----------

so it should read this?

_newveh = _new createvehicle _startpos execVM "ammo.sqf";

---------- Post added at 07:21 AM ---------- Previous post was at 07:01 AM ----------

i guess no it shouldnt be if i add it like

_newveh = _new createvehicle _startpos execVM "ammo.sqf";

the mhq only spawns in once then dont respawn, damn this stuff is hard to get my head around

Share this post


Link to post
Share on other sites

lousy respawn script :/ it doesn't save the vehiclevarname on respawn

anyway. Edit it like this: (check the last few lines)

?! (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" // this is where the respawnscript is executed for the respawned vehicle.
null = _newveh execVM "ammo.sqf"; // and this is where we add Ammo to the respawned vehicle

exit

Share this post


Link to post
Share on other sites

thank you all this trouble over the 1 small line..

null = _newveh execVM "ammo.sqf";

ok that worked kinda but now the spawn will only spawn in once when i add that line

null = _newveh execVM "ammo.sqf";

thanks again

Edited by zipman

Share this post


Link to post
Share on other sites

ok i have no clue what i did but now it works fine with the code tajin said..very odd

only change

~_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"

null = _newveh execVM "ammo.sqf"; <----/only thing change as above but now its working.

exit

Share this post


Link to post
Share on other sites

The way your script does the "waiting" phase, that's a a massive amount of checking like "a watched pot never boils"... better to make it sleep for 5, 10 or 30 seconds after each status check, surely?

Share this post


Link to post
Share on other sites

thanks was wondering why it was sooooooo long changed and seem to be working great now that works i hope its time to move on to the next part...with out trouble...oh holdup its me always trouble..hehe

thanks again all

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  

×