O Ilusionista
Captain 100K
This is a code I made for my mod, to make the entity do a jump with random velocity.
Maybe there is a better version (like usin Atan to get the right angle/velocity, but I don't know how to do it yet).
Put this code into your animation script
Usage:
@cmd randomJump 3 4
The first value is the x velocity, the second is the y velocity.
Any improvement, feel free to share.
Maybe there is a better version (like usin Atan to get the right angle/velocity, but I don't know how to do it yet).
Put this code into your animation script
Code:
void randomJump (int vx, int vy)
{
// Douglas Baldan / O Ilusionista
// version 1.0 - 23/07/13
// makes the entity execute a jump into a random direction
void vSelf = getlocalvar("self"); // Gets the caller
int Xr = rand()%vx; // Random X vel, between the chosen velocity
int Yr = 2+rand()%vy; // Random Y vel + 2, to ensure a vertical jump, between the chosen velocity
if (Yr <0){ // If the Y is negative,
Yr = Yr*-1; // Make it positive
}
changeentityproperty(vSelf, "velocity", Xr, 0, Yr); // Change entity velocity
}
Usage:
@cmd randomJump 3 4
The first value is the x velocity, the second is the y velocity.
Any improvement, feel free to share.
Last edited: