Control Issues

Topics regarding Scripting with Reality Factory
User avatar
Xemnas
Posts: 11
Joined: Thu Apr 12, 2007 4:05 am
Location: TX
Contact:

Post 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)
I Love Jesus!
(Notice: Contradictory Avatar)
Image
User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

Post 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
*GD*
User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Post by zany_001 »

Well i love Jesus too.
Once I was sad, and I stopped being sad and was awesome instead.
True story.
User avatar
Xemnas
Posts: 11
Joined: Thu Apr 12, 2007 4:05 am
Location: TX
Contact:

Post 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.
I Love Jesus!
(Notice: Contradictory Avatar)
Image
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post 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 :)
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
Xemnas
Posts: 11
Joined: Thu Apr 12, 2007 4:05 am
Location: TX
Contact:

Post 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
I Love Jesus!
(Notice: Contradictory Avatar)
Image
User avatar
Xemnas
Posts: 11
Joined: Thu Apr 12, 2007 4:05 am
Location: TX
Contact:

Post by Xemnas »

:oops: Yeah I got nothing perhapse some one with more scripting experience ought to be doing this.

:cry: Sorry.
I Love Jesus!
(Notice: Contradictory Avatar)
Image
Post Reply