on_detection(func_name, name)

Parameters:
func_name (string) name of the function, or "" to unregister the event
name (string) name of the NPC
 
Returns:
none

Description:
Register a callback function for when an NPC detects the player.

When the callback is executed, the following parameters are passed to it:
 - (string) name of the NPC
 - (string) name of the player that was detected

Once the callback has been executed, the detection event is disabled. If the NPC loses track of the player then subsequently re-detects the player, the detection event will not trigger again. You can use the npc_detection_enable function to re-enable the event.

Note that calling this script action automatically enables "on detection" events for the NPC, even if they were previously disabled.

 

back to indexSR3 Script Action Documentation
Last updated: Tue, 09 Aug 2011 11:32:15