Page 1 of 1

Scripting idea for triggers

Posted: Sun Oct 12, 2003 7:07 pm
by Dirk Cutlass
Don't know if anyone has thought of or done this already, but it occured to me that you could make a "directional trigger" (i.e. to tell which direction a player/party was walking in when they triggered the trigger.

Place 2 triggers directly adjacent to each other somewhere where they will get stepped on, e.g. a corridor. Let's say the corridor runs East-West. The 2 triggers will be next to each other one slightly to the East of the other.

Using a simple script to set flag when the triggers are stepped on, it is possible to know which trigger was stepped on first, and therefore tell which direction the player/party is moving in (.e. Eastwards or Westwards)

This could be used, for example, to make an encounter always spawn ahead of the party (whichever way they were walking), or behind, or whatever. If used at the entrance to a room or sub-area, it could be used to do different things depending on whether the player/party was entering or leaving ... etc.

Just a thought.

Posted: Sun Oct 12, 2003 7:44 pm
by Aloro
Errr... much easier would be to add something to the trigger's OnEnter that simply uses GetFacing on the PC entering it. If the trigger is in a confined space like a hallway, and fills the hallway, then you can only enter it from two sides. You can do something like

Code: Select all

void main()
{
    float fFacing = GetFacing(GetEnteringObject());
    if ((fFacing>=45.0) && (fFacing<=135.0))
    {
        // facing roughly North
    }
}
Note that this can't be used with normal encounters as you described, because you can't dynamically place spawn points. More's the pity.

- Aloro

Posted: Sun Oct 12, 2003 7:54 pm
by Alexandru Stanicu
but using the same script to get the facing you could spawn monsters a ta given WP based on facing...

Posted: Sun Oct 12, 2003 8:07 pm
by Aloro
Sure, you could manually spawn creatures, no problem. But you can't use a "normal" encounter, because those only use preplaced spawn points. The downside to manually spawning creatures is that you don't get the time-saving benefit of using the NWN encounter system - i.e. creaures are placed from a list, according to CR and encounter difficulty, single-use or repeating, etc. It is surely possible to do all of this manually, but it's also a LOT more work.

- Aloro

Posted: Sun Oct 12, 2003 10:02 pm
by JollyOrc
can't you just create two encounters, same stats, but different spawn points, and then trigger the one or the other, depending on facing ?

Posted: Wed Nov 05, 2003 2:29 pm
by scorilo
If I understand your post correctly, then it might be easier to create one encounter with two or more spawn points; as far as I know the creatures will always be created on the further spawn point from the player entering the encounter.