Jump to content
Sign in to follow this  
carlostex

Need some expert scripting explanation.

Recommended Posts

Hey people.

With the help of Demonized i was able to build my first script. It's a Vehicle respawn script that can be used in a init line of a unit.

Right now it is working great like this:

//Vehicle_Respawn

//Concept and code adaptation by =WB=Tex

//Most of the code by Demonized

// put in init line of any vehicle: _null = [this, "markername", number of lives, time until respawn, external script] execVM "script_name.sqf"

// create a new plane after first is dead _x amount of times.

_veh = _this select 0; // this is the vehicle that runs the script.

_spawnpos = _this select 1; // this is the marker where you want it to spawn at.

_respawns = _this select 2; // this is where you get the number of lives (respawns) of the unit.

_delay = _this select 3; // this gets the time until a new unit respawns and other is deleted;

_movescript = _this select 4; // sets execution of script defined in editor unit init

_vehicleType = typeOf _veh; // gets the type of vehicle.

_side = side (driver _veh); // gets the side of vehicle.

[_veh] execVM _movescript; //external script execution for editor unit.

waitUntil {!alive _veh OR !canMove _veh}; // wait until the placed unit in the editor is destroyed or disabled.

sleep _delay; // delayed timer defined in the initialization

deleteVehicle _veh; // deletes the placed editor unit.

_altitude = 0; // default altitude if not Air unit.

if (_veh isKindOf "Air") then {

_altitude = 150; //spawn altitude for Air units.

};

while {_respawns != 0} do {

_sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1, _altitude], (random 360), _vehicleType, _side] call BIS_fnc_spawnVehicle; // creates a new unit regarding it hasn't ran out of lives.

_vehicle = _sv select 0; // vehicle spawned

_vehiclegrp = _sv select 2; //vehicle spawned group

[_vehicle] execVM _movescript; // external script execution for respawned unit.

helo1= _vehicle; // just for testing purposes when using triggers.

_fuelchk = [_vehicle] spawn {

if (isServer) then {

_vehicle = _this select 0;

waitUntil { if !(alive _vehicle) exitWith {}; if (fuel _vehicle < 0.1) then { _vehicle setfuel 1}; false }; // this allows for the vehicle to never have fuel shortage

};

};

waitUntil { !alive _vehicle OR !canMove _vehicle }; // this waits until vehicle is dead (!alive) or vehicle cannot move due to damage.

_respawns = _respawns - 1; // _x amount respawns is now -1 and will create the plane again in exact same way as first one.

sleep _delay; // this is how long after vehicle is dead before it will respawn.

[_vehicle] spawn {

_vehicle = _this select 0;

sleep 180;

deleteVehicle _vehicle;

};

};

I'm really happy how it is working but i attempted in another way and since i'm trying hard and enjoying learning how to script i really wanted to understand why my earlier attempt didn't work!

So here's my earlier attempt:

//Vehicle_Respawn

//Concept and code adaptation by =WB=Tex

//Most of the code by Demonized

// put in init line of any vehicle: _null = [this, "markername", number of lives, time until respawn, external script] execVM "script_name.sqf"

// create a new plane after first is dead _x amount of times.

_veh = _this select 0; // this is the vehicle that runs the script.

_spawnpos = _this select 1; // this is the marker where you want it to spawn at.

_respawns = _this select 2; // this is where you get the number of lives (respawns) of the unit.

_delay = _this select 3; // this gets the time until a new unit respawns and other is deleted;

_movescript = _this select 4; // sets execution of script defined in editor unit init

_vehicleType = typeOf _veh; // gets the type of vehicle.

_side = side (driver _veh); // gets the side of vehicle.

[_veh] execVM _movescript; // external script execution for placed unit.

waitUntil {!alive _veh OR !canMove _veh}; // wait until the placed unit in the editor is destroyed or disabled.

sleep _delay; // delayed timer defined in the initialization

deleteVehicle _veh; // deletes the placed editor unit.

