BioWare Atari
BioWare Info BioWare Spiele Support Foren Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home

Using Placeable Object Events

Intended Audience: For Builders
By David Gaider

[Printer Friendly / Syntax Highlight]

Like with areas, the thing to remember when writing scripts for placeable objects is that when you using 'action'-type commands (commands that return void) the default performer is the placeable object, itself. If you want the script to tell something other than the placeable object to perform a command, you need to use the AssignCommand action.
Also keep in mind that while placeable objects are capable of performing some actions (such as ActionPlayAnimation with reference to ANIMATION_PLACEABLE_*... although not all placeables open/close or activate/deactivate), telling them to do things that are inherently impossible often causes problems (ActionLockObject, ActionUnlockObject, ActionEquipItem, ActionPickUpItem... these are examples of things you should never tell a placeable object to do).

Placeable Object Event Listing

Event: OnClose, trigger: the placeable has been close (not that only placeables that can be opened or closed will fire this... like a chest or armoire), what triggered it? use GetLastClosedBy() to return the object that closed the placeable.

Example: here is an OnClose script that checks to see if its inventory is empty after it's closed... and, if so, creates 100 gold inside.

NWScript:

Event: OnDamaged, trigger: the placeable object has taken damage, what triggered it? Use GetLastDamager() to return the object that damaged the placeable. Also used here: GetTotalDamageDealt(), GetDamageDealtByType (int nDamageType), GetCurrentHitPoints(), GetMaxHitPoints().

Event: OnDeath, trigger: the object has been destroyed (playing its 'destruction' animation is automatic), what triggered it? GetLastKiller() will return the object that destroyed the placeable.

Event: OnHeartbeat, trigger: there is no trigger for the heartbeat... any script in this location fires automatically once every six seconds. Be careful not to put scripts in this area that will run constantly, as the overhead can be high.

Event: OnDisturbed, trigger: an item has either been added to or removed from the placeable's inventory, what triggered it? Use GetInventoryDisturbType(). This results in one of these constants: INVENTORY_DISTURB_TYPE_ADDED, INVENTORY_DISTURB_TYPE_REMOVED, or INVENTORY_DISTURB_TYPE_STOLEN. Also used here: GetLastDisturbed() returns the object that removed/added the item, GetInventoryDisturbItem() returns the item that was added/removed.

example: here's an OnDisturbed script that sends a UserDefinedEvent #500 signal to a wizard (with the tag "WIZARD1") if anyone removes a particular potion (with the tag "PRECIOUS_POTION") from the placeable.

NWScript:

Event: OnLock, trigger: the placeable has been locked (or relocked), what triggered it? Use GetLastLocked() to return the object that locked the placeable. Also Used Here: GetLockLockDC() returns the DC for locking the placeable. **NOTE** I've had a few reports that this event may not be working.

Event: OnPhysicalAttacked, trigger: the placeable has been physically attacked (but not necessarily damaged), what triggered it? Use GetLastAttacker().

Event: OnOpen, trigger: the placeable object has been opened (for those placeable objects that can be opened and have their 'Has Inventory' box checked), what triggered it? Use GetLastOpenedBy().

Event: OnSpellCastAt, trigger: a spell has been cast at the placeable, what triggered it? Use GetLastSpellCaster(). Also used here: GetLastSpell() will return the constant of the spell used (SPELL_*), GetLastSpellHarmful() will return TRUE or FALSE depending on whether or not the last spell cast was marked hostile.

Event: OnUnlock, trigger: the placeable has been unlocked, what triggered it? Use GetLastUnlocked() to return the object that unlocked the placeable. **NOTE** I've had a few reports that this event may not be working.

Event: OnUsed, trigger: if a placeable object has its 'Useable' box checked, then clicking on the object sets off this event, what triggered it? Use GetLastUsedBy().

example: a script for a placeable object that heals whoever used it.

NWScript:

Event: OnUserDefined, trigger: this event will only occur if someone specifically uses SignalEvent to send a UserDefinedEvent to the placeable object.

 

 

Dragon Age: Origins Preorder
Neverwinter Nights 2 Forums
Anzeigen/Verbergen

English
Deutsch
Français
Español
Italiano

Anzeigen/Verbergen

Neueste Bildschirmfotos anzeigen 

Neueste Bildschirmfotos anzeigen
Anzeigen/Verbergen

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



Aktuelle Uhrzeit: (Zeit einstellen)
So, 22 November 2009 01:58

Anzeigen/Verbergen

Buy Premium Modules

Top NWN: HotU Modules:
1. Good vs Evil III
2. More...

Top NWN: SoU Modules:
1. Good vs Evil III
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

Anzeigen/Verbergen

5,049,448 BioWare-Benutzer:
  65 Eingeloggt
  5 Verborgen
  187 Gäste

1284 Playing Online
  100% NWN
  101% NWN: SoU
  102% NWN: HotU

447 Registered Guilds

8,768,542 Einträge in den Foren

Neueste Themen in den Foren:
1. Toolset work with Vista? (NWN2: Builders - NWN2 Toolset)

2. Vale of Merdelain (NWN2: Players - Storm of Zehir (Spoilers Warning))

3. Freezing at Specific character's... (Baldur's Gate II: SoA and ToB Technical Support)

4. Won't let me create new topic (Web Site Help)

5. BUILDERS - Showcase YOUR Talent! (NWN 1: Guilds and Registry - Ye Olde Tavern)