Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
clydefrog

Adding a respawn script to vehicles created during mission

Recommended Posts

I'd like to add a vehicle respawn script to several vehicles which will be created as the result of a task being completed. Is this even possible and if so how would you go about doing it?

Thanks.

Share this post


Link to post
Share on other sites

Of course it is, your question is too uncertain though. Anyway:

_veh = createVehicle ["BTR90", _somepos, [], 0, "CAN_COLLIDE"];
_veh execVM "what_ever_respawn_script_you_use.sqf";

Share this post


Link to post
Share on other sites
Of course it is, your question is too uncertain though. Anyway:

_veh = createVehicle ["BTR90", _somepos, [], 0, "CAN_COLLIDE"];
_veh execVM "what_ever_respawn_script_you_use.sqf";

Well I'm using the simple vehicle respawn script where you would usually put the following in a vehicles init field:

veh = [this, Delay, Deserted timer, Respawns, Effect, Static] execVM "vehicle.sqf"

but with numbers, I guess you know how it works.

So when I have a task completed I am going to spawn some vehicles in the triggers onAct, e.g.

 heli1 = createVehicle "MH60S" (getMarkerPos "heli1spawn"); 

but I want to add the respawn script to this newly created vehicle too, does that explain it better?

So would I do:

heli1 = createVehicle "MH60S" (getMarkerPos "heli1spawn"); heli1 = [this, Delay, Deserted timer, Respawns, Effect, Static] execVM "vehicle.sqf

and that would add the respawn script and it would always use the script every time it is destroyed after that?

Also I forgot, what does "can_collide" do?

Share this post


Link to post
Share on other sites

I don't know how your respawn script works, but I guess it should be like this:

heli1 = createVehicle "MH60S" (getMarkerPos "heli1spawn");
heli1 = [heli1, Delay, Deserted timer, Respawns, Effect, Static] execVM "vehicle.sqf;

----

About CAN_COLLIDE: createVehicle array

Share this post


Link to post
Share on other sites
I don't know how your respawn script works, but I guess it should be like this:

heli1 = createVehicle "MH60S" (getMarkerPos "heli1spawn");
heli1 = [heli1, Delay, Deserted timer, Respawns, Effect, Static] execVM "vehicle.sqf;

----

About CAN_COLLIDE: createVehicle array

Ok thanks, yeah I forgot to change the other "this".

I'll try this out tomorrow, for some reason I expected it to be not so simple.

Edited by clydefrog

Share this post


Link to post
Share on other sites

heli1 = createVehicle "MH60S" (getMarkerPos "heli1spawn");
[color="#FF0000"]nul[/color] = [heli1, Delay, Deserted timer, Respawns, Effect, Static] execVM "vehicle.sqf;

heli1 in the first line becomes the object you just created, the vehicle, which you then feed to the respawn script in the second line, but then you replace that object with the scripthandle (or whatever your vehicle.sqf returns in the second line. Use nul for that instead of the same variable as the object you spawned.

Share this post


Link to post
Share on other sites
heli1 in the first line becomes the object you just created, the vehicle, which you then feed to the respawn script in the second line, but then you replace that object with the scripthandle (or whatever your vehicle.sqf returns in the second line. Use nul for that instead of the same variable as the object you spawned.

Had no idea what script returns and thought it was vehicle itself because of how OP used the script in his example.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×