Keyboard and Triggers

Post topics regarding Level Building/Design and Entity Usage with Reality Factory
Post Reply
wabogenadod
Posts: 18
Joined: Mon Dec 17, 2012 9:59 pm

Keyboard and Triggers

Post by wabogenadod » Thu Dec 20, 2012 7:53 pm

Is it possible for a trigger to wait for a key to be pressed or a varriable to be above a certain point and then trigger?
Also, is it possible to have a door that can reduce a variable when activated. Are you able to tell me how this is possible.
Thanks

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Keyboard and Triggers

Post by QuestOfDreams » Fri Dec 21, 2012 10:00 am

wabogenadod wrote:Is it possible for a trigger to wait for a key to be pressed or a varriable to be above a certain point and then trigger?
Best option would be to use a LevelController entity and script the desired behaviour.
wabogenadod wrote:Also, is it possible to have a door that can reduce a variable when activated.
Depends on the details. If, for example, the door is activated by a trigger you may use the same trigger to activate a ModifyAttribute entity (a player attribute can be regarded as a variable).

wabogenadod
Posts: 18
Joined: Mon Dec 17, 2012 9:59 pm

Re: Keyboard and Triggers

Post by wabogenadod » Fri Dec 21, 2012 1:47 pm

Does a LevelController act like a trigger?
Would this work?

"
{
K_OpenDoor = [16]

Setup[()
{
LowLevel("RunPlayer");
}]

RunPlayer[()
{
If(IsKeyDown(K_OpenDoor))
{
If(GetAttribute("points", "Player") > 75)
{
ModifyAttribute("points", -75, "Player")
How would you trigger door??????????????????????????????????????????????????
}
}
}]

}


(The main problem is that i don't understand how to use it to trigger models or entities)

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Keyboard and Triggers

Post by QuestOfDreams » Fri Dec 21, 2012 2:53 pm

The LevelController itself is not a trigger but provides a way to control triggers, doors, platforms, globals script flags, ...
LevelController scripts have their own set of script methods (many of them are similar to the pawn script methods) and are purely low level.

Code: Select all

{
  K_OpenDoor = [16]

  CheckKeyPress[()
  {
    if(IsKeyDown(K_OpenDoor))
    {
      if(GetAttribute("points", "Player") > 75)
      {
        ModifyAttribute("points", -75, "Player");

        // activates the specified Trigger entity
        ActivateTrigger("DoorTriggerEntity");
        // or
        // activates the specified Trigger (no Trigger entity required)
        SetEventState("DoorTrigger", true);
        // or
        // directly activates the door "Door" and makes it run to the given animation time 2.0
        SetDoorTargetTime("Door", 2.0);
      }
    }
  }]
}

wabogenadod
Posts: 18
Joined: Mon Dec 17, 2012 9:59 pm

Re: Keyboard and Triggers

Post by wabogenadod » Fri Dec 21, 2012 3:51 pm

What needs to go in the entity attributes if the script is called levelcontroller(door)?

wabogenadod
Posts: 18
Joined: Mon Dec 17, 2012 9:59 pm

Re: Keyboard and Triggers

Post by wabogenadod » Sun Dec 23, 2012 1:41 pm

Why is it that the levelcontroller is crashing my game when i have entered all of the attributes correctly?

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Keyboard and Triggers

Post by QuestOfDreams » Mon Dec 24, 2012 12:17 pm

wabogenadod wrote:What needs to go in the entity attributes if the script is called levelcontroller(door)?
You should not use parentheses in file names (or other identifiers). Stick to alphanumeric characters and underscores.
wabogenadod wrote:Why is it that the levelcontroller is crashing my game when i have entered all of the attributes correctly?
You need to provide more information, i.e. entity parameters, script, RealityFactory.log file.

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Keyboard and Triggers

Post by Veleran » Tue Jan 29, 2013 9:19 am

Did you use console (true) to watch messages for during which part it stops,if the script is that crashes it,or checked other simple details like: in the triggername entry where you have to write the word "programmed" .

Post Reply