Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

NPC

AI Activities

Note

These activities can be chosen on any npc_route or npc_zone.

 

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.

Note

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 Event Variables

In the NPC Event Actions section you'll find several actions which harness variables. In Ryzom Core there are two types of variables accessible through NPC Events: local and foreign. Local and Foreign variables are essentially the same thing with some differences in how they are retrieved or referred to in event actions.

Variables

Variables are members of the current group (npc_group) and are expressed with a 'v' followed by the variable id (0-3). Example : v0. Variables are useful for functionality such as global state in an event, coordinating actions across multiple events, etc. They're used because the variables declared within a code block do not exist outside of that code block's execution.

Info

All variables are floating point variables.

 

Foreign Variables

Foreign variables are variables which come from another npc_group. If you have multiple groups of NPCs coordinating their actions this is a convenient way to share state and other data between the two groups.

They are expressed with the group name followed by a colon ':' then followed by a local variable identifier (v). Example: group_1:v2.

Warning

When attempting to access a foreign variable that variable's npc_group name must be globally unique.

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:

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:

Image Removed
AI Script Rep Container in World Editor

Image Removed
AI Script Window for Script Rep