Page 1 of 1

low level move command

Posted: Wed Dec 27, 2006 6:44 pm
by hindupower
I am sure there is a low level command for movement like MoveLeft and MoveRight but these are for high level command but i dont know any. :cry: does anyone know those commands?

Posted: Wed Dec 27, 2006 8:13 pm
by Jay
from the RF manual:
ForceRight(float Amount );

Apply an force to the right of Amount to the Pawn's actor.

ForceLeft(float Amount );

Apply an force to the left of Amount to the Pawn's actor.
Those two should do the trick. Keep in mind that you still have to apply an animation with Animate() and a sound file with PlaySound() if you want these.

Posted: Wed Dec 27, 2006 8:18 pm
by hindupower
i have though of that but wouldn't it make it go too fast and is there a time command for HighLevel like LowLevel commands. for example:

LowLevel

if (time>0.1)
{
FireProjectile(...);
}

But i know there is a timer for highlevel commands. What i want to do is use the timer for shooting as if you would do it with that piece of code for a lowlevel section.

Posted: Wed Dec 27, 2006 9:31 pm
by Jay
Timing is very simple - when you know how.

You have a global variable (self.time) that contains the number of seconds that have passed since you went into LowLevel.

if you want to time something you first have to save the last time you have done this and then compare it with the current time.


Because this sounds a bit complicated at first, here is some code to demonstrate that:

at the beginning of the script (before any order, but still after the first '{') we declare some variables that we are going to use later in the script:

Code: Select all

LAST_FIREPROJECTILE [0] //contains the last time-value when 
                                       // a projectile was fired
TIME_PROJECTILE_FIRE [1] //every 1 second a projectile is fired
...
and then in the script itself:

Code: Select all

if (self.time > LAST_FIREPROJECTILE+TIME_PROJECTILE_FIRE)
{ 
FireProjectile(...);
LAST_FIREPROJECTILE=self.time; //remember the current time. 
}

About the Force Commands i think you have to try since they are not that well documented and i haven't used them much.

Posted: Thu Dec 28, 2006 12:22 am
by hindupower
what my question really was is if self.time or just time would work in a high level order?

Posted: Thu Dec 28, 2006 8:06 am
by Juutis
No, it wouldn't. It's the time that has passed since the script last went to low level, so it simply doesn't work in high level.

You could also move the pawn to any direction with the walkmove() command. Along with flymove, it's absolutely the best way to move pawns around.
To move left, you would need to put it like this:
walkmove(self.current_yaw + 1.57,MOVESPEED);

and to right:
walkmove(self.current_yaw - 1.57,MOVESPEED);

Posted: Thu Dec 28, 2006 11:21 pm
by GD1
Just a point to keep in mind. you may already know this, but high-level motion commands cause quite a bit of slowdown. And the self.thinktime will absolutely KILL your framerate when you use anything more than about 0.5.

Posted: Fri Dec 29, 2006 2:44 am
by hindupower
so would
walkmove(self.current_yaw + 1.57,MOVESPEED);
make the pawn move left without chaning its yaw. What i mean is will it strafe left with that or do i need flymove command too?

Posted: Fri Dec 29, 2006 7:41 am
by Juutis
It will move to direction 'self.current_yaw + 1.57' (in radians), which means that the pawn's yaw isn't affected in any way. So yes, it will strafe to the left.

Posted: Sat Jan 20, 2007 3:07 pm
by Ransom
Just to make this more clear, MOVESPEED in Juutis' example is a variable you set for the speed you want the pawn to move at, not a command, which must be declared at the top of your script. For example...

MOVESPEED [0]

and it could really be called anything you want...

CRUNCHBERRY [0]

followed by

walkmove(self.current_yaw + 1.57,CRUNCHBERRY);

later in the script would do the same thing.

Also, I always found it easier to convert degrees to radians, for example if I want a pawn to move left, I'd have a variable called DIRECTION and would use...

DIRECTION = ConvertDegrees(90); // 90 degrees, 270 would move right
CRUNCHBERRY = 100; // how fast to move, higher number = faster
walkmove(self.current_yaw + DIRECTION,CRUNCHBERRY);

Anyway, I was just reading through some posts... hello to everyone!

[Edit QuestOfDreams: Corrected variable name]