low level move command

Topics regarding Scripting with Reality Factory
Post Reply
hindupower
Posts: 7
Joined: Thu Nov 23, 2006 9:46 pm

low level move command

Post 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?
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
hindupower
Posts: 7
Joined: Thu Nov 23, 2006 9:46 pm

Post 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.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
hindupower
Posts: 7
Joined: Thu Nov 23, 2006 9:46 pm

Post by hindupower »

what my question really was is if self.time or just time would work in a high level order?
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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);
Pain is only psychological.
GD1
Posts: 413
Joined: Tue Jul 05, 2005 2:33 pm

Post 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.
Check out my band
Tougher Than Fort Knox
Image
hindupower
Posts: 7
Joined: Thu Nov 23, 2006 9:46 pm

Post 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?
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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.
Last edited by Juutis on Sat Jan 20, 2007 3:28 pm, edited 1 time in total.
Pain is only psychological.
User avatar
Ransom
Posts: 30
Joined: Sat Jan 14, 2006 7:16 pm

Post 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]
Post Reply