Camera Scripted Player

Topics regarding Scripting with Reality Factory
Post Reply
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Camera Scripted Player

Post by Danimita92 »

Hi, I've decided to make a scripted player, and I want to know how to make a camera in a third person view. Also, I'd like to know how I could create a sort of "Shoulder View" making it so the player's actor is to the left of the screen, instead of in the middle.
Also, could I create a ViewSwitch to a First Person view if a key is pressed, using the scripted player's weapon?
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: Camera Scripted Player

Post by darksmaster923 »

yep! first you need two/three pawns, a camera and player and/or a weapon pawn. the camera pawn is necessary for the flexibility of the camera. attach the camera to the camera pawn and set it near the player pawn with PositionToPawn command and adding in your offsets. and for the weapon, there are several ways to do that. you could set a trigger with GetEventState and then you could make the player pawn hide with PawnRender(false); and moving the weapon pawn near the camera. Or you could use the player pawn as the weapon pawn too, if you make the fps arms and weapons attached to the player and you just set the camera near the players head.
Herp derp.
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Camera Scripted Player

Post by Danimita92 »

Thanks, I just have one more question:
Could the weapon only be seen if you turn to the first person view? Like hide the weapon and when the trigger is activated, hide the player and show the weapon?
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Camera Scripted Player

Post by Danimita92 »

Okay I need help with this. I created another pawn which i intended to be the camera pawn, and wrote this:

Code: Select all

{
    
Spawn[()
{
    Console(true);
    PositionToPawn(jugador,15,0,-15);
    AttachCamera();
}]
}
But I'm not even getting a console. In the world editor i set (in the players Pawn entity) the szEntityName to jugador. What am I doing wrong?
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: Camera Scripted Player

Post by darksmaster923 »

has to have quotes. like so
PositionToPawn("jugador",15,0,-15);
Herp derp.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: Camera Scripted Player

Post by darksmaster923 »

Danimita92 wrote:Thanks, I just have one more question:
Could the weapon only be seen if you turn to the first person view? Like hide the weapon and when the trigger is activated, hide the player and show the weapon?
yeah, i thought i explain some designs on it in my first post
Herp derp.
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Camera Scripted Player

Post by Danimita92 »

Okay I'll figure out how to do it how I want, but first I need more help. I put the "" and now the script works (the console comes up) But... this is what it says:

scripts/camar.s:Spawn:1-Method PositionToPawn not found*

I remind you how the level is set up. The three famous entities, and two Pawns.
Pawn 1:
Pawn Type: jugador
ScriptName: jugador.s
SpawnOrder: Spawn
szEntityName: jugador

Pawn 2:
Pawn Type: camara
ScriptName: camara.s
SpawnOrder: Spawn
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: Camera Scripted Player

Post by bernie »

PositionToPawn(...) and AttachCamera() are LOW LEVEL COMMANDS.
You need to switch to Low Level.

{

Spawn[()
{
Console(true);
LowLevel("Init");
}]

Init[()
{
PositionToPawn("jugador",15,0,-15);
AttachCamera();
}]

}
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Camera Scripted Player

Post by Danimita92 »

Jesus I can't believe I made such a silly mistake. I didn't realize Console was High Level.
Thank you so much, darksmaster923 and bernie. Works fine.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Camera Scripted Player

Post by QuestOfDreams »

The start order of a script is always a high level order.
Post Reply