Difference between revisions of "OnPlayerTarget"
m (remove TOC)
|Line 4:||Line 4:|
When [[EnterTargetingMode]] is used and the player selects a
When [[EnterTargetingMode]] is used and the player selects a target .
Revision as of 06:19, 11 February 2021
The script attached to this event fires when EnterTargetingMode is activated.
When EnterTargetingMode is used and the player either selects a target or manually exits targeting mode.
- GetLastPlayerToSelectTarget - The player that has targeted something
- GetTargetingModeSelectedPosition - The vector in the current area targeted by the player
- GetTargetingModeSelectedObject - The object targeted by the player
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.