Page 2 of 2
Re: Player pawn
Posted: Sun Jul 06, 2008 1:03 pm
by Sph!nx
Many thanks!
It works, but not completely. When the game first loads I still start with the old player and after a few seconds I can behond the new pawn. Also, the 'old' player model is not rendered, its still there. I can still see the gun, hear him walk and control his movements.
Is there something to be done it an .ini or something?
Here's my script so far :
Code: Select all
{
Spawn[()
{
Console(true);
PlayAnimation("anim_idle", true, "");
LowLevel("Setup");
}]
Setup[()
{
AttachCamera();
PlayerRender(false);
}]
}
Re: Player pawn
Posted: Sun Jul 06, 2008 1:33 pm
by QuestOfDreams
When the game first loads I still start with the old player and after a few seconds I can behond the new pawn.
Now look at your script again and think what you're doing: You're playing an animation of your pawn and only then you're hiding the default player.
Also, the 'old' player model is not rendered, its still there. I can still see the gun, hear him walk and control his movements. Is there something to be done it an .ini or something?
Now ask yourself: Why do I see the gun?
Because the default player owns one.
How did the default player get the gun?
We gave it to him by specifying it in the player's attribute file.
What can we do about it?
Don't give the default player a gun. Be mean and take it away from him. (hint: initial = 0)
Ask yourself similar questions about the sound. (hint: environment.ini, playersetup.ini)
Re: Player pawn
Posted: Sun Jul 06, 2008 1:57 pm
by Sph!nx
Excellent! Thanks a lot! Your explanation gave me a whole other view on how to really look at this stuff!
Everything works so far now! My next objective is to be able to look around and walk forward by pressing the 'W' key.
I think I understand a little more now how to approach the script and how to implement it but I'm sure I will bug you guys some more

Re: Player pawn
Posted: Sun Jul 06, 2008 2:48 pm
by Sph!nx
I was a bit premature I think. The example Dinamita gave me is still quite complex for me.
I could spam this thread with more questions but a clear example would work better so I have a little request. Does someone have a very basic script for me (with perhaps some extra info in comments "//")?
If someone could write one for me I don't need much, simply look around (mouse) and walk forward by pressing the "w" key and playing the animation "anim_walk".
This is what I have so far :
Code: Select all
{
Spawn[()
{
Console(true);
LowLevel("Setup");
PlayAnimation("anim_idle", true, "");
}]
Setup[()
{
AttachCamera();
PlayerRender(false);
self.think = "controls";
} ]
controls[ ()
{
MouseControlledPlayer(true);
} ]
}
If I would have such simple script as an example it might be easier for me to understand. From here, I will be implementing more options on my own but I really need this ... can anyone help me? Thanks!
Re: Player pawn
Posted: Sun Jul 06, 2008 6:06 pm
by Danimita92
Well I can't provide you with one but I will help you with this script. First of all, take away the mousecontrolledplayer true, and instead put:
self.ideal_yaw=self.player_yaw;
This makes the scripted player's angles the same as the players, and the player's angles are the ones the camera is aiming at. Meaning it'll act like a real player, or at least rotation-wise.
Re: Player pawn
Posted: Sun Jul 06, 2008 6:30 pm
by Jay
I think the best thing is to let him evolute it a bit more, this way he learns the most.
I would leave the MouseControlledPlayer(true), because this is what ensures that the players angles are determined by the mouse.
The self.ideal_yaw=self.player_yaw is a design desicion. It could be that he wants to have an all-around view of the player without changing its direction (This would leave the camera attached to the player though and the player would be moved to fit the pawn's position). Or that he wants to make a rotating system which uses the keyboard...
Re: Player pawn
Posted: Sun Jul 06, 2008 10:25 pm
by Danimita92
But the player is controlled by default with the mouse, right? Anyway, I'd stick with the basic rotation at first, and then if you want to do things like what I did in my project "Survivor Chronicles: The Island":
http://youtube.com/watch?v=aAHElfNIkuk
Then you could change it later on, once you're a little more used to scripting.
Re: Player pawn
Posted: Mon Jul 07, 2008 4:04 pm
by Sph!nx
Thanks a lot so far guys!
Still don't know how to approach the movement and controls so I might base my first game on the game play reality factory standard offers. Like the original player will be remodeled, but will use the same skeleton, animations and code.
Then I will script in my own little features. I guess starting of with a player is a bit to advanced scripting to start with.
Now I just need some great concept ideas...
Re: Player pawn
Posted: Mon Jul 07, 2008 8:04 pm
by Juutis
Moving the pawn forward when 'W' is pressed:
walkmove(float YawAngle, float Distance );
Move the pawn at a speed of Distance texels per second in the direction specified by YawAngle. If the move was successful the function will return true.
bool IsKeyDown(int Key# );
Returns true or false if the specified key number Key# is being pressed. Use the self.key_pressed script to display the mapping of the keyboard.
Animate(char *Animation );
Set the Pawn actor's current animation to Animation.
When we put this stuff together we get:
Code: Select all
if(IsKeyDown(15))
{
Animate(<YOUR WALK ANIMATION>);
walkmove(self.current_yaw,<YOUR WALKING SPEED>);
}
(self.current_yaw is the direction the pawn is facing and putting it in the walkmove command will move the pawn to that direction)
Re: Player pawn
Posted: Mon Jul 07, 2008 11:14 pm
by Sph!nx
Excellent! Thanks a lot, m8! Will try to implement this! Also gonna try to do the mouse look from the hints I got from Dinamita and Jay.
Really guys, I'm very grateful for your help so far!

Re: Player pawn
Posted: Fri Jul 25, 2008 3:11 pm
by Graywolf
Just my little comment on this... When doing a scripted player, it's best to stay in low-level, unless you absolutely have to use something in high-level. Also, while it's not heavily commented, there is a very good example(Dan Valeo's work, if I remember correctly) in the scripts/sample folder. It accomplishes your objectives, and more.