Page 2 of 2

Posted: Mon Apr 16, 2007 6:50 pm
by Xemnas
Of Course I Love Jesus! (His Father Too!) He helps me get up every morning! (That and lots and lots of coffie! lol j/k)

Posted: Mon Apr 16, 2007 6:52 pm
by scott
lol, your sig and your avator, apropriate, loved that game, best ever and also the film, ff7 was the best ff there was!
edit.
ps sorry for the off topic but when anyone mentions that game i just have to comment

Posted: Mon Apr 16, 2007 8:42 pm
by zany_001
Well i love Jesus too.

Posted: Tue Apr 17, 2007 8:38 pm
by Xemnas
:D Glad to hear it!

Now back to the topic at hand, lets talk scripting.

:arrow: I modified Juutis' little code so the pawn has 8 directional movement but instead of facing the pressed direction he does more of a moon walk or slide accross the floor that and the animations are quite delayed.

:idea: I figure the rotation commands might be able to solve this but I can't make it stick, and there's always a possibility of using animations but that seems unnessesary if a script can solve the problem just as easily.

Posted: Tue Apr 17, 2007 8:49 pm
by Jay
with solving your problem with the rotation you could set self.yaw_speed to an really high number like 99999999

self.yaw_speed=99999999;

this way the yaw will be changed instantly.

and then specify the direction the pawn should be facing with self.ideal_yaw (it's in radians, you have to use the ConvertDegrees() command if you want to use degrees), like:

self.ideal_yaw=ConvertDegrees(180);
self.ideal_yaw=ConvertDegrees(90);

finally you have to change the yaw of the pawn:

ChangeYaw();

about the animation problem, it's quite complicated you might look at the sample scripts that came with rf and look how they solved it in genericplayer.s...

hope that helps :)

Posted: Tue Apr 17, 2007 9:18 pm
by Xemnas
Cool that worked quite well! Thank you very much! :)

Edit: Alright here's what I have so far:

Code: Select all

{ 

WALK [Walk] // define the walking animation in a variable 
IDLE [Idle] // define the walking animation in a variable 
MOVESPEED [100] // define the speed of this Pawn in a variable 

Spawn[ () 
{ 
Console(true); //enable console for debugging 
LowLevel("setup"); // Go to low level 
} ] 

setup[ () 
{ 
self.ThinkTime = 0.1; 

PlayerRender(false); // Don't render the built-in player 
AttachCamera(); // attach the camera to this entity 

self.yaw_speed = 99999999; // Rotate VERY fast 

AnimateHold(IDLE); 

self.think = "loop"; // Start executing order called "loop" 
} ] 

loop[ () 
{ 
self.ThinkTime = 0; // execute this order every frame 

if(IsKeyDown(15)) // Check if key number 15 is pressed 
{ 
self.ideal_yaw=ConvertDegrees(0);

ChangeYaw();

walkmove(self.current_yaw,MOVESPEED); // move forward 

if(self.animate_at_end) // check if the current animation is finished before starting a new one 
{ 
AnimateHold(WALK); // play the walking animation 
} 
} 

if(IsKeyDown(27)) // Check if key number 27 is pressed 
{ 
self.ideal_yaw=ConvertDegrees(180);

ChangeYaw();

walkmove(self.current_yaw,MOVESPEED); // move down

if(self.animate_at_end) // check if the current animation is finished before starting a new one 
{ 
AnimateHold(WALK); // play the walking animation 
} 
} 

if(IsKeyDown(26)) // Check if key number 26 is pressed 
{ 
self.ideal_yaw=ConvertDegrees(270);

ChangeYaw();

walkmove(self.current_yaw,MOVESPEED); // move left 

if(self.animate_at_end) // check if the current animation is finished before starting a new one 
{ 
AnimateHold(WALK); // play the walking animation 
} 
} 

if(IsKeyDown(28)) // Check if key number 28 is pressed 
{ 
self.ideal_yaw=ConvertDegrees(90);

ChangeYaw();

walkmove(self.current_yaw,MOVESPEED); // move right

if(self.animate_at_end) // check if the current animation is finished before starting a new one 
{ 
AnimateHold(WALK); // play the walking animation 
} 
} 

else // if the key is not pressed... 
{ 
if(self.animate_at_end) // play idle animation, if it is at end 
{ 
AnimateHold(IDLE); 
} 
} 
} ] 

}
The pawn only moves in 4 directions as of right now, but I'm attempting to script it into 8 I'll post that when I finish!
Thanks to everyone who's helped with this so far! :D

Posted: Fri Apr 20, 2007 12:31 am
by Xemnas
:oops: Yeah I got nothing perhapse some one with more scripting experience ought to be doing this.

:cry: Sorry.