Security cameras

Post topics regarding Level Building/Design and Entity Usage with Reality Factory
Post Reply
User avatar
jamieo01
Posts: 81
Joined: Fri Jan 16, 2009 2:14 pm
Location: England
Contact:

Security cameras

Post by jamieo01 » Tue Sep 15, 2009 3:29 pm

Hi, I am going to try to include the ability in my game to take control of cameras with a special gun so that you can see round corners to check for bad guys. Is this possible using just entitys if not how else could I do it. Thanks in advance

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Security cameras

Post by Juutis » Tue Sep 15, 2009 4:30 pm

Well, with a bit of scripting it's definitely possible:

Just add a pawn with this script:

Code: Select all

{
    
    ATTRIBUTE           [enemy_health]  //attribute that needs to be damaged for the camera to kick in
    TIMEON              [3]             //how many seconds the camera is active
    ABORTKEY            [46]            //the key that deactivates the camera instantly
                                        //46 is space
    timer               [0]
    initialview         [0]

Spawn[ ()
{
    Gravity(false);
    NewOrder("Init");
} ]

Init[ ()
{
    SetEventState(EntityName,false);
    AttributeOrder(ATTRIBUTE,1,"RunCamera");
    NewOrder("Wait");
} ]

Wait[ ()
{
} ]

RunCamera[ ()
{
    SetEventState(EntityName,true);
    timer = time + TIMEON;
    initialview = player_viewpoint;
    LowLevel("activate");
} ]

activate[ ()
{
    ThinkTime = 0;
    SwitchView(3);
    SetKeyPause(true);
    
    if((timer < time) or IsKeyDown(ABORTKEY))
    {
        SetKeyPause(false);
        SwitchView(initialview);
        HighLevel("Init");
        return;
    }
} ]

}
Give the pawn a name (szEntityName). This name will then be the trigger for a FixedCamera entity you're going to use to change the view. So add a FixedCamera entity and in the field ForceTrigger enter the name of the pawn.
Pain is only psychological.

User avatar
jamieo01
Posts: 81
Joined: Fri Jan 16, 2009 2:14 pm
Location: England
Contact:

Re: Security cameras

Post by jamieo01 » Wed Sep 16, 2009 10:44 pm

Cool i'll try it out tommrow. Thanks a lot juutis :D

Post Reply