Page 1 of 1

Keyboard and Triggers

Posted: Thu Dec 20, 2012 7:53 pm
by wabogenadod
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

Re: Keyboard and Triggers

Posted: Fri Dec 21, 2012 10:00 am
by QuestOfDreams
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).

Re: Keyboard and Triggers

Posted: Fri Dec 21, 2012 1:47 pm
by wabogenadod
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)

Re: Keyboard and Triggers

Posted: Fri Dec 21, 2012 2:53 pm
by QuestOfDreams
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);
      }
    }
  }]
}

Re: Keyboard and Triggers

Posted: Fri Dec 21, 2012 3:51 pm
by wabogenadod
What needs to go in the entity attributes if the script is called levelcontroller(door)?

Re: Keyboard and Triggers

Posted: Sun Dec 23, 2012 1:41 pm
by wabogenadod
Why is it that the levelcontroller is crashing my game when i have entered all of the attributes correctly?

Re: Keyboard and Triggers

Posted: Mon Dec 24, 2012 12:17 pm
by QuestOfDreams
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.

Re: Keyboard and Triggers

Posted: Tue Jan 29, 2013 9:19 am
by Veleran
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" .