Quote:
Quote:
@n00bie:
You want to press the key once and speed "my" up to 3. And if you press it again it should slow down to 0 again?
Code:
var inc;
var status_accel = 0;
define speed, skill2;
function change_speed()
{
status_accel = 0;
wait(1);
my = player;
status_accel = 1;
if(my.speed <= 0) { inc = 1; }
else { inc = -1; }
while(status_accel)
{
my.speed += 0.1 * inc * time_step;
if(my.speed >= 3 || my.speed <= 0)
{
status_accel = 0;
}
wait(1);
}
}
edit:
of course you need some entity pointer (like "player") to refer to it.
on_q = change_speed;
It says: Parameter unknown: Change_speed.
Code:
action rotate_kruis_5
{
// zet de goede pointer naar deze actie
kruis_5 = me;
// leuke shader
my.metal = on;
// passable vlag aanzetten
my.passable = on;
// start de functies
Do_kruis15(); //function 1
change_speed(); //function 2
}
on_q = change_speed();
Change_speed wont work now. What is the problem? I've copy/paste the code from the quote.