NPC
NPC Event Handling
In Ryzom Core NPCs can be scripted through a sophisticated event/action system. The system works by declaring an event to listen for and then assigning an action to that event. There are approximately 62 events and 36 actions available at your disposal but some actions, such as the code action allow you to write your action handlers in advanced AI scripting which provides a nearly unlimited number of potential actions. Below we we detail the various events and actions available to you. You can define an event handler at either the npc_zone/npc_route level or at the npc_group level.
The "event" set_flags_on_dyn_zones erroneously appears as an event in World Editor and is in truth an unused, deprecated action. Do not use it.
NPC Events
AI Event All Pets Arrived From Stable (not implemented)
- AI Event All Pets Gone To Stable (not implemented)
- AI Event All Team NPCs Present (not implemented)
- AI Event All Team Players Present (not implemented)
- AI Event Bot Begin Fight
- AI Event Bot Killed (not implemented)
- AI Event Bot Target Killed
- AI Event Destination Reached
- AI Event Destination Reached All
- AI Event EGS Up
- AI Event End Of State
- AI Event Escort Away
- AI Event Escort Back
- AI Event Group Attack End
- AI Event Group Despawned
- AI Event Group Eliminated
- AI Event Group Under Attack
- AI Event Other Team Enters View (not implemented)
- AI Event Other Team Meets Team (not implemented)
- AI Event Outpost Attacker Changed(not in use)
- AI Event Outpost Guild Ownership Begin(not in use)
- AI Event Outpost Guild Ownership End(not in use)
- AI Event Outpost Owner Changed(not in use)
- AI Event Outpost Peace State Begin(not in use)
- AI Event Outpost Peace State End(not in use)
- AI Event Outpost State Changed(not in use)
- AI Event Outpost Tribe Ownership Begin(not in use)
- AI Event Outpost Tribe Ownership End(not in use)
- AI Event Player Follow NPC
- AI Event Player Request Pause (not implemented)
- AI Event Player Request Pause End (not implemented)
- AI Event Player Target NPC
- AI Event Punctual State Timeout
- AI Event Route Blocked (not implemented)
- AI Event Route Blocked End (not implemented)
- AI Event Start of State
- AI Event State Timeout
- AI Event Team Attacked (not implemented)
- AI Event Team Attacked End (not implemented)
- AI Event Team Member Badly Hurt (not implemented)
- AI Event Team Member Killed (not implemented)
- AI Event Team Member LD (not implemented)
- AI Event Team Member Logout (not implemented)
- AI Event Team Pack Animal Hurt (not implemented)
- AI Event Team Pack Animal Killed (not implemented)
- AI Event Timer Triggered
- AI Event User Event
- AI Event Variable Changed (not implemented)
AI Scripting
The Ryzom Core AI system has a sophisticated custom scripting language that is used for scripting the various group states.
Please see the AI Scripting Overview for more information.
You can also get thorough documentation by going to AI Scripting Native Functions Reference.
Here's an example of a simple code block:
(aggroSize)getAggorListSize(0); // to much player are attacking the boss if (aggoroSize > 10) { ($player1)getAggroListElement(0); ($player2)getAggroListElement(1); ($player3)getAggroListElement(2); // so the boss teleport 3 person from its aggro list at the end of the world teleportPlayer($player1, 14233, 123123, 0, 0); teleportPlayer($player2, 14233, 123123, 0, 0); teleportPlayer($player2, 14233, 123123, 0, 0); clearAggroList(); }
In addition to code segments within AI actions you can also create AI script templates in World Editor using the script_rep and script nodes. It looks a little like this:
AI Script Rep Container in World Editor
AI Script Window for Script Rep