BioWare Atari
BioWare Info BioWare Games Support Forums Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home

Using Area Events

Intended Audience: For Builders
By David Gaider

[Printer Friendly / Syntax Highlight]

Keep in mind that when you create scripts for the area events (or, indeed, for the module events) that the default 'performer' of any action-related commands is the area, itself.

If you refer to OBJECT_SELF, you are referring to the area object. If you use an action-related command such as ActionMoveToObject without using AssignCommand to firs send that command to a creature object, you are telling the area to move (which it, of course, cannot). Simply keep this in mind as you code, so you can differentiate between telling the area what to do and telling things within the area what to do.

Area Events Listing

Event: OnEnter, triggered by: something (not necessarily a player character) has entered the area, what triggered it? Use GetEnteringObject() to return the object that has entered the area.

An example: Let's say you wanted to set an object variable called "PC_Entered" that was on the area whenever a player character entered the area (with the object being equal to the PC)... and then send a UserDefined event to a particular creature in the area with the unique tag "HUNTER" (I could then have an OnUserDefined event for that creature to come looking for the PC). You would place the following script in the OnEnter event for that area -

NWScript:

Event: OnExit, triggered by: someone has left the current area, what triggered it? Use GetExitingObject().

An example: Let's take the same script above and set the "PC_Entered" area-set variable to an invalid object if the PC leaves. Let's also check if the exiting object is the monster from above (chasing the PC, no doubt)... and if it is, tell him to return to his cave (where there is a waypoint laid down with the tag "HUNTER_CAVE") -

NWScript:

Event: OnHeartbeat, triggered by: Nothing is required to trigger the heartbeat... any script that is placed here will be automatically triggered once every 6 seconds. As with the module events, be careful of placing scripts in here that would run constantly.

Event: OnUserDefined, triggered by: This can only be triggered by someone using the SendSignal command to specifically send a UserDefined event to the area object (usually via the GetArea command or GetObjectByTag using the area's tag).

 

 

Sonic Chronicles: The Dark Brotherhood
Neverwinter Nights 2 Forums
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

View Latest Screenshots 

View Latest Screenshots
Hide/Show

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



Current time is: (set time)
Sat, 19 July 2008 07:17PM

Hide/Show

Buy Premium Modules

Top NWN: HotU Modules:
1. TORTURED HEARTS II.
2. More...

Top NWN: SoU Modules:
1. TORTURED HEARTS II.
2. More...

Top CEP Modules:
1. The Lord of Terror The Diablo Campa...
2. More...

Top Modules - NWVault:
1. Hall of Fame
2. More...

Total Modules: 4423

Hide/Show

4,052,294 BioWare Users:
  103 Logged In
  16 Hidden
  452 Guests

1858 Playing Online
  100% NWN
  101% NWN: SoU
  101% NWN: HotU

544 Registered Guilds

7,708,368 posts in forums

Newest Forum Topics:
1. Question about download content (Mass Effect PC Version General Discussion (Spoilers will be moved))

2. 1Up review and E3 screens (Dragon Age: Origins General Discussion)

3. Collision Boxes not showing ? (NWN2: Builders - NWN2 Toolset)

4. Name Generation in Character Cre... (NWN2: Custom Content)

5. Will Characters Leave? (Dragon Age: Origins General Discussion)