vehicle time

Started by Kewun, May 05, 2016, 03:32 PM

Previous topic - Next topic

Kewun

anyone knows how to change vehicle respawn time? i hate it instant respawning :/

jayant

Vehicle.Respawn
Vehicle.RespawnTimer

I found these ^ in wiki..

KAKAN

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.
oh no

Kewun

how to set them for all vehicles?

Thijn

Loop through them all.

Kewun

how to loop? im noob in scripting

Mötley

#6
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

jayant

/*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.

Mötley


Kewun


Murdock

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..

Kewun

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

Murdock

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

KAKAN

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
oh no

Kewun

nope, the example script does not work. somehow they are still respawning instantly after explosion..