G
Goliath
Guest
After searching through the forum i found nothing about random speed, so i came with something similar, is not 100% random but does the job.
declare
@cmd randspeed
on frames to call it, you can change the speed values in the script.
Code:
void randspeed()
{ // Set random speed betwen 3 speed values
void self = getlocalvar("self");
int r = rand()%60; // Get Random value
if(r < 30)
{changeentityproperty(self, "velocity", -1, 0, 0.5);}
else if(r < 0)
{changeentityproperty(self, "velocity", -0.5, 0, 1.5);}
else
{changeentityproperty(self, "velocity", -1, 0, 2);}
}
declare
@cmd randspeed
on frames to call it, you can change the speed values in the script.