Scripting idea for triggers
Moderator: Event DM
- Dirk Cutlass
- Elder Sage
- Posts: 4691
- Joined: Mon Jan 27, 2003 9:42 am
- Location: GMT
Scripting idea for triggers
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.
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.
- Aloro
- Team Member; Retired with Honors
- Posts: 12805
- Joined: Sat Dec 28, 2002 5:11 am
- Location: Rainbow's End
- Contact:
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
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
Code: Select all
void main()
{
float fFacing = GetFacing(GetEnteringObject());
if ((fFacing>=45.0) && (fFacing<=135.0))
{
// facing roughly North
}
}
- Aloro
Aleksandr Solzhenitsyn wrote:The meaning of earthly existence lies, not as we have grown used to thinking, in prosperity, but in the development of the soul.
- Alexandru Stanicu
- Legacy DM
- Posts: 14074
- Joined: Sun Oct 20, 2002 10:59 pm
- Timezone: CST
- DM Avatar: The Hammer
- Location: Texas
- Aloro
- Team Member; Retired with Honors
- Posts: 12805
- Joined: Sat Dec 28, 2002 5:11 am
- Location: Rainbow's End
- Contact:
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
- Aloro
Aleksandr Solzhenitsyn wrote:The meaning of earthly existence lies, not as we have grown used to thinking, in prosperity, but in the development of the soul.