while {_respawns != 0} do { if (_veh isKindOf "Air") then {

_sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1,80], (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;} else

{ _sv = [getMarkerPos _spawnpos, (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;}; // creates a new unit regarding it hasn't ran out of lives.

//Past this point script is not executing.

_vehicle = _sv select 0; // vehicle spawned

_vehiclegrp = _sv select 2; // vehicle spawned group

[_vehicle] execVM _movescript; // external script execution for respawned unit.

//helo1= _vehicle; // just for testing purposes when using triggers.

_fuelchk = [_vehicle] spawn {

if (isServer) then {

_vehicle = _this select 0;

waitUntil { if !(alive _vehicle) exitWith {}; if (fuel _vehicle < 0.1) then { _vehicle setfuel 1}; false }; // this allows for the vehicle to never have fuel shortage

};

};

waitUntil { !alive _vehicle OR !canMove _vehicle }; // this waits until vehicle is dead (!alive) or vehicle cannot move due to damage.

_respawns = _respawns - 1; // _x amount respawns is now -1 and will create the plane again in exact same way as first one.

sleep _delay; // this is how long after vehicle is dead before it will respawn.

[_vehicle] spawn {

_vehicle = _this select 0;

sleep 180;

deleteVehicle _vehicle;

};

};

It seems the script it's not working past a point and i didn't get any script or syntax errors so i'm definetely looking forward to learn WHY or WHAT i did wrong. :confused:

Really looking forward to learn something more.

Thank u's!!!!:)

Edited by CarlosTex

Share this post


Link to post
Share on other sites

Try showscripterrors in your games shortcut.... and also look in the .rpt file for errors.

Without those two things.... debugging will be next to impossible.

When you post code try using the code tags (#).... otherwise it's a bit difficult to read and most people will not even bother.

Share this post


Link to post
Share on other sites
Try showscripterrors in your games shortcut.... and also look in the .rpt file for errors.

Without those two things.... debugging will be next to impossible.

When you post code try using the code tags (#).... otherwise it's a bit difficult to read and most people will not even bother.

I run the game with -showscripterrors parameter and there are no errors shown. The script just doent's run past that certain point, at least that's what i assume.

This is the script:

//Vehicle_Respawn
//Concept and code adaptation by =WB=Tex
//Most of the code by Demonized
// put in init line of any vehicle: _null = [this, "markername", number of lives, time until respawn, external script] execVM "script_name.sqf"
// create a new plane after first is dead _x amount of times.

_veh = _this select 0; // this is the vehicle that runs the script.
_spawnpos = _this select 1; // this is the marker where you want it to spawn at.
_respawns = _this select 2; // this is where you get the number of lives (respawns) of the unit.
_delay = _this select 3; // this gets the time until a new unit respawns and other is deleted;
_movescript = _this select 4; // sets execution of script defined in editor unit init
_vehicleType = typeOf _veh; // gets the type of vehicle.
_side = side (driver _veh); // gets the side of vehicle.
[_veh] execVM _movescript; // external script execution for placed unit.

waitUntil {!alive _veh OR !canMove _veh}; // wait until the placed unit in the editor is destroyed or disabled.
sleep _delay; // delayed timer defined in the initialization
deleteVehicle _veh; // deletes the placed editor unit.

[color="Red"]while {_respawns != 0} do { if (_veh isKindOf "Air") then {
_sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1,80], (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;} else
{ _sv = [getMarkerPos _spawnpos, (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;};[/color] // creates a new unit regarding it hasn't ran out of lives.

//Past this point script is not executing.

_vehicle = _sv select 0; // vehicle spawned
_vehiclegrp = _sv select 2; // vehicle spawned group
[_vehicle] execVM _movescript; // external script execution for respawned unit.

//helo1= _vehicle; // just for testing purposes when using triggers.

_fuelchk = [_vehicle] spawn {
if (isServer) then {
_vehicle = _this select 0;
waitUntil { if !(alive _vehicle) exitWith {}; if (fuel _vehicle < 0.1) then { _vehicle setfuel 1}; false }; // this allows for the vehicle to never have fuel shortage
};
};

waitUntil { !alive _vehicle OR !canMove _vehicle }; // this waits until vehicle is dead (!alive) or vehicle cannot move due to damage.
_respawns = _respawns - 1; // _x amount respawns is now -1 and will create the plane again in exact same way as first one.
sleep _delay; // this is how long after vehicle is dead before it will respawn.

[_vehicle] spawn {
_vehicle = _this select 0;
sleep 180;
deleteVehicle _vehicle;
};

};

Seems like the engine doesn't like how i organized the code i have in red, and although it doesn't show any errors.

I dunno what's wrong with the isKindOf condition because i think i wrote it properly. Maybe the while command does not work properly with isKindOf. I can't get no answers for this.

Also strange is that the code in red seems to work because when unit is air type it respawns 80 meters in the air, and when is not an air vehicle it respawns on the ground instead of falling 80 meters from the sky. The problem is the script does not work past that point!

For instance when i test with the global variable:

helo1 = _vehicle

and i use a radio trigger with helo1 setdamage 1; the radio trigger doens't work which makes me assume that

_vehicle = _sv select 0;

is not working.

Edited by CarlosTex

Share this post


Link to post
Share on other sites

Laid out like this it might help you...or help someone spot the problem.

What is the error you are getting? ... also....what's in the .rpt file?

//Vehicle_Respawn
//Concept and code adaptation by =WB=Tex
//Most of the code by Demonized
// put in init line of any vehicle: _null = [this, "markername", number of lives, time until respawn, external script] execVM "script_name.sqf"
// create a new plane after first is dead _x amount of times.

_veh = _this select 0; // this is the vehicle that runs the script.
_spawnpos = _this select 1; // this is the marker where you want it to spawn at.
_respawns = _this select 2; // this is where you get the number of lives (respawns) of the unit.
_delay = _this select 3; // this gets the time until a new unit respawns and other is deleted;
_movescript = _this select 4; // sets execution of script defined in editor unit init
_vehicleType = typeOf _veh; // gets the type of vehicle.
_side = side (driver _veh); // gets the side of vehicle.
[_veh] execVM _movescript; // external script execution for placed unit.

waitUntil {!alive _veh OR !canMove _veh}; // wait until the placed unit in the editor is destroyed or disabled.
sleep _delay; // delayed timer defined in the initialization
deleteVehicle _veh; // deletes the placed editor unit.

while {_respawns != 0} do {
if (_veh isKindOf "Air") then {
	_sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1,80], (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;
} else {
	_sv = [getMarkerPos _spawnpos, (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;
}; // creates a new unit regarding it hasn't ran out of lives.

//Past this point script is not executing.

_vehicle = _sv select 0; // vehicle spawned
_vehiclegrp = _sv select 2; // vehicle spawned group
[_vehicle] execVM _movescript; // external script execution for respawned unit.

//helo1= _vehicle; // just for testing purposes when using triggers.

_fuelchk = [_vehicle] spawn {
	if (isServer) then {
		_vehicle = _this select 0;
		waitUntil {if !(alive _vehicle) exitWith {};if (fuel _vehicle < 0.1) then {_vehicle setfuel 1}; false}; // this allows for the vehicle to never have fuel shortage
	};
};

waitUntil { !alive _vehicle OR !canMove _vehicle }; // this waits until vehicle is dead (!alive) or vehicle cannot move due to damage.
_respawns = _respawns - 1; // _x amount respawns is now -1 and will create the plane again in exact same way as first one.
sleep _delay; // this is how long after vehicle is dead before it will respawn.

[_vehicle] spawn {
	_vehicle = _this select 0;
	sleep 180;
	deleteVehicle _vehicle;
};
};

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

I get no script errors, the script spawns the vahicle but does not execute past that point. You might be right about the }; thing but i don't see what's wrong.

.RPT shows this:

=====================================================================
== C:\Program Files\Bohemia Interactive\ArmA 2\arma2oa.exe
== "C:\Program Files\Bohemia Interactive\ArmA 2\arma2oa.exe" -nosplash -cpucount=2 "-mod=C:\Program Files\Bohemia Interactive\ArmA 2\@DFS_FPScounter;C:\Program Files\Bohemia Interactive\ArmA 2\@HiFi_AIR;C:\Program Files\Bohemia Interactive\ArmA 2\@CBA" -showScriptErrors
=====================================================================
Exe timestamp: 2010/12/23 18:38:20
Current time:  2011/03/28 08:54:17

Version 1.57.76815
Item str_disp_server_control listed twice
Warning: looped for animation: ca\wheeled\data\anim\uaz_cargo01_v0.rtm differs (looped now 0)! MoveName: kia_uaz_cargo02
Warning: looped for animation: ca\wheeled\data\anim\uaz_cargo01_v0.rtm differs (looped now 1)! MoveName: uaz_cargo02
[72,32.778,0,"XEH: PreInit Started. v3.0.6"]
[72,32.88,0,"MISSINIT","intro","Desert_E",false,true,false]
[72,35.448,0,"XEH: PreInit Finished"]
[72,35.581,0,"XEH: VehicleCrewInit: 14"]
[76,38.563,0.3,"XEH: PostInit Started"]
[76,38.836,0.3,"CBA_VERSIONING",["#CBA_HASH#",["cba"],[[[0,7,4,151],-1]],[[0,0,0],0]]]
[76,38.856,0.3,"XEH: PostInit Finished; [true,false,false,true,false,true,true,true,true,false]"]
[2407,92.56,0,"XEH: PreInit Started. v3.0.6"]
[2407,92.592,0,"MISSINIT","spawn_flying_chopper","Chernarus",false,true,false]
[2407,93.823,0,"XEH: PreInit Finished"]
[2407,93.863,0,"XEH: VehicleCrewInit: 1"]
[3313,105.151,0,"WARNING: PostInit did not finish in a timely fashion"]
[3356,107.003,0,"XEH: PostInit Started"]
[3356,107.014,0,"CBA_VERSIONING",["#CBA_HASH#",["cba"],[[[0,7,4,151],-1]],[[0,0,0],0]]]
[3356,107.018,0,"XEH: PostInit Finished; [true,false,false,true,false,true,true,true,true,false]"]
Cannot load sound 'ca\dubbing\global\radio\male01\ru\wereheavilydamagede.wss'
Cannot load sound 'ca\dubbing\global\radio\male01\ru\wereheavilydamagede.wss'
[4636,142.575,0,"XEH: PreInit Started. v3.0.6"]
[4636,142.664,0,"MISSINIT","intro","Chernarus",false,true,false]
[4636,143.644,0,"XEH: PreInit Finished"]
[4636,143.793,0,"XEH: VehicleCrewInit: 1"]
[4638,144.281,0,"XEH: PostInit Started"]
[4638,144.379,0,"CBA_VERSIONING",["#CBA_HASH#",["cba"],[[[0,7,4,151],-1]],[[0,0,0],0]]]
[4638,144.392,0,"XEH: PostInit Finished; [true,false,false,true,false,true,true,true,true,false]"]

I see nothing wrong in the rpt except that WARNING. "spawn_flying_chopper" is the test mission for the script.

Share this post


Link to post
Share on other sites

while {_respawns != 0}

Yet you don't set/change the variable anywhere inside the loop. Thus, it will never change value --> never exits the loop.

Share this post


Link to post
Share on other sites
while {_respawns != 0}

Yet you don't set/change the variable anywhere inside the loop. Thus, it will never change value --> never exits the loop.

Yes but how come it works great like this:

while {_respawns != 0} do {
_sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1, 80], (random 360), _vehicleType, _side] call BIS_fnc_spawnVehicle; // creates a new unit regarding it hasn't ran out of lives. 

and not like this:

while {_respawns != 0} do { if (_veh isKindOf "Air") then {
_sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1,80], (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;} else
{ _sv = [getMarkerPos _spawnpos, (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;}; // creates a new unit regarding it hasn't ran out of lives.

i only added the condition if isKindOf "Air" to separate the respawn between land and air vehicles!

This is what i would like to understand because i'm working hard to learn scripting, and i don't understand why just because i added a condition it doesn't work well.:confused:

The _respawns variable must be separated to the condition because i want it to work as a lives (number of respawns) thing. The condition just separates different code for different class of vehicles.

Edited by CarlosTex

Share this post


Link to post
Share on other sites

Sorry, but Im not buying it. :P The script will get stuck to the while loop, no matter what you have inside it, as long as _respawns is not 0.

Besides, using a while loop to spawn vehicles, especially without any delay will probably just spawn huge pile of them or force the game to stop and reschedule the script.

Edited by Shuko

Share this post


Link to post
Share on other sites
Sorry, but Im not buying it. :P The script will get stuck to the while loop, no matter what you have inside it, as long as _respawns is not 0.

Besides, using a while loop to spawn vehicles, especially without any delay will probably just spawn huge pile of them or force the game to stop and reschedule the script.

Look i believe you. But the _respawns !=0 is just for the loop to continue until lives get to 0. If you look to my first post you'll se the difference between the two scripts.

First works awesome the second does not, just because i added the condition if (isKindof "Air") inside the "while" which should be ok i think. On the first one it's just a bit different. But in my point of view the second should work as well.

Could you take a look into my first post and tell me why the first one works and the second does not please?

Share this post


Link to post
Share on other sites

Lol a big debate, the only problem this script have is the lack of a Bracket "}" at the end. That's why the while execute only once and isn't continue. BTW if you add them the while loop will spawn a pile pf vehicles on the spot.

while {_respawns != 0} do 
{
 if (_veh isKindOf "Air") then 
 {
 _sv = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1,80], (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;
 } else
  {
   _sv = [getMarkerPos _spawnpos, (random 360), _vehicletype, _side] call BIS_fnc_spawnVehicle;
  }; // creates a new unit regarding it hasn't ran out of
}; //THIS ONE YOU FORGOT

It's not only about syntex make sure you write things in structeres or you'll lose some brackets.

PS make sure you'll put something that make _respawns =0;

Edited by shay_gman

Share this post


Link to post
Share on other sites

Thank you shay man i will try. But if you check all the script you'll see i have a waitUntil the vehicle is not alive or !canmove and then it will make _respawns= _respawns -1;

Share this post


Link to post
Share on other sites

Well i'm refering only to the part you posted the first post is very unclear, the lack of structer and the fact that you haven't post in php format make it harder to understand.

I can check it later when i'll be home on the Notepad ++.

I don't get the script. It should have while {alive vehicle} do {sleep 1}; and then when the vehicle isn't alive spawn the vehilce and fire the script again with the respawn number desent by 1.

Something like:

[_respawn, _vehicle] execVm "Respawn.sqf"; then the code runs wait till the vehicle destroyed and fire the same script again with _respawn - 1 like that at the end of the script [_respawn - 1, _vehicle] execVm "Respawn.sqf"

Share this post


Link to post
Share on other sites

Nah it doesn't work because if i put that additional }; it will loop like hell and ignore the rest of the script that is essential for this : {_respawns!=0} to work.

Share this post


Link to post
Share on other sites
Well i'm refering only to the part you posted the first post is very unclear, the lack of structer and the fact that you haven't post in php format make it harder to understand.

I can check it later when i'll be home on the Notepad ++.

I don't get the script. It should have while {alive vehicle} do {sleep 1}; and then when the vehicle isn't alive spawn the vehilce and fire the script again with the respawn number desent by 1.

Something like:

[_respawn, _vehicle] execVm "Respawn.sqf"; then the code runs wait till the vehicle destroyed and fire the same script again with _respawn - 1 like that at the end of the script [_respawn - 1, _vehicle] execVm "Respawn.sqf"

I'm really un-experienced and still learning. Plus the script works great when i made in another way while still using the while {_respawns!=0} thing. I just didn't understood why it didn't work the way i originally did it, because i think there is nothing wrong with it. It just doesn't execute that specific point and i know it shouldn't be because of the {_respawn!=0} because i still use it on the one that works.

Share this post


Link to post
Share on other sites

Next time you place any scripts in a post use the "wrap PHP tags around selected text" option, its up to the right in advanced post next to the youtube button.

Edit: removed text.

Edited by Demonized

Share this post


Link to post
Share on other sites

Demonized if i add another }; the script will loop like hell and will respawn massive loads of vehicles!! It will be stuck in the loop like shuko said. It will never go forward.

Anyways thank you all i guess the way i first tried was impossible anyway.

Share this post


Link to post
Share on other sites

Well, that was just one problem with the script. For example, putting 2 waituntils in a row doesn't create a loop. Anyway, quick something for you to continue testing and improving.

//Vehicle_Respawn
//Concept and code adaptation by =WB=Tex 
//Most of the code by Demonized
// put in init line of any vehicle: _null = [this, "markername", number of lives, time until respawn, external script] execVM "script_name.sqf" 
// create a new plane after first is dead _x amount of times.

if !isserver exitwith {};

private ["_veh","_spawnpos","_respawns","_delay","_movescript","_vehicleType","_side","_altitude","_loop"];

_veh = _this select 0; // this is the vehicle that runs the script.
_spawnpos = _this select 1; // this is the marker where you want it to spawn at. 
_respawns = _this select 2;	 // this is where you get the number of lives (respawns) of the unit.
_delay = _this select 3; // this gets the time until a new unit respawns and other is deleted;
_movescript = _this select 4;	 // sets execution of script defined in editor unit init
_vehicleType = typeOf _veh; // gets the type of vehicle.
_side = side (driver _veh);	 // gets the side of vehicle. 
[_veh] execVM _movescript; //external script execution for editor unit.

if (_veh isKindOf "Air") then {
 _altitude = 150; //spawn altitude for Air units.
} else {
 _altitude = 0; // default altitude if not Air unit.
};

_loop = true;
while {_loop} do {
 if (!alive _veh || !canmove _veh) then {
   if (_respawns == 0) then {
     _loop = false;
   } else {
     _respawns = _respawns - 1;
     sleep _delay;
     deletevehicle _veh;
     _veh = [[getMarkerPos _spawnpos select 0,getMarkerPos _spawnpos select 1, _altitude], (random 360), _vehicleType, _side] call BIS_fnc_spawnVehicle; // creates a new unit regarding it hasn't ran out of lives.
     _veh = _veh select 0;
     [_veh] execVM _movescript;
   };
 } else {
   if (fuel _veh < 0.1) then {
     _veh setfuel 1;
   };
 };
 sleep 1;
};

Share this post


Link to post
Share on other sites

best idea is for you to learn to organize your brackets.

having something like

sv = {blah do this; if (blah) then {blah blah blah; if (blah again) then {blah[blach,array,aray]}}}

it becomes very easy to forget what the hell is happening in your code and which brackets connect to which control structures.

so

sv = {
      blah do this;
      if (blah) then {
              blah happens;
              if (new blah) then {
                       another blah;
              };
      };
};

this is alot easier to follow, and clearly lets you see which control structure does what (which is what i think happened for you, you put the brackets in the wrong places.

also, you need to get squint!

Share this post


Link to post
Share on other sites

Shuko's example is very good because it made the script very lightweight. I didn't know that i could put another if inside another if and also then and else twice. It's more simple now but i find it much more difficult to understand actually, because of condition inside condition.

The only thing i don't quite like as much is that on my working version, i had separate sleep for deleting vehicle and respawn, so that when a new unit respawned the wreck wasn't immediately deleted.

Anyway thanks a lot. I'll study this a lot more to understand how your version works. It's really smart, you must be an awesome scripter.

Share this post


Link to post
Share on other sites
The only thing i don't quite like as much is that on my working version, i had separate sleep for deleting vehicle and respawn, so that when a new unit respawned the wreck wasn't immediately deleted.

Unless I messed up something, it should wait the given delay after vehicle is destroyed, then it will remove it and create a new one. What exactly did you want? Something like:

destroyed

sleep x

create new

sleep y

delete old

?

Share this post


Link to post
Share on other sites
Unless I messed up something, it should wait the given delay after vehicle is destroyed, then it will remove it and create a new one. What exactly did you want? Something like:

destroyed

sleep x

create new

sleep y

delete old

?

The one you did deletes the vehicle right before the new one is spawned. On my working script version, i could define the wreck being there for a little while even if a new vehicle respawned, so the thing you're mentioning with slee x and sleep y is quite what i had yeah.

Share this post


Link to post
Share on other sites

Hi Carlos,

First i would like to say Thanks for your vehicle respawn script.

but i have also a question,

i use your script on a chopper, Side BLUFOR but I want him to respawn on the ground and static, i tried to modify your script but in vain,

hope you can help me ^^

thanks in advance .

Share this post


Link to post
Share on other sites
Hi Carlos,

First i would like to say Thanks for your vehicle respawn script.

but i have also a question,

i use your script on a chopper, Side BLUFOR but I want him to respawn on the ground and static, i tried to modify your script but in vain,

hope you can help me ^^

thanks in advance .

Remember that my script respawns AI manned vehicle so crew is spawned inside the vehicle as well because i'm using a function.

It's easy to get the vehicle to always spawn at the ground but do you want that or an empty spawned vehicle for you to get in?

Share this post


Link to post
Share on other sites

Dammit fuel thing is not working for both scripts mine's and shuko's version. i set a rdio trigger with helo setfuel 0 and it doesn't refill the fuel to 1.

---------- Post added at 10:41 AM ---------- Previous post was at 10:30 AM ----------

I'll correct that works for planes but not for choppers!!!

---------- Post added at 11:04 AM ---------- Previous post was at 10:41 AM ----------

Hmm i'll firther correct, looks like it doens't like me setting the fuel to 0 via a radio trigger, and as soon units eject from vehicle function kicks in and deletes the vehicle.

Share this post


Link to post
Share on other sites
Remember that my script respawns AI manned vehicle so crew is spawned inside the vehicle as well because i'm using a function.

It's easy to get the vehicle to always spawn at the ground but do you want that or an empty spawned vehicle for you to get in?

i want it to respawn with crew inside , it's why i find this script so nice! ^^

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  

×