anyone knows how to change vehicle respawn time? i hate it instant respawning :/
Vehicle.Respawn
Vehicle.RespawnTimer
I found these ^ in wiki..
vehicle.RespawnTimer = TimeInMS.
It's there in the wiki.
Quote from: jayant on May 05, 2016, 04:07 PMVehicle.Respawn
Vehicle.RespawnTimer
I found these ^ in wiki..
vehicle.Respawn is a function which will respawn the vehicle.
how to set them for all vehicles?
Loop through them all.
how to loop? im noob in scripting
I am busy(at work)
but when thijn said loop he is correct.
I haven't checked if there's any loop tutorials on vcmp but this should help in some type of way someone can correct me if wrong. I refer to this method once a while.
It's a while loop :P
http://forum.liberty-unleashed.co.uk/index.php/topic,629.0.html
/*With for loop*/
Syntax:
for(declare & intialise variable;condition;increment/decrement)
{
//Statements to execute
}
for( local i=130; i <= GetVehicleCount(); i++ )
{
local veh = FindVehicle( i );
if(veh)
{
veh.RespawnTimer = 10000;
}
}
/*While loop*/
Syntax:
Declare and initialise variable;
while(condition)/*Entry controlled loop*/
{
//Statements to execute
}
So,
local i = 130;
while(i<=GetVehicleCount)
{
local veh = FindVehicle(i);
if(veh)
{
veh.RespawnTimer = 1000;
}
i++;
}
/*Do while loop*/
Syntax:
do
{
//Statements to execute
i++;
}while(condtion);
So, you can do the same in do-while loop.
Examples are untested.
thx man
Quote from: Kewun on May 05, 2016, 06:10 PMhow to loop? im noob in scripting
Why dont you take some basic programming courses first before you get into scripting..
then where can i learn squirrel language? ???
im not that very noob in scripting, i know basic functions, i only dont know advanced things like loops, datas etc
Quote from: Kewun on May 05, 2016, 07:27 PMthen where can i learn squirrel language? ???
im not that very noob in scripting, i know basic functions, i only dont know advanced things like loops, datas etc
I suggest you start with learning a type-safe language so you avoid learning any bad habits. Once you've done that Squirrel should be fairly similar to other programming languages
Quote from: Kewun on May 05, 2016, 07:27 PMthen where can i learn squirrel language? ???
im not that very noob in scripting, i know basic functions, i only dont know advanced things like loops, datas etc
w3schools.com
go there and learn PHP, then come to Squirrel, you'll find it easy to program then :D
Here's a sample script for your vehicle loop thingy :D :
http://pastebin.com/rmnjbJsD
nope, the example script does not work. somehow they are still respawning instantly after explosion..
Do you actually call that function anywhere?
Quote from: jayant on May 05, 2016, 07:06 PMExamples are untested.
@Kewun I was just trying to explain usage of loops.
Quote from: Thijn on May 06, 2016, 06:25 AMDo you actually call that function anywhere?
Thijn, you didn't get him, from his last post, I get to know that, he wants to slow down the respawn time when a vehicle gets destroyed.
Aka: When the vehicles gets destroyed, it respawns automagically, he wants to control it via his script. The only method I can think of is to remove the vehicle and add it again later using timers
Quote from: jayant on May 05, 2016, 07:06 PM/*With for loop*/
Syntax:
for(declare & intialise variable;condition;increment/decrement)
{
//Statements to execute
}
for( local i=130; i <= GetVehicleCount(); i++ )
{
local veh = FindVehicle( i );
if(veh)
{
veh.RespawnTimer = 10000;
}
}
/*While loop*/
Syntax:
Declare and initialise variable;
while(condition)/*Entry controlled loop*/
{
//Statements to execute
}
So,
local i = 130;
while(i<=GetVehicleCount)
{
local veh = FindVehicle(i);
if(veh)
{
veh.RespawnTimer = 1000;
}
i++;
}
/*Do while loop*/
Syntax:
do
{
//Statements to execute
i++;
}while(condtion);
So, you can do the same in do-while loop.
Examples are untested.
These loops does not configure all vehicles
I think you are confusing ID and Model
Quote from: KAKAN on May 06, 2016, 08:18 AMQuote from: Thijn on May 06, 2016, 06:25 AMDo you actually call that function anywhere?
Thijn, you didn't get him, from his last post, I get to know that, he wants to slow down the respawn time when a vehicle gets destroyed.
Aka: When the vehicles gets destroyed, it respawns automagically, he wants to control it via his script. The only method I can think of is to remove the vehicle and add it again later using timers
That's exactly what Vehicle.RespawnTime is for. And that code snippet should work by the looks of it.
So there is no need to remove cars xml side and script them in server side to take full control? just curious
@Thijn ,. This is one nice thing to do at least in [LU]. I have not tried in [VC:MP] yet
:P(allows entire full control over vehicles regardless of anything what so ever. I find that the cars in xml have there own setting that scripting nature could not
fully control at times, it just helps..)
Quote from: Mötley on May 06, 2016, 03:38 PMSo there is no need to remove cars xml side and script them in server side to take full control? just curious @Thijn ,. This is one nice thing to do at least in [LU]. I have not tried in [VC:MP] yet
:P(allows entire full control over vehicles regardless of anything what so ever. I find that the cars in xml have there own setting that scripting nature could not fully control at times, it just helps..)
Your post made no sense to me. Care to elaborate?
I will try (on my phone/away from pc)
I will explain LU wise as I can explain more accurate.
So basically a lot of times when cars are spawned into the world from the server xml, the xml will overwrite respawn time as well as keeping the exact amount of damage as I have seen these cars overwrite scripting features.
When using ::CreateVehicle (I believe that is what it is) I can fully do anything I want to cars keeping the exact amount of damage to a vehicle for say 10 days of the server running, as well as keeping cars where they were last used, but sometimes cars would become bugged and it's impossible to enter a car by the 4th day.
I found that the xml overwrites features a lot of times.
So I am curious if his script is not incorrect..
:P unless someone can verify
@Thijn Okay so I ran some test finnaly and removed the vehicles from the xml to server side and added the cars with
CreateVehicle
What happens with
Vehicle.RespawnTimer
is that it will respawn the vehicle over and over again. Basically if not used and you change the time of the created vehicle to say 100 it will keep creating the vehicle causing 99.9 percent bad data usage,
What is needed is a delay not a respawn.timer.
Maybe with the code
FindVehicle
following [player.ID]
And add
Vehicle.Remove
somewhere where
that would be valid without the players vehicle disapering pis*ing off the player base.
This should cause the vehicle to not get recreated if I am correct. then the vehicle should create on that next long re-spawn timer of
Vehicle.RespawnTimer
as the vehicle does need to be removed from the server and with server side scripting the vehicle can be re created at another time.
If you could shoot me a way that's valid
on Vehicle.Remove without the players vehicle disappearing pis*ing off the player base.
I will most definitely do that. and respond with my answer.