Page 1 of 1

Camera Scripted Player

Posted: Wed Mar 19, 2008 5:17 pm
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?

Re: Camera Scripted Player

Posted: Thu Mar 20, 2008 1:42 am
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.

Re: Camera Scripted Player

Posted: Thu Mar 20, 2008 1:56 pm
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?

Re: Camera Scripted Player

Posted: Thu Mar 20, 2008 5:48 pm
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?

Re: Camera Scripted Player

Posted: Thu Mar 20, 2008 11:08 pm
by darksmaster923
has to have quotes. like so
PositionToPawn("jugador",15,0,-15);

Re: Camera Scripted Player

Posted: Thu Mar 20, 2008 11:14 pm
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

Re: Camera Scripted Player

Posted: Fri Mar 21, 2008 9:38 pm
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

Re: Camera Scripted Player

Posted: Fri Mar 21, 2008 9:53 pm
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();
}]

}

Re: Camera Scripted Player

Posted: Sat Mar 22, 2008 12:16 am
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.

Re: Camera Scripted Player

Posted: Sat Mar 22, 2008 4:15 pm
by QuestOfDreams
The start order of a script is always a high level order.