Scripting idea for triggers

Moderator: Event DM

Post Reply
User avatar
Dirk Cutlass
Elder Sage
Posts: 4691
Joined: Mon Jan 27, 2003 9:42 am
Location: GMT

Scripting idea for triggers

Post by Dirk Cutlass » Sun Oct 12, 2003 7:07 pm

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.
User avatar
Aloro
Team Member; Retired with Honors
Posts: 12805
Joined: Sat Dec 28, 2002 5:11 am
Location: Rainbow's End
Contact:

Post by Aloro » Sun Oct 12, 2003 7:44 pm

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
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.
User avatar
Alexandru Stanicu
Legacy DM
Legacy DM
Posts: 14074
Joined: Sun Oct 20, 2002 10:59 pm
Timezone: CST
DM Avatar: The Hammer
Location: Texas

Post by Alexandru Stanicu » Sun Oct 12, 2003 7:54 pm

but using the same script to get the facing you could spawn monsters a ta given WP based on facing...
I ain't as good as I once was, But I'm as good once as I ever was...


:devil: 4evar!
User avatar
Aloro
Team Member; Retired with Honors
Posts: 12805
Joined: Sat Dec 28, 2002 5:11 am
Location: Rainbow's End
Contact:

Post by Aloro » Sun Oct 12, 2003 8:07 pm

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
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.
User avatar
JollyOrc
Elder Sage
Posts: 3984
Joined: Fri Jan 17, 2003 11:41 am
Timezone: Europe, CE(S)T
Location: Germany
Contact:

Post by JollyOrc » Sun Oct 12, 2003 10:02 pm

can't you just create two encounters, same stats, but different spawn points, and then trigger the one or the other, depending on facing ?
scorilo
Newbie
Posts: 1
Joined: Wed Nov 05, 2003 2:21 pm

Post by scorilo » Wed Nov 05, 2003 2:29 pm

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.
Post Reply