Jump to content
Sign in to follow this  
Ajira

waitUntil {!alive _this}; not working on vehicles ?

Recommended Posts

:confused:Ok.. here's the situation..

i spawn a vehicle using the following code:

HMMWV = "HMMWV_Armored" createVehicle (position HMMWVSpawner);
HMMWV setdir 45;
HMMWV setVehicleInit "[""HMMWV""] execVM ""scripts\vehicle-bluefor_init.sqf""";

the init script is as following:

scriptName = "vehicle-bluefor_init.sqf";

_unit = (_this select 0);
[West,"HQ"] sideChat _unit + " is now available on base.";

waitUntil {!alive _this};

// Vehicle died, clean it up.
[West,"HQ"] sideChat _unit + " died.";
deleteVehicle _unit;
//-

all works as planned, and CROSSROAD tells me "HMMWV is now available on base." as it spawns.

The problem however is... once the thing blows up, nothing happens. I should be getting a message, and it should be cleaning up after itself; but nothing happens. It's as if the waitUntil {!alive _this}; doesn't trigger.

I've tried it with:

waitUntil {!alive _this};

waitUntil {!alive this};

waitUntil {!alive _unit};

but it never triggers. Any ideas ? :confused:

Share this post


Link to post
Share on other sites

"[""HMMWV""] execVM

You're passing a string instead of an object to the script?

Share this post


Link to post
Share on other sites

*facepalm* :banghead:

nevermind, fixed.. thanks :blush:

Been staring at the init script for so long, not thinking about the actual spawn script, hehe :p

Share this post


Link to post
Share on other sites

funny how "vehicleVarName" always returns empty in MP... anybody got an idea how to get that to show ?

Share this post


Link to post
Share on other sites
hint format ["My vehicle is the %1",myVehicle];

Share this post


Link to post
Share on other sites

Yeah, that gives the name of the vehicle, but not the description/vehicleVarName.. it's different :(

Share this post


Link to post
Share on other sites

Description is not the vehiclevarname either. ;)

Share this post


Link to post
Share on other sites

Yes, but i forgot to post it on the forum.

by the way, if i use this in MP on a dedicated server:

_unit = format ["%1", _this];
[West,"HQ"] sideChat _unit + " is now available on base.";

it gives a load of crap like like "#<number> <number> AV8B.P3D is now available on base."

:confused:

Share this post


Link to post
Share on other sites
("HMMWV_Armored" createVehicle (getpos HMMWVSpawner)) spawn {
_this setdir 45;
[West,"HQ"] sideChat "HMMWV is now available on base.";
waitUntil {!alive _this};
[West,"HQ"] sideChat "HMMWV died.";
deleteVehicle _this;
};

Share this post


Link to post
Share on other sites

hmm.. i prefer to use an SQF for the init, because we want to put in access control as well later on (e.g. only pilots can enter a plane, etc )

Share this post


Link to post
Share on other sites

And what is stopping you putting all the init stuff after this?

[West,"HQ"] sideChat "HMMWV is now available on base.";

It's irrelevant in what script you run the commands.

Edit: heck, you can just do this in it:

_this execvm "myhmmwvinit.sqf";

You dont need to run init as init just for the sake of it. All init does it run commands affecting the unit. Those commands can be issued directly to the created unit without unnecessary passing of init.

Edited by Shuko

Share this post


Link to post
Share on other sites

ah you mean make the trigger say it and then spawn the vehicle ? hmm...

Share this post


Link to post
Share on other sites

You can run this from script/trigger/whatever. It creates a hmmwv, passes the created object to the spawn (same as execvm but without a separate file). In it you can do whatever you like to the created hmmwv.

nul = ("HMMWV_Armored" createVehicle (getpos HMMWVSpawner)) spawn {
_this setdir 45;
[West,"HQ"] sideChat "HMMWV is now available on base.";
//
// put the access control stuff etc here
//
waitUntil {!alive _this};
[West,"HQ"] sideChat "HMMWV died.";
deleteVehicle _this;
};

Share this post


Link to post
Share on other sites

sweet, thanks man :D

Edited by Ajira

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  

×