Player pawn

Topics regarding Scripting with Reality Factory
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Player pawn

Post by Sph!nx »

Right, I need a little help with this. I've tried to search about putting in your own player character. I know, its hard for a total noob for me, but I really do want to start off with a player pawn.

I know it's a little more than adding a basic pawn, I know how to do that, although still learning to add its actions. All I need to know is how to add my own character, simple, without actions but just as a basic spawn so I can experiment with adding animations and actions.

Please, help! Perhaps someone has an example for me?

Thanks in advanced!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

I don't need a full explanation, just a hint or a small example so I know the general direction of how to set this up.

I've build a small test map and a character model:

Image


I've made two animations. A simple Idle animation and my first walking animation! Pretty good for a first one I think!

Image
(The glitch is not in my animation, but its the end of the animated .gif)

My plan is to make this dude into a player pawn with the most basic actions. Just idling and walking for now and then later add actions and fill the game world. I know, this might not be the easiest thing to start scripting, but I really want to build this up, starting with the player pawn.

I'd be very grateful If anyone can help me! Thanks!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Not even a hint? I really need this continue!

I'm starting to feel a bit embarrased here.. I get the feeling I have overlooked something pretty obvious...
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Player pawn

Post by Danimita92 »

I edited genericplayer.s and gave my scripted pawn to the spanish community:
http://rf-espanol.foroactivo.com/tutori ... o-t612.htm
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Thanks a lot! I can really use this for my own script! What I really needed to know is how I can set-it so, the game starts with my new player.

You prolly explained that in your thread, but I'm afraid I can't speak Spanish...

This is probably quite simple and I must have overlooked it in the documentation (several times) so if anyone can point me in the right direction, it would be much appreciated!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Player pawn

Post by Danimita92 »

The script automatically takes the original player away and attachs the camera onto this player. The only thing you'd have to do is set it up onto your level with a Pawn entity and modify it like this:

PawnType = Go to Pawn.ini and add one.

for example, if you make one like this:

[Jugador]
actorname = Danimita.act
actorrotation = 0 180 0
actorscale = 0.5
fillcolor = 255 255 255
ambientcolor = 255 255 255
subjecttogravity = true
boundingboxanimation = Idle
shadowsize = 30

you'd have to put
PawnType = Jugador (Exactly the same as the one in Pawn.ini with the same capital letters and everything)

ScriptName = The name with which you saved the script. For example, ScriptedPlayer.s
(WARNING: The .s at the end is very important)
SpawnOrder = Spawn

BTW: At the beginning of the script there's all the animations the pawn needs, and near the end there's also animations like AirRun and AirRunLeft... you need to modify from there, not from the top.
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Thanks m8! You've been a real help! Still making some animations and then Im ready to implement it. Thanks again!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Wow, I find this scripting very hard to understand. Well, I've got the character setup and idling in game. Now, I do know how to change the size in the .ini but I want to do it in the script. Here is the script I have :

Code: Select all

{
   Spawn[()
   {
		Console(true);
		Scale(1.4);
		PlayAnimation("anim_idle", true, "");
		RestartOrder();
   }]
} 
He plays his idle animation but the size is not correct. Do I have the command right?

As you can see in a previous post, I've made a walk animation. For this I need to add two more things and don't know where to start to implement it. I need to give it an option so that a key (w) is pressed, the character plays the animation and moves forward and I need to make the camera be connected to my new player pawn.

Any help with this? Thanks!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: Player pawn

Post by bernie »

Try
SetScale(1.4);
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Thanks m8. I replaced "Scale(1.4);" with "SetScale(1.4);" but nothing has changed...

Code: Select all

{
   Spawn[()
   {
		Console(true);
		SetScale(1.4);
		PlayAnimation("anim_idle", true, "");
		RestartOrder();
   }]
} 
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

I've tried doing it another way, looking at the perfect AI script :

Code: Select all

{
	
	SCALE			[1.4]
	
	Spawn[()
   {
		Console(true);
		Scale(SCALE);
		PlayAnimation("anim_idle", true, "");
		RestartOrder();
   }]
} 
Still no effect :(

Been trying different approaches to learn how to script for months now, but it still gives me a brain cramp ... Beginning to think this is not really my thing... :(
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: Player pawn

Post by bernie »

Well this is the way I did it to shrink the bat in Talisman
I set these variables:
SCALE [0.85]
SHRINKTIME [26]

I set the Scale in the spawn routine
Scale(0.85);
and called the Shrink routine at the appropriate time.
It worked for me.




Shrink[() // Scale down from mansize to batsize smoothly.
{
if(SHRINKTIME >0)
{
Delay("Idle",0.05,"");
SetScale(SCALE);
SCALE = SCALE -0.025;
SHRINKTIME = SHRINKTIME -1;
RestartOrder();
}
//BoxWidth (20);
BoxHeight(30);
AnimateStop("Idle-To_Takeoff",0,""); // Spread wings ready to fly.
AnimateStop("Takeoff-to-Fly",0,"");
AnimationSpeed(4);
PlayAnimation("Fly",true,"");
NewOrder("Patrol");

}]
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Lol, thanks, don't need to make it smaller but bigger by adding 0.4 (scale 1.4). Might simply do it in the .ini...

Scripting a player might be a bit hard to start of with I guess. I do want to learn this by scripting stuff from scratch for my own created content.

Any suggestions of simple scripts to start off with? (items, npc, game elements, etc.)
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Player pawn

Post by Sph!nx »

Yes! I managed to attach the camera to the new player pawn. I still see and I am still able to control the original player, though.

I've tried several things and I've tried to find the scripting command for it but I could not find how to do it. Anyone? Thanks!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Player pawn

Post by QuestOfDreams »

PlayerRender(bool Flag); (low level)
Post Reply