Jump to content
Sign in to follow this  
simonwa1

The CreateVehicle command

Recommended Posts

Hi!

I Have a script that respawn vehicles. I get it to work but it only works once. Code look like this:

Trigger:

Condition: (!alive sprtAmb1)

On act.: [sprtAmb1, "M113Ambul", sprtAmb1_pos, 10, 2] exec "vRespawn.sqs"

vRespawn.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_vehicle = _this Select 0

_VehicleClass = _this Select 1

_RespawnPos = _this Select 2

_respawnPos setpos getpos _RespawnPos

_RespawnDelay = _this Select 3

_RespawnRate = _ Select 4

_Counter = 0

?(_Counter >= _RespawnRate) : exit

_Counter = _counter + 1

~_RespawnDelay

deleteVehicle _Vehicle

_Vehicle = _VehicleClass CreateVehicle (getPos _RespawnPos)

It seems that when the vehicle respawns the first time it respawn without a name, which should be provided in the _Vehicle = _VehicleClass CreateVehicle (getPos _RespawnPos), line? Or am I misunderstanding this command? Help would be appriciated!

Share this post


Link to post
Share on other sites
Hi!

I Have a script that respawn vehicles. I get it to work but it only works once. Code look like this:

Trigger:

Condition: (!alive sprtAmb1)

On act.: [sprtAmb1, "M113Ambul", sprtAmb1_pos, 10, 2] exec "vRespawn.sqs"

vRespawn.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_vehicle = _this Select 0

_VehicleClass = _this Select 1

_RespawnPos = _this Select 2

_respawnPos setpos getpos _RespawnPos

_RespawnDelay = _this Select 3

_RespawnRate = _ Select 4

_Counter = 0

?(_Counter >= _RespawnRate) : exit

_Counter = _counter + 1

~_RespawnDelay

deleteVehicle _Vehicle

_Vehicle = _VehicleClass CreateVehicle (getPos _RespawnPos)

It seems that when the vehicle respawns the first time it respawn without a name, which should be provided in the _Vehicle = _VehicleClass CreateVehicle (getPos _RespawnPos), line? Or am I misunderstanding this command? Help would be appriciated!

I don't know much about scripting - but it doesnt seem like you name your new vehicle 'sprtAmb1'. Which is why it never get's activated again.

Cheers.

Edit - ahh, wait... I see now. Sorry 'bout that. Just ignore this post smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]I don't know much about scripting - but it doesnt seem like you name your new vehicle 'sprtAmb1'. Which is why it never get's activated again.

Yes, i do it in the _Vehicle = _VehicleClass CreateVehicle (getPos _RespawnPos) line, where "_vehicle" represent "sprtAmb1"...Or i think so smile_o.gif which is my question!?

Share this post


Link to post
Share on other sites

no you dont you need to define it to the global variable name again

_vehicle is not equal to sprtAmb1 because you delete the variable when you issue the command deleteVehicle

cant you just do something like this

sleep _respawnTime;

_vehicle setDamage 0;

_vehicle setPos _respawnPos;

or use this onInit in the vehicle if its for multiplayer

this respawnVehicle [respawnTime, numberOfRespawnsAllowed or -1 for unlimited];

I can make a sample mission if you would like it.

Share this post


Link to post
Share on other sites
Quote[/b] ]

I can make a sample mission if you would like it.

Sure, thanks!

Share this post


Link to post
Share on other sites

I will put a SP and a MP sample together tomorrow and put it up here :-)

you can get my examples HERE

I have tried to make them easy to understand

in SP I use a function script that returns the new vehicle and then I assign that vehicle the old variable name 'hummer'

in MP I have used respawn type 3 and a trigger that activates when the hummer is inside the respawn zone to move it to its start position, and a "Killed" eventhandler to remove the destroyed hummer

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  

×