OnPlayerTarget

From NWN Lexicon
Jump to: navigation, search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

The script attached to this event fires when EnterTargetingMode is activated.

Trigger

When EnterTargetingMode is used and the player selects a valid target.

Function(s)

Remarks

Note: Currently you must use SetEventScript(GetModule(), EVENT_SCRIPT_MODULE_ON_PLAYER_TARGET, "script_name"). You cannot set this in the module properties yet.

There is no default script for this event, and therefore the default behaviour for this event is to do nothing at all.

Once set however and EnterTargetingMode is called the player can target an appropriate thing or location. The player can exit from the targeting mode so it is not guaranteed to fire.

This then can do something related to what occured; some ideas:

  • Conversation option to "pick an item to upgrade" allows the player to open the inventory next to the conversation, and select an item from it
  • A speakstring (hidden/whispered) of a player is captured, and causes this event to fire, eg; to have a visual effect appear at the chosen location
  • Another event, such as using an item or spell (eg; "Use Item (On Self)"), activates this to target the effects of said item

To do multi-select, or once a target is checked and is invalid, you could easily have this event call EnterTargetingMode again meaning it fires again.

Known Bugs

Version

1.80.8193.14

Example

See Also

functions:

EnterTargetingMode GetLastPlayerToSelectTarget GetTargetingModeSelectedPosition GetTargetingModeSelectedObject