![]() |
![]() |
|||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Using Creature Events Intended Audience: [Printer Friendly / Syntax Highlight] As mentioned previously in the 'UserDefinedEvents Are Your Friend' post, unless you know exactly what you are doing, it is not advisable to mess with the default AI scripts that are used on creatures (except for the OnSpawn script, which is what it's there for). It is perfectly possible to make use of every event listed below by uncommenting the associated flag in the OnSpawn script and writing an OnUserDefined script to make use of the associated event number (all the examples below will be OnUserDefined scripts doing so). Creature Event Listing Event: OnPerception, triggered by: something has entered the creature's perception radius. This does not automatically mean that the creature sees or hears this thing... just that it is possible for him to perceive it. what triggered it? Use GetLastPerceived() to return the last perceived creature (whether it was actually seen or not). Example: I want my human NPC to turn towards anyone he sees, and if they are female to bow to them. Event: OnSpellCastAt, triggered by: a spell has been cast at the creature... note that spells don't intrinsically cause this event. You will see in your command list a 'EventSpellCastAt'. The spell scripts specifically use this command on their target to tell it a spell has been cast... and the command also tells them whether or not the spell is a hostile one. what triggered it? Use GetLastSpell() to return the constant of the spell used (SPELL_*). Event: OnPhysicalAttacked, triggered by: the creature has been attacked in melee, what triggered it? Use GetLastAttacker(). Also used here(i): GetLastDamager() Event: OnDamaged, triggered by: creature has lost hit points, what triggered it? Use GetLastDamager(). Example: with this particular creature, if he loses more than half his hit points he will shout out something, run to a waypoint called "CAVE_EXIT" and disappear. Event: OnDisturbed, trigger: something has either been added to or removed from the creature's inventory, what triggered it? Use GetLastDisturbed() to return the creature object who disturbed the inventory. Event: OnCombatRoundEnd, triggered by: a combat round has ended and this event is triggered automatically. What does the default AI script do? Unless there is a special behavior set or the set warnings flag in OnSpawn has been set, a new combat round is initiated. Event: OnConversation, triggered by: the creature has been clicked on for conversation OR someone has audibly spoken, what triggered it? Use GetLastSpeaker() to return the creature who clicked on them or spoke out loud. Event: OnRested, triggered by: the creature has rested via ActionRest(). Creatures in the game don't normally rest, so there is no default AI script functions here. Event: OnDeath, triggered by: the creature has been killed, what triggered it? use GetLastKiller() to return the object that killed the creature. Note that any scripts that are run off this event need to be immediate... using DelayCommand will not work as the creature cannot run commands past the point of its death. Event: OnBlocked, triggered by: a door is blocking the creature's movement, what triggered it? Use GetBlockingDoor() to return the door object. Note that only doors currently trigger the OnBlocked event... this is not used for collision detection (yet). Event: OnHeartbeat, triggered by: there is no trigger neeaded for the heartbeat... any script in this area will be run automatically once every six seconds. It is important that you do not attach scripts to the heartbeat which will run constantly, as the resulting overhead (especially if you have a lot of creatures doing so) can be high.
|
|||||||||||||||||||||||
|
|
||
|
Multiplayer Games at Neverwinter Connections
|
||
|
Download Modules
|
||
|
5,048,030 usuarios de BioWare:
|
||