Main Page Modules Class Hierarchy Todo Compound List File List Related Pages

Le script d'AI

General information

Its a C like code.

Comments are defined after two slashes like this:

// my comment

Code is used to specify decisions for state machine on group. Each group can have different variables and functions, they can only be affected via code only.

Variables don't need to be defined before they are used. They are automatically created with value equals to 0 or "".

Variables are either floating point numbers (no prefix), character strings ('$' prefix) or script contexts ('@' prefix).

There are two special object that are hard-coded and that can be used to call function:

Additionnaly one can reference any static group defined in the same AI instance by its name. The usage is similar to that of 'parent' and 'caller'. In fact 'parent', 'caller' and group names are a kind of pseudo-contexts and can be used as such (without the '@' prefix).

Debug and log

There are two special function for debug and logging:

Syntax:

print("foo");
log("bar");

NB: you can put any number of const string (e.g. "toto") and var (float or $string) separated by coma. All the string representation are concatenated to form the final string.

E.g:

print("Ma position est ", x, ":", y);

About functions

You can dynamically define function on the group.

This function are called script function or user function (as opposed to the hard coded ‘native function’).

User functions don't have parameters.

Functions can be defined this way:

my_function()
{
  print("message"); // print a message
  mavar = 5*mavar; // the variable mavar is now equals to mavar*5
  caller.mavar = mavar; // the variable mavar of the caller's is now equal to mavar (see bellow for more explanation)
}
You can call a function like this (note that if a function is not defined for a group, nothing is called):
my_function(); // call my_function from this group
group1_tryker.my_function(); // call my_function for group1_tryker (inside this function the current group is accessible via caller keyword) 

Variable manipulation

Some simple mathematical operators can be used: +, -, /, * with parenthesis or not.

E.g.:

mavar =(5*mavar+1)/3;
Note that the negative operator should be used with caution, YOU MUST add a space after the ‘-‘ symbol.

You can do comparison with variables and or numbers (can be used for if and while statements). Note that you can't do mathematical computation inside the if parameter (you CANNOT write if (x+10 < 20)).

mavar = 10;
if(mavar < 10)
{
  ...
}
In the above code we could replace caller by parent which is another keyword that indicate the parent of a machine state.

The parent/children relation is defined for dynamic spawned groups (see below native functions).

Code flow structure

Classical code flow constructs

while, if, else can be used as in C.

onchildren

onchildren special construct allow you to execute a script block on all the child of the current group.
onchildren()
{
  ...
}

onchildren

random special construct allow you to execute randomly a block of code among several. One instruction in the block following rand keyword is chosen and executed. This instruction can be a block, in which case the whole block is executed.
random()
{
  block1();
  { // Block2 begin
    print("foo");
  } // Block2 end
  (bar)block3(baf);
}

Native function calls

Native calls are available too. Native calls offer hard coded services to the scripter.

Native calls have input and output parameters (AKA parameters and return values).

(destVar1,destVar2)nativeMethod(ParamVar1);
This line calls the function nativeMethod for the current group. The left parenthesis are used to define output arguments, the right for input arguments.

Quick reference list of native functions

Spawn/despawn

Event handler creation

Actions

Group creation

Primitive lookup

Group parameters

Phrase management

Persistency functions

Boss Functions

Sending Text/Emote/System with parameters

Knowing Date of the server / Time in game

Knowing infos on the player

Infos on bot

Aggro functions

Teleport Functions

Misc function (not related to current group)

Math functions

String functions

NeL variables management

Named entities management

Foreign managers access

Detailed documentation of native functions

copyDynEnergy_sff_

Copy energy values from an index to another, on all groups matching the specified request. Valid index values are integers from 0 to 3.

Request is of the form "[family-<family_name>] [cellZone-<cellzone_name>]". Names can contain wild cards (? and *).

Arguments: s(Request), f(IndexSrc), f(IndexDst) ->

Parameters:
[in] Request is a request of the form "[family-<family_name>] [cellZone-<cellzone_name>]"
[in] IndexSrc is a an index number in energy system
[in] IndexDst is a an index number in energy system
()copyDynEnergy("family-tribu*", SourceIndex , DestinationIndex); // Copy the dyn energy of groups defined by family-tribu* from slot SourceIndex to slot DestinationIndex

setDynEnergy_sff_

Sets energy values on an index, on all groups matching the specified request. Valid index values are integers from 0 to 3. Valid values range from 0 to 1.

Request is of the form "[family-<family_name>] [cellZone-<cellzone_name>]". Names can contain wild cards (? and *).

Arguments: s(Request), f(Index), f(Value) ->

Parameters:
[in] Request is a request of the form "[family-<family_name>] [cellZone-<cellzone_name>]"
[in] Index is a an index number in energy system
[in] Value is a an energy value for energy system
()setDynEnergy("family-tribu*", Index, Energy); // Sets the dyn energy of all groups defined by family-tribu* to Energy in slot Index

clamp_fff_f

Clamps a value between lim1 and lim2. Low bound is the min value of (lim1,lim2), up bound the max value. If input value is out of [low_bound;up_bound], this function returns the nearest limit of value.

Arguments: f(value),f(lim1),f(lim2) -> f(clamped_value)

Parameters:
[in] value is the value to clamp
[in] lim1 is a clamp limit
[in] lim2 is a clamp limit
[out] clamped_value is the clamped value
(percentage)clamp(ratio, 0, 1);

min_ff_f

Returns the lowest of two values.

Arguments: f(value1),f(value2) -> f(min_value)

Parameters:
[in] value1 is a value to compare
[in] value2 is a value to compare
[out] min_value is the min value
(shortest)min(left, right);

max_ff_f

Returns the highest of two values.

Arguments: f(value1),f(value2) -> f(max_value)

Parameters:
[in] value1 is a value to compare
[in] value2 is a value to compare
[out] max_value is the max value
(longest)max(left, right);

rndm_ff_f

Returns a random value in interval [min;max[. max must be higher than min.

Arguments: f(min),f(max) -> f(random_value)

Parameters:
[in] min is a lower bound of the possible returned values
[in] max is a upper bound of the possible returned values
[out] random_value is a random value
(val)rndm(0, 1);

floor_f_f

Returns the highest integer lower than or equal to input value.

Arguments: f(value) -> f(floored_value)

Parameters:
[in] value is a real value
[out] floored_value is an integer
(count)floor(value);

ceil_f_f

Returns the lowest integer higher than or equal to input value.

Arguments: f(value) -> f(ceiled_value)

Parameters:
[in] value is a real value
[out] ceiled_value is an integer
(count)ceil(value);

round_f_f

Returns the integer closest to input value.

Arguments: f(value) -> f(rounded_value)

Parameters:
[in] value is a real value
[out] ceiled_value is an integer
(count)round(value);

abs_f_f

Returns the absolute value of the input value.

Arguments: f(value) -> f(rounded_value)

Parameters:
[in] value is a real value
[out] absolute_value is a positive value
(dist)abs(diff);

sin_f_f

Returns the sinus of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is sin(x)
(y)sin(x);

asin_f_f

Returns the arcsinus of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is asin(x)
(y)asin(x);

sinh_f_f

Returns the hyperbolic sinus of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is sinh(x)
(y)sinh(x);

cos_f_f

Returns the cosinus of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is cos(x)
(y)cos(x);

acos_f_f

Returns the arccosinus of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is acos(x)
(y)acos(x);

cosh_f_f

Returns the hyperbolic cosinus of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is cosh(x)
(y)cosh(x);

tan_f_f

Returns the tangent of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is tan(x)
(y)tan(x);

atan_f_f

Returns the arctangent of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is atan(x)
(y)atan(x);

tanh_f_f

Returns the hyperbolic tangent of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is tanh(x)
(y)tanh(x);

sqrt_f_f

Returns the square root of the input value.

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is sqrt(x)
(y)sqrt(x);

exp_f_f

Returns the exponent of the input value (ie e^x).

Arguments: f(x) -> f(y)

Parameters:
[in] x is a real value
[out] y is exp(x)
(y)exp(x);

pow_ff_f

Returns the base^exponent.

Arguments: f(x) -> f(y)

Parameters:
[in] pow is the base
[in] exponent is the exponent
[out] ret is base^exponent
(max)exp(2, nbits);

strlen_s_f

Returns the length of a string.

Arguments: s(string) -> f(length)

Parameters:
[in] string is a string
[out] length is the length of the input string
(length)strlen($str);

substr_sff_s

Returns a substring of the input string.

Arguments: s(string),f(start),f(length) -> s(substring)

Parameters:
[in] string is a string
[in] start is the first character to copy
[in] length is the length of the returned string
[out] substring is the substring of string starting at character start and length characters long
(length)substr($str);

strtof_s_f

Converts a string to a float.

Arguments: s(string) -> f(value)

Parameters:
[in] string is a string
[out] value is the converted value
(val)strtof($str);

strtof_s_ff

Converts a string to a float.

Arguments: s(string) -> f(value),f(isfloat)

Parameters:
[in] string is a string
[out] value is the converted value
[out] isfloat is 1 if the input string contained a value, otherwise 0
(val, isfloat)strtof($str);

strtof_s_fff

Converts a string to a float.

Arguments: s(string) -> f(value),f(isfloat),f(isfull)

Parameters:
[in] string is a string
[out] value is the converted value
[out] isfloat is 1 if the input string contained a value, otherwise 0
[out] isfull is 1 if the input string only contained the converted value, otherwise 0
(val, isfloat, isfull)strtof($str);

createNamedEntity_s_

Creates a named entity in current AIS. A named entity is an entity containing only 4 fields (name, state, param1, param2) and that can appear on web admin.

Arguments: s(name) ->

Parameters:
[in] name is a the name of the named entity to create
()createNamedEntity("Invasion");

setNamedEntityProp_sss_

Sets a property of an existing named entity. Valid property names are:

Arguments: s(name),s(prop),s(content) ->

Parameters:
[in] name is a the name of the named entity to modify
[in] prop is a the property of the named entity to modify
[in] content is a the value to set
()setNamedEntityProp("Invasion", "state", "Active");

setNamedEntityPropCb_sss_

See also:
setNamedEntityProp_sss_
This function does trigger listeners associated with the entity property.

Arguments: s(name),s(prop),s(content) ->

Parameters:
[in] name is a the name of the named entity to modify
[in] prop is a the property of the named entity to modify
[in] content is a the value to set
()setNamedEntityPropCb("Invasion", "state", "Active");

getNamedEntityProp_ss_s

Returns the content of a named entity property. Valid property names are:

Arguments: s(name),s(prop) -> s(content)

Parameters:
[in] name is a the name of the named entity to modify
[in] prop is a the property of the named entity to modify
[out] content is a the content of the specified field
($state)getNamedEntityProp("Invasion", "state");

destroyNamedEntity_s_

Destroys a named entity.

Arguments: s(name) ->

Parameters:
[in] name is a the name of the named entity to destroy
()destroyNamedEntity("Invasion");

setSimplePhrase_ss_

Creates a phrase ID of the form phraseName(){[phraseContent]}.

Arguments: s(phraseName),s(phraseContent) ->

Parameters:
[in] phraseName is a the id of the phrase to define
[in] phraseContent is the text associated with the phrase
()setSimplePhrase("HELLO", "Salut, ca va ?"); // équivalent à "HELLO(){[Salut, ca va ?]}"

dataGetVar_s_s

Returns the content of a script data variable. Data variable name is composed of a file name and a variable name separated with ':', like in "file:variable".

Arguments: s(name) -> s(value)

Parameters:
[in] name is a the name of the data variable
[out] value is a the content of the data variable
($state)dataGetVar("Fyros:Patrol1State");

dataGetVar_s_f

Returns the content of a script data variable. Data variable name is composed of a file name and a variable name separated with ':', like in "file:variable".

Arguments: s(name) -> f(value)

Parameters:
[in] name is a the name of the data variable
[out] value is a the content of the data variable
(nbPatrol)dataGetVar("Fyros:PatrolCount");

dataSetVar_ss_

Changes the content of a script data variable. Data variable name is composed of a file name and a variable name separated with ':', like in "file:variable".

Arguments: s(name),s(value) ->

Parameters:
[in] name is a the name of the data variable
[in] value is a the content of the data variable
()dataSetVar("Fyros:Patrol1State", "Active");

dataSetVar_sf_

Changes the content of a script data variable. Data variable name is composed of a file name and a variable name separated with ':', like in "file:variable".

Arguments: s(name),s(value) ->

Parameters:
[in] name is a the name of the data variable
[in] value is a the content of the data variable
()dataSetVar("Fyros:PatrolCount", nbPatrol);

dataSave__

Save all previously written script data variables to file. This must be done explicitly, otherwise modified variables are not saved. This is primarily necessary to save CPU, because writing operations can take time. This also permit to ensure data integrity if a crash occurs between the writing of two related variables.

Arguments: ->

()dataSave();

setZoneState_sf_

Arguments: ->

arg0: is the zone name id

arg1: if zone is not pvp arg1 is interpreted as a boolean (0 - inactive, 1 - active) if zone is a pvp zone arg1 is interpreted as 0 - inactive 1 - active with faction point rewards 2 - active without faction point rewards

()setZoneState("toto", 1.0);

setEvent_f_

Triggers a user event.

Arguments: f(EventId) ->

Parameters:
EventId is the user event id to be triggered
()setEvent(0); // Triggers the event 0

setTimer_ff_

Sets a timer delay and start it.

Arguments: f(DeltaTime), f(TimerId) ->

Parameters:
[in] DeltaTime is the time (in ticks) before the timer event is triggered
[in] TimerId is the timer ID
()setTimer(200, 0); // Sets the timer t0 to 200 ticks

timerSetRyzomDaytime_fff_

Set a timer at a specified hour in Ryzom time and start it.

Arguments: f(TimerId), f(Hour), f(Minute) ->

Parameters:
[in] TimerId is the timer ID
[in] Hour is the hour we want the timer to trigger
[in] Minute is the minute we want the timer to trigger
()timerSetRyzomDaytime(0, 13, 45); // create a timer at 13h45 (Ryzom time)

timerIsEnabled_f_f

Test if a timer is enabled.

Arguments: f(TimerId) -> f(IsEnabled)

Parameters:
[in] TimerId is the timer ID
[out] IsEnabled 1 if the timer is enabled
(isEnabled)timerIsEnabled(0); // test if the timer t0 is enabled and put the ret in isEnabled variable

timerIsSuspended_f_f

Test if a timer is suspended.

Arguments: f(TimerId) -> f(IsSuspended)

Parameters:
[in] TimerId is the timer ID
[out] IsSuspended 1 if the timer is suspended
(isSuspended)timerIsSuspended(0); // test if the timer t0 is suspended and put the ret in isSuspended variable

timerSuspend_f_

Suspend a timer.

Arguments: f(TimerId) ->

Parameters:
[in] TimerId is the timer ID
()timerSuspend(0); // suspend the timer t0

timerDisable_f_

Disable a timer.

Arguments: f(TimerId) ->

Parameters:
[in] TimerId is the timer ID
()timerDisable(0); // disable the timer t0

timerResume_f_

Resume a timer.

Arguments: f(TimerId) ->

Parameters:
[in] TimerId is the timer ID
()timerResume(0); // resume the timer t0

timerAdd_ff_

Add a delta time to a timer.

Arguments: f(TimerId), f(DeltaTime) ->

Parameters:
[in] TimerId is the timer ID
[in] DeltaTime is the delta time in ticks
()timerAdd(0, 41); // add 41 ticks to the next trigger
()timerAdd(0, -10); // remove 10 ticks to the next trigger

dssStartAct_ff_

Request the start of a dss Act.

Arguments: f(SessionId), f(ActId)->

Parameters:
[in] SessionId is the id session
[in] ActId is the id of the act (0 = permanent content)
()dssStartAct(42,2); // Start the 2ond act of the session 42

postNextState_s_

Triggers a state change.

Arguments: s(StateName) ->

Parameters:
[in] StateName is the name of the next state
()postNextState("state_invasion_2"); // Post the next state named 'state_invasion_2' if found in this state machine
()postNextState($name_var); // Post the next state named by name_var if found in this state machine

import_s_

Imports (executes in current context as a script function) a script defined in a script rep.

Arguments: s(libName) ->

Parameters:
[in] libName is the library name
()import("script_boss");

setNelVar_sf_

Sets the content of a NeL Variable. The variable is created if it doesn't exist.

Arguments: s(varId),f(value) ->

Parameters:
[in] varId is a the name of the variable to set
[in] value is a the value to set
()setNelVar("BotCount", 32);

getNelVar_s_f

Returns the content of a NeL Variable. The variable is created if it doesn't exist.

Arguments: s(varId) -> f(value)

Parameters:
[in] varId is a the name of the variable to set
[out] value is a the value of the variable
(botCount)getNelVar("BotCount");

delNelVar_ss_

Detetes a NeL Variable. Passed value is used to determine the type of the variable. Content of that value is ignored.

Arguments: s(varId) ->

Parameters:
[in] varId is a the name of the variable to delete
[in] value is a a value of the same type of the variable
()delNelVar("BotCount", 0);

setNelVar_ss_

Sets the content of a NeL Variable. The variable is created if it doesn't exist.

Arguments: s(varId),s(value) ->

Parameters:
[in] varId is a the name of the variable to set
[in] value is a the value to set
()setNelVar("BotFamily", "the_killers");

getNelVar_s_s

Returns the content of a NeL Variable. The variable is created if it doesn't exist.

Arguments: s(varId) -> s(value)

Parameters:
[in] varId is a the name of the variable to set
[out] value is a the value of the variable
(botFamily)getNelVar("BotFamily");

delNelVar_ss_

Detetes a NeL Variable. Passed value is used to determine the type of the variable. Content of that value is ignored.

Arguments: s(varId) ->

Parameters:
[in] varId is a the name of the variable to delete
[in] value is a a value of the same type of the variable
()delNelVar("BotFamily", "");

getStateName__s

Returns the name of the current state.

Arguments: -> s(StateName)

Parameters:
[out] StateName is the name of the current state
($name)getStateName();

spawn__

Spawns the current group.

Arguments: ->

despawn_f_

Depawns the current group.

Arguments: f(Immediatly) ->

Parameters:
Immediatly is whether the groups spawns immediatly (1) or not (0)
()despawn(0);  // despawn
()despawn(1);  // despawn immediatement

isAlived__f

Test if the group is alived

Arguments: -> f(Immediatly)

Returns:
1 if group is spawned
(alive)isAlived();  

newNpcChildGroupPos_ssfff_c

Used to create a dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y), f(Dispersion) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[in] Dispersion is the dispersion radius in meters when spawning a group
[out] Group is the newly created group
(@grp)newNpcChildGroupPos("class_forager", "state_machine_1", x, y, 30);

newNpcChildGroupPos_ssfff_

Used to create a dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y), f(Dispersion) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[in] Dispersion is the dispersion radius in meters when spawning a group
()newNpcChildGroupPos("class_forager", "state_machine_1", x, y, 30);

newNpcChildGroupPos_ssff_c

Used to create a dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[out] Group is the newly created group
(@grp)newNpcChildGroupPos("class_forager", "state_machine_1", x, y);

newNpcChildGroupPos_ssff_

Used to create a dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
()newNpcChildGroupPos("class_forager", "state_machine_1", x, y);

newNpcChildGroupPosMl_ssffff_c

Used to create a multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y), f(BaseLevel), f(Dispersion) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[in] BaseLevel is the base level of the spawned group
[in] Dispersion is the dispersion radius in meters when spawning a group
[out] Group is the newly created group
(@grp)newNpcChildGroupPosMl("class_forager", "state_machine_1", x, y, 13, 7.5);

newNpcChildGroupPosMl_ssffff_

Used to create a multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y), f(BaseLevel), f(Dispersion) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[in] BaseLevel is the base level of the spawned group
[in] Dispersion is the dispersion radius in meters when spawning a group
()newNpcChildGroupPosMl("class_forager", "state_machine_1", x, y, 13, 7.5);

newNpcChildGroupPosMl_ssfff_c

Used to create a multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y), f(BaseLevel) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[in] BaseLevel is the base level of the spawned group
[out] Group is the newly created group
(@grp)newNpcChildGroupPosMl("class_forager", "state_machine_1", x, y, 13);

newNpcChildGroupPosMl_ssfff_

Used to create a multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), f(x), f(y), f(BaseLevel) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] x position of the spawned group on x axis
[in] y position of the spawned group on y axis
[in] BaseLevel is the base level of the spawned group
()newNpcChildGroupPosMl("class_forager", "state_machine_1", x, y, 13);

getMidPos__ff

Returns the position (x, y) of the current group.

Arguments: -> f(x), f(y)

Parameters:
[out] x position of the group on x axis
[out] y position of the group on y axis
(x, y)getMidPos();

newNpcChildGroup_sssf_c

Used to create dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(Dispersion) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[in] Dispersion is the dispersion radius in meters when spawning a group
[out] Group is the newly created group
(@grp)newNpcChildGroup("class_forager", "state_machine_1", $zone, 10);

newNpcChildGroup_sssf_

Used to create dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(Dispersion) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[in] Dispersion is the dispersion radius in meters when spawning a group
()newNpcChildGroup("class_forager", "state_machine_1", $zone, 10);

newNpcChildGroup_sss_c

Used to create dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(Dispersion) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[out] Group is the newly created group
(@grp)newNpcChildGroup("class_forager", "state_machine_1", $zone);

newNpcChildGroup_sss_

Used to create dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(Dispersion) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
()newNpcChildGroup("class_forager", "state_machine_1", $zone);

newNpcChildGroupMl_sssff_c

Used to create multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(BaseLevel), f(Dispersion) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[in] BaseLevel is the base level of the spawned group
[in] Dispersion is the dispersion radius in meters when spawning a group
[out] Group is the newly created group
(@grp)newNpcChildGroupMl("class_forager", "state_machine_1", $zone, 2, 50);

newNpcChildGroupMl_sssff_

Used to create multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(BaseLevel), f(Dispersion) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[in] BaseLevel is the base level of the spawned group
[in] Dispersion is the dispersion radius in meters when spawning a group
()newNpcChildGroupMl("class_forager", "state_machine_1", $zone, 2, 50);

newNpcChildGroupMl_sssf_c

Used to create multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(BaseLevel) -> c(Group)

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[in] BaseLevel is the base level of the spawned group
[out] Group is the newly created group
(@grp)newNpcChildGroupMl("class_forager", "state_machine_1", $zone, 12);

newNpcChildGroupMl_sssf_

Used to create multilevel dynamic npc group (a parent/children relation is defined).

Arguments: s(GroupTemplate), s(StateMachine), s(Zone), f(BaseLevel) ->

Parameters:
[in] GroupTemplate is the name of a template npc group defined in the same AIInstance
[in] StateMachine is the name of a state machine defined in the same AIInstance
[in] Zone is returned by the getZoneWithFlags methods
[in] BaseLevel is the base level of the spawned group
()newNpcChildGroupMl("class_forager", "state_machine_1", $zone, 12);

spawnManager_s_

Spawns a manager.

Arguments: s(ManagerName) ->

Parameters:
[in] ManagerName is the name of the manager to spawn
()spawnManager("NPC Manager"); // Spawns all the NPCs in the NPC manager called "NPC Manager"

despawnManager_s_

Despawns a manager.

Arguments: s(ManagerName) ->

Parameters:
[in] ManagerName is the name of the manager to despawn
()despawnManager("NPC Manager"); // Despawns all the NPCs in the NPC manager called "NPC Manager"

getGroupTemplateWithFlags_sss_s

Returns the name of a randomly chosen group template corresponding to specified flags.

Arguments: s(OneOf), s(Mandatory), s(ExceptFlags) -> s(GroupTemplate)

Parameters:
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[in] ExceptFlags is a '|' separated list of flags
[out] GroupTemplate is a group template matching at least one of OneOf flags, all Manadatory flags and none of ExceptFlags
($group)getGroupTemplateWithFlags("food|rest", "invasion|outpost"); // Get a group which matches 'invasion', 'outpost' and either 'food' or 'rest' flags.

getGroupTemplateWithFlags_ss_s

Returns the name of a randomly chosen group template corresponding to specified flags.

Arguments: s(OneOf), s(Mandatory) -> s(GroupTemplate)

Parameters:
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[out] GroupTemplate is a group template matching at least one of OneOf flags and all Manadatory flags
($group)getGroupTemplateWithFlags("food|rest", "invasion|outpost"); // Get a group which matches 'invasion', 'outpost' and either 'food' or 'rest' flags.

getZoneWithFlags_ssss_s

The first parameter is a list of 'one match enough' zone flags. The zones must have at least one of these flags to be selected. The second parameter is a list of 'all required' zone flag. The zones must have all these flags to be selected. The fourth parameter is a list of 'all forbidden' zone flag. The zones must not have any of these flags to be selected. Additionnaly the returned zone cannot be ExceptZone. Last argument specifies a list of flags that the selected zone cannot have.

With the list of selectable zone, the system then select a zone based on entity density in each selected zone. The system will select the least populated zone. It then returns the zone name.

Priority is given to current Cell, and after that to all cells.

Arguments: s(OneOf), s(Mandatory), s(ExceptZone), s(ExceptProperties) -> s(Zone)

Parameters:
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[in] ExceptZone is a zone name
[in] ExceptProperties is a '|' separated list of flags
[out] Zone is a zone matching at least one of OneOf flags, all Manadatory flags and can't be ExceptZone
($zone)getZoneWithFlags("food|rest", "invasion|outpost", $oldzone); // Get a zone which matches invasion, outpost and either food or rest flags with the best score except $oldzone.
($zone)getZoneWithFlags("boss", "", $oldzone); // Get a zone which matches boss flag with the best score except the $oldzone

getZoneWithFlags_sss_s

See also:
getZoneWithFlags_ssss_s
Arguments: s(OneOf), s(Mandatory), s(ExceptZone) -> s(Zone)
Parameters:
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[in] ExceptZone is a zone name
[out] Zone is a zone matching at least one of OneOf flags, all Manadatory flags and can't be ExceptZone
($zone)getZoneWithFlags("food|rest", "invasion|outpost", $oldzone); // Get a zone which matches invasion, outpost and either food or rest flags with the best score except $oldzone.
($zone)getZoneWithFlags("boss", "", $oldzone); // Get a zone which matches boss flag with the best score except the $oldzone

getNearestZoneWithFlags_ffsss_s

See also:
getZoneWithFlags_ssss_s
The zone returned by this function is the nearest from the specified point and taking into account the zone free space.

Arguments: f(X), f(Y), s(OneOf), s(Mandatory), s(ExceptProperties) -> s(Zone)

Parameters:
[in] X is the position of the zone we are looking for on the X axis
[in] Y is the position of the zone we are looking for on the X axis
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[in] ExceptProperties is a '|' separated list of flags
[out] Zone is a zone matching at least one of OneOf flags, all Manadatory flags and can't be ExceptZone
($zone)getNearestZoneWithFlags(x, y, "food|rest", "invasion|outpost", "stayaway");

getNearestZoneWithFlags_ffss_s

See also:
getZoneWithFlags_sss_s
The zone returned by this function is the nearest from the specified point and taking into account the zone free space.

Arguments: f(X), f(Y), s(OneOf), s(Mandatory), s(ExceptProperties) -> s(Zone)

Parameters:
[in] X is the position of the zone we are looking for on the X axis
[in] Y is the position of the zone we are looking for on the X axis
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[out] Zone is a zone matching at least one of OneOf flags, all Manadatory flags and can't be ExceptZone
($zone)getNearestZoneWithFlags(x, y, "food|rest", "invasion|outpost");

getNearestZoneWithFlagsStrict_ffsss_s

See also:
getZoneWithFlags_ssss_s
The zone returned by this function is the nearest from the specified point without taking into account the zone free space.

Arguments: f(X), f(Y), s(OneOf), s(Mandatory), s(ExceptProperties) -> s(Zone)

Parameters:
[in] X is the position of the zone we are looking for on the X axis
[in] Y is the position of the zone we are looking for on the X axis
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[in] ExceptProperties is a '|' separated list of flags
[out] Zone is a zone matching at least one of OneOf flags, all Manadatory flags and can't be ExceptZone
($zone)getNearestZoneWithFlagsStrict(x, y, "food|rest", "invasion|outpost", "stayaway");

getNearestZoneWithFlagsStrict_ffss_s

See also:
getZoneWithFlags_sss_s
The zone returned by this function is the nearest from the specified point without taking into account the zone free space.

Arguments: f(X), f(Y), s(OneOf), s(Mandatory), s(ExceptProperties) -> s(Zone)

Parameters:
[in] X is the position of the zone we are looking for on the X axis
[in] Y is the position of the zone we are looking for on the X axis
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[out] Zone is a zone matching at least one of OneOf flags, all Manadatory flags and can't be ExceptZone
($zone)getNearestZoneWithFlagsStrict(x, y, "food|rest", "invasion|outpost");

getNeighbourZoneWithFlags_ssss_s

See also:
getZoneWithFlags_ssss_s
Here priority is given to current Cell, after that to neighbour Cells, and finally to all cells. CurrentZone cannot be returned.

Arguments: s(CurrentZone), s(OneOf), s(Mandatory), s(ExceptProperties) -> s(Zone)

Parameters:
[in] CurrentZone is a zone name
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[in] ExceptProperties is a '|' separated list of flags
[out] Zone is a zone matching the specified flags
($zone1)getNeighbourZoneWithFlags($zone, "boss", "", $exceptflag); // Get the zone in the neighbour cells of the one containing $zone which matches specified flags

getNeighbourZoneWithFlags_sss_s

See also:
getZoneWithFlags_sss_s
Here priority is given to current Cell, after that to neighbour Cells, and finally to all cells. CurrentZone cannot be returned.

Arguments: s(CurrentZone), s(OneOf), s(Mandatory) -> s(Zone)

Parameters:
[in] CurrentZone is a zone name
[in] OneOf is a '|' separated list of flags
[in] Mandatory is a '|' separated list of flags
[out] Zone is a zone matching the specified flags
($zone1)getNeighbourZoneWithFlags($zone, "boss", ""); // Get the zone in the neighbour cells of the one containing $zone which matches specified flags

setAggro_ff_

Sets aggro parameters of current group.

Arguments: f(Range), f(NbTicks) ->

Parameters:
[in] Range is a aggro range in meters
[in] NbTicks is a aggro update period in ticks
()setAggro(Range, NbTicks); // Sets the aggro range of the group to Range, updated every NbTicks ticks

setCanAggro_f_

Let a bot aggro or prevent it from aggroing.

Arguments: f(CanAggro) ->

Parameters:
[in] CanAggro tells whether the bot can aggro (!=0) or not (==0)
()setCanAggro(0);

clearAggroList_f_

Reset the aggrolist of a bot.

Arguments: f(bool don't send lost aggro message to EGS) ->

()clearAggroList(0/1);

clearAggroList__

Reset the aggrolist of a bot.

Arguments: ->

()clearAggroList();

setMode_s_

Sets the mode of every bot of the group. Valid modes are:

Arguments: s(Mode) ->

Parameters:
[in] Mode is the mode name to set
()setMode("Alert");

setAutoSpawn_f_

Determine if the current group should respawn automatically after despawn.

Arguments: f(AutoSpawn) ->

Parameters:
[in] AutoSpawn is whether the group automatically rewpawns (1) or not (0)
()setAutoSpawn(1);

setHPLevel_f_

Sets the current HP level of each bot of the group.

Arguments: f(Coef) ->

Parameters:
[in] Coef is the percentage of its max HP each creature will have
()setHPLevel(0.8);

setHPScale_f__f_

Sets the current HP level of level of each bot of the group. its maxHitPoints eg: for a bot HP = 850 and MaxHP = 1000 ()setHPScale_f_(0); HP will be 0 so DeltaHp = 850 ()setHPScale_f_(1); HP will be 100 so DeltaHp = 150 ()setHPScale_f_(0.5); HP will be 500 so DeltaHp = 350 if bot HP = 840 and Max abd setHpRatio(0) HP will be 0

Arguments: f(Coef) ->

Parameters:
[in] Coef is the percentage of its max HP each creature will *BE*
()setHPLevel(0.8);

scaleHP_f_

Scales the bots HP.

Arguments: f(Coef) ->

Parameters:
[in] Coef is the percentage of its current HP each creature will have
()scaleHP(2);

setBotHPScaleByAlias_fs_

Same as setHpSacale but only on a specific bot of a groupe from the current group by its bot alias

Arguments: f(alias),f(Coef), ->

Parameters:
[in] alias is the alias of the bot
[in] Coef is the percentage of its current HP each creature will have
()scaleHpByAlias(2, '(A:1000:10560)');

downScaleHP_f_

Scales the bots HP down.

Arguments: f(Coef) ->

Parameters:
[in] Coef is a value
()downScaleHP(2);

upScaleHP_f_

Scales the bots HP up.

Arguments: f(Coef) ->

Parameters:
[in] Coef is a value
()upScaleHP(2);

addHP_f_

Add HP to the bots.

Arguments: f(HP) ->

Parameters:
[in] HP is the amount of hit points to add to each bot
()addHP(500);

aiAction_s_

Triggers an AI action, defined by its sheet name, on the current target.

Arguments: s(actionSheetId) ->

Parameters:
[in] actionSheetId is a the sheet name of the action
()aiAction("kick_his_ass.aiaction");

aiActionSelf_s_

Triggers an AI action, defined by its sheet name, on the bot itself.

Arguments: s(actionSheetId) ->

Parameters:
[in] actionSheetId is a the sheet name of the action
()aiActionSelf("defensive_aura.aiaction");

addProfileParameter_s_

Adds a profile parameter to the current group.

Arguments: s(parameterName) ->

Parameters:
[in] parameterName is a the id of the parameter to add
()addProfileParameter("running"); // équivalent à un parameter "running" dans la primitive du groupe

addProfileParameter_ss_

Adds a profile parameter to the current group.

Arguments: s(parameterName),s(parameterContent) ->

Parameters:
[in] parameterName is a the id of the parameter to add
[in] parameterContent is the value of the parameter
()addProfileParameter("foo", "bar"); // équivalent à un parameter "foo:bar" dans la primitive du groupe

addProfileParameter_sf_

Adds a profile parameter to the current group.

Arguments: s(parameterName),f(parameterContent) ->

Parameters:
[in] parameterName is a the id of the parameter to add
[in] parameterContent is the value of the parameter
()addProfileParameter("foo", 0.5); // équivalent à un parameter "foo:0.5" dans la primitive du groupe

removeProfileParameter_s_

removes a profile parameter from the current group.

Arguments: s(parameterName) ->

Parameters:
[in] parameterName is a the id of the parameter to remove
()removeProfileParameter("running"); // retire le paramètre "running" ou "running:<*>" du groupe

addPersistentProfileParameter_s_

Adds a profile parameter to the current group.

Arguments: s(parameterName) ->

Parameters:
[in] parameterName is a the id of the parameter to add
()addProfileParameter("running"); // équivalent à un parameter "running" dans la primitive du groupe

addPersistentProfileParameter_ss_

Adds a profile parameter to the current group.

Arguments: s(parameterName),s(parameterContent) ->

Parameters:
[in] parameterName is a the id of the parameter to add
[in] parameterContent is the value of the parameter
()addPersistentProfileParameter("foo", "bar"); // équivalent à un parameter "foo:bar" dans la primitive du groupe

addPersistentProfileParameter_sf_

Adds a profile parameter to the current group.

Arguments: s(parameterName),f(parameterContent) ->

Parameters:
[in] parameterName is a the id of the parameter to add
[in] parameterContent is the value of the parameter
()addPersistentProfileParameter("foo", 0.5); // équivalent à un parameter "foo:0.5" dans la primitive du groupe

removePersistentProfileParameter_s_

removes a profile parameter from the current group.

Arguments: s(parameterName) ->

Parameters:
[in] parameterName is a the id of the parameter to remove
()removeProfileParameter("running"); // retire le paramètre "running" ou "running:<*>" du groupe

getOutpostState__s

Returns the name of the current outpost state (group must be in an outpost).

Arguments: -> s(StateName)

Parameters:
[out] StateName is the name of the current outpost state
($name)getOutpostState();

isOutpostTribeOwner__f

Returns whether the current outpost owner is a tribe (group must be in an outpost).

Arguments: -> f(TribeOwner)

Parameters:
[out] TribeOwner is whether the current outpost owner is a tribe (1) or not (0)
(tribeOwner)isOutpostTribeOwner();

isOutpostGuildOwner__f

Returns whether the current outpost owner is a guild (group must be in an outpost).

Arguments: -> f(TribeOwner)

Parameters:
[out] TribeOwner is whether the current outpost owner is a guild (1) or not (0)
(guildOwner)isOutpostGuildOwner();

getEventParam_f_f

Returns the content of a param

Arguments: f(paramIndex) -> f(value)

Parameters:
[in] paramIndex is the parameter index passed by EGS ai_event message
[out] value is a the value of the parameter
(val)getEventParam(2);

getEventParam_f_s

Returns the content of a param

Arguments: f(paramIndex) -> s(value)

Parameters:
[in] paramIndex is the parameter index passed by EGS ai_event message
[out] value is a the value of the parameter
($val)getEventParam(2);

getPlayerStat_ss_f

Get some player stat.

A player EntityId is used to identify the player. This EntityId is passed as string as argument. The EntityId can be obtains via getCurrentPlayerAggroListTarget or getRandomPlayerAggroListTarget. The player must be in the same AI Instance (same continent). If the player is not in the same Ai Instance or the input string is empty the function return zero and *display* a warning message on the log. You can think of using isPlayerAlived to be sure that the id is still a valid value. If param is not one of "HP", "MaxHp", "RatioHp" zero is return and a warning message is printed on the log.

Arguments: s(playerEidAsString), s(statName) -> s(result)

Parameters:
[in] playerEidAsString is EntityId as string from the player we want infos
[in] statName is the name of the property (can be "HP", "MaxHp", "RatioHp")
[out] value is a the value of the parameter
($playerEid)getCurrentPlayerEid();
print($playerEid); //log (0x00001fbd50:00:00:81)
(maxHp)getPlayerStat($playerEid, "MaxHp");

getPlayerDistance_fs_f

Get the distance between a player and a bot in meters.

A player EntityId is used to identify the player. This EntityId is passed as string as argument. The EntityId can be obtains via getCurrentPlayerAggroListTarget or getRandomPlayerAggroListTarget. The player must be in the same AI Instance (same continent). If the player is not in the same Ai Instance or the input string is empty the function return -1 and display a warning message on the log. You can think of using isPlayerAlived to be sure that the player id is still a valid value.

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index the function returns -1 and display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

Arguments: s(playerEidAsString), f(botIndex) -> s(result)

Parameters:
[in] playerEidAsString is EntityId as string from the player we want infos
[in] botIndex is the index of an bot member of the current group
[out] value is a the distance between the player on the bot (or -1 if error)
($playerEid)getCurrentPlayerEid();
(index)getBotIndexByName("toto");
(distance)getPlayerDistance(index, $playerEid);

getCurrentPlayerAggroListTarget_f_s

Get the player entity id (as string) that has the most aggro in the aggro list of a bot.

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index (or bot not spawaned) the function returns an empty string and display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

A player EntityId is used to identify the player. This EntityId is returned as result. If the aggro list is empty an empty string is returned (but *NO* warning messages)

Arguments: f(botIndex) -> s(playerEidAsString)

Parameters:
[in] botIndex is the index of an bot member of the current group
[out] playerEidAsString is EntityId as string from the player we want infos
($playerId)getCurrentPlayerAggroListTarget(4); 
(distance)getPlayerDistance(4, $playerId); 

getRandomPlayerAggroListTarget_f_s

Get a player entity id (as string) from the aggro list of a bot.

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index (or bot not spawaned) the function returns an empty string and display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

A player EntityId is used to identify the player. This EntityId is returned as result. If the aggro list is empty an empty string is returned (but *NO* warning messages)

Arguments: f(botIndex) -> s(playerEidAsString)

Parameters:
[in] botIndex is the index of an bot member of the current group
[out] playerEidAsString is EntityId as string from the player we want infos
($playerId)getRandomPlayerAggroListTarget(4); 
()setAggroListTarget(4, $playerId); 

getAggroListElement_ff_s

Get a player entity id (as string) from the aggro list of a bot by it aggro list index.

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index (or bot not spawaned) the function returns an empty string and display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

A aggro list index is used to identified the player in the aggro list. The size of the aggro list is given by getAggroListSize_f_s )

Arguments: f(botIndex), f(aggroListIndex) -> s(playerEidAsString)

Parameters:
[in] botIndex is the index of an bot member of the current group
[in] aggroListIndex is the index of a aggroable player in the aggro list of the bot identified by botIndex
[out] playerEidAsString is EntityId as string from the player we want infos
(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();
}

getAggroListSize_f_f

Get a size of the aggro lsit of a bot (list of aggroable PLAYER)

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index (or bot not spawaned) the function returns an empty string and display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

A number is used to indicate the size of the aggro lsit

Arguments: f(aggroListIndex) -> f(sizeOfAggroList)

Parameters:
[in] botIndex is the index of an bot member of the current group.
[out] sizeOfAggroList The size of the aggro list index.
(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();
}

setAggroListTarget_fs_

Maximize the Aggro of a target from the Aggro list of one bot (this id can be given by getRandomPlayerAggroListTarget)..

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index (or bot not spawaned) the function display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

A player EntityId is used to identify the player. If the entityId is not from the aggro list then a warning message is shown in the log. If the entityId is a empty string nothing no message are displayed.

Arguments: f(botIndex) >s(playerEidAsString) >

Parameters:
[in] botIndex is the index of an bot member of the current group
[in] playerEidAsString is EntityId of the player that will be attacked
($playerId)getRandomPlayerAggroListTarget(4); 
()setAggroListTarget(4, $playerId); 

setGroupAggroListTarget_s_

Maximize the Aggro of a target from the Aggro list of one bot to his group (this id can be given by getRandomPlayerAggroListTarget)..

A player EntityId is used to identify the player. If the entityId is not from the aggro list then a warning message is shown in the log. If the entityId is a empty string nothing no message are displayed.

Arguments: s(playerEidAsString) >

Parameters:
[in] playerEidAsString is EntityId of the player that will be attacked by the group
($playerId)getRandomPlayerAggroListTarget(4); 
()setGroupAggroListTarget($playerId); 

setManagerAggroListTarget_ss_

Maximize the Aggro of a target of one bot to some groups of his manage.

A player EntityId is used to identify the player. If the entityId is not from the aggro list then a warning message is shown in the log. If the entityId is a empty string nothing no message are displayed.

A string is used to select groups of the manager (groups name must contains this string)

Arguments: f(botIndex), s(playerEidAsString) >

Parameters:
[in] playerId is EntityId of the player
[in] nameElement The element of the name of all group we are interest in.
($playerId)getRandomPlayerAggroListTarget(0); 
()setManagerAggroListTarget($playerId, "group_bandit_");  // all group that have name like "group_bandit_*" will attack the player

getBotIndexByName_s_f

Get the index of a bot of a group by its name (or return -1). Mainly usefull for scripted boss.

botIndex begins at zero for the first member of the group, -1 if the bot is not found.

Arguments:, s(botName) > f(botIndex)

Parameters:
[in] name is the name of the bot
[out] botIndex is the index of an bot member of the current group
(botIndex)getBotIndexByName("boss_random_aggro");
($playerId)getRandomPlayerAggroListTarget(botIndex); 
()setAggroListTarget(botIndex, $playerId); 
}

isGroupAlived__f

Test if a group is alived (at least one member is alived)

A bot index is used to identify the bot. If there is only one spawned bot in a group then the index value is 0. If we want the bot index of a specific bot the getBotIndexByName function can be used. The function getBotCount can be used to know the number of bot in a group. The function isGroupAlived or isBotAlived can be used to verify if the index is valid. If no bot are identified by the bot index (or bot not spawaned) the function display a warning message. You can this of using isBotAlived to be sure that the bot index is still a valid value.

Arguments: s(playerid) > f(success)

Parameters:
[out] sucess is 1.0f if there is at least one member of the group alived (0.0f if not alived bot are found)
($alived)isGroupAlived();
if ($alived == 1.0f) {
} 

isBotAlived_f_f

Test if a bot of the current group is alived. The bot is identified by its index.

Arguments: f(botIndex) > f(success)

Parameters:
int] botIndex the index of the bot.
[out] sucess is 1.0f if there is at least one member of the group alived (0.0f if not alived bot are found)
($botIndex)getBotIndexByName("boss_3");
$alived)isBotAlived($botIndex);
if (alived == 1.0f) {
}

isPlayerAlived_s_f

Test if a a player is is alived.

A player EntityId is used to identify the player. If the player is not connected, not in the same continent, or dead 0 is returned.

Arguments: s(playerId) > f(success)

Parameters:
[in] palyerId 
[out] success is 1.0f if the entity id of a player is alived.
($botIndex)getBotIndexByName("boss_3");
($playerId)getCurrentPlayerAggroListTarget($botIndex):
(alived)isPlayerlived($playerId);
if (alived == 1.0f) {
} 

getServerTimeStr__s

Gets the server time as string "eg 21:17:14 the x" This function is usefull for stat purpose or debug (to know when a boss is down)

Arguments: > s(serverTime)

Parameters:
[out] The server time as debug string
($serverTime)getServerTimeAsString();

getServerTime__s

Gets the server time as number (it is the number of seconde since 1970). This value is useful for saving the server date on a file

Arguments: > s(serverTime)

Parameters:
[out] The server time as string (a float is not sharp enough
($serverTime)getServerTime();

getRyzomDateStr__s

Gets the ryzom date as string Arguments: > s(ryzomDateStr)

Parameters:
[out] ryzomTimeAndDateAsString The time and date of the ryzom univers as debug string.
($ryzomDateStr)getRyzomDateStr);

getRyzomDate__s

Gets the ryzom tick game cycle. Useful for computing difference of time. The return value is a string and not a float because float is not sharp enought? Arguments: > s(tickGameCycle)

Parameters:
[out] TickGameCycle The time of the ryzom univers (stops when server stops). 10 tick is 1 second.
($tickGameCycle)getRyzomDate();

phraseBegin__

Clear the parameters stack.

Used when creating a customized msg via phraseEndSystemMsg_fss_, phraseEndNpcMsg_fss_, phraseEndSystemMsg_fss_. It Must be called at start of phrase if we are not sure that the parameter stack is clean.

Parameter stack is unclean when someone has called a phrasePush* function but *not* a phraseEnd function before (which is *very* bad).

Arguments: ->

()phraseBegin();
()phrasePushValue("money", 15);
()phrasePushValue("integer", 15);
()phrasePushValue("time", 15);
()phraseEndSystemMsg(0, "say", "PHRASE_FROM_PHRASE_WITH_3_PARAMETERS");

phrasePushValue_sf_

This function push a value as number on the parameter stack. This stack is used by phraseEndSystemMsg_fss_, phraseEndNpcMsg_fss_, phraseEndSystemMsg_fss_ functions.
See also:
phraseBegin__

phrasePushString_ss_

phraseEndSystemMsg_fss_

phraseEndNpcMsg_fss_

phraseEndSystemMsg_fss_

The value *Must* be an number and only few type are handled.

Some value other can be handled *BUT* the value *MUST* be the C++ code enum value. So LD must ask to coder to do a scripting fonction that have as input a string that contains enum value as string eg "matis" and that return the C++ enum value as int (eg 4).

Arguments: s(paramType), f(value) ->

Parameters:
[in] paramType the type of the parameter
[in] value the value of the parameter
()phraseBegin();
()phrasePushValue("money", 15);
()phrasePushValue("integer", 15);
()phrasePushValue("time", 15);
()phraseEndSystemMsg(0, "say", "PHRASE_WITH_3_PARAMETERS");

phrasePushString_ss_

This function push a value as string on the parameter stack. This stack is used by phraseEndSystemMsg_fss_, phraseEndNpcMsg_fss_, phraseEndSystemMsg_fss_ functions.
See also:
phraseBegin__

phrasePushValue_sf_

phraseEndSystemMsg_fss_

phraseEndNpcMsg_fss_

phraseEndSystemMsg_fss_

The value *Must* be a string. The string is internal converted to number, sheetId, entityId when needed.

Input as a number:

Input as string literal

Input as an entityId (obtains via getCurrentPlayerAggroListTarget_f_s, getRandomPlayerAggroListTarget_f_s, getBotEid_f_s, getCurrentSpeakerEid__s, getAggroListElement_ff_s)

Input as sheetId name (example: "toto.sbrick", "toto.sitem", "toto.creature")

Input as string identifier

Input as stringId (number): *WARNING* LD must as coder to do function that return string_id if they want to use that type

Input must be a enum value: Some value other can be handled *BUT* the value *MUST* be the C++ code enum value. So LD must ask to coder to do a scripting fonction that have as input a string that contains enum value as string eg "matis" and that return the C++ enum value as int (eg 4).

Arguments: s(paramType), f(value) ->

Parameters:
[in] paramType the type of the parameter
[in] value the value of the parameter
($playerEid)getCurrentPlayerEid();
($botEid)group3.getBotEid(4);
()phraseBegin();
()phrasePushValue("integer", 15);
()phrasePushString("integer", "15");
()phrasePushString("literal", "Test 123");
()phrasePushString("player", $playerEid);
()phrasePushString("bot", $botEid);
()phrasePushString("item", "abc.sitem");
()phrasePushString("sbrick", "toto.sbrick");
()phrasePushString("creature_model", "toto.creature");
()phraseEndSystemMsg(0, "say", "PHRASE_WITH_SOME_PARAMETERS");

phraseEndNpcMsg_fss_

Send a message with parameter through a bot says. Parameters are taken from the parameters stack.
See also:
phrasePushValue_sf_

phrasePushString_ss_

Arguments: s(botIndex), s(sayType), s(phraseIdentifier) ->
Parameters:
[in] botIndex the Position of the bot in the group ( see getBotIndexByName_s_f)
[in] sayType Is the type of the say dialog ("say", "shout", "civilization", "territory", "universe", "arround", "system", "region")
[in] phraseIdentifier Is the identifier phrase as seen in phrase_wk.uxt
()phrasePushString("literal", "text non traduit");
()groupOf5Bot.phraseEndNpcMsg(4, "say", "PHRASE_TOTO");

WARNING In this case in the phrase_wk.txt PHRASE_TOTO must be defined as

PHRASE_TOTO(bot b, literal l)
{
    [I am $b$, on this text is not translated $l$ ]
}

The first parameter is ALWAYS the bot that says the text (value is automaticaly set)

phraseEndSystemMsg_fss_

Send a message with parameter through system braodcast msg. Parameters are taken from the parameters stack.
See also:
phrasePushValue_sf_

phrasePushString_ss_

Arguments: s(botIndex), s(sayType), s(phraseIdentifier) ->
Parameters:
[in] botIndex the Position of the bot in the group ( see getBotIndexByName_s_f)
[in] sayType Is the type of the say dialog ("say", "shout", "civilization", "territory", "universe", "arround", "system", "region")
[in] phraseIdentifier Is the identifier phrase as seen in phrase_wk.uxt
()phrasePushString("literal", "Test des levels designer");
()groupOf5Bot.phraseEndSystemMsg(4, "say", "PHRASE_TOTO");

WARNING* In this case in the phrase_wk.txt PHRASE_TOTO must be defined as

PHRASE_TOTO(literal l)
{
    [$l$]
}
The first parameter is *NOT* automaticaly set to the bot that send the system msg as phraseEndNpcMsg_fss_.

Because the msg can be send as "around". The broadcas msg must be send by a bot (that have a valid position)

phraseEndEmoteMsg_fs_

Send a custom emote message with parameter through system braodcast msg. Parameters are taken from the parameters stack.
See also:
phrasePushValue_sf_

phrasePushString_ss_

Arguments: s(botIndex), s(phraseIdentifier) ->
Parameters:
[in] botIndex the Position of the bot in the group ( see getBotIndexByName_s_f)
[in] phraseIdentifier Is the identifier phrase as seen in phrase_wk.uxt
($playerEid)getCurrentPlayerEid();
($botEid)getCurrentSpeakerEid();

()phrasePushString("player", $playerEid);
()groupOf5Bot.phraseEndEmoteMsg(,"PHRASE_TOTO1");

()phrasePushString("bot", $botEid);
()groupOf5Bot.phraseEndEmoteMsg(,"PHRASE_TOTO2");

WARNING* In this case in the phrase_wk.txt PHRASE_TOTO must be defined as

PHRASE_TOTO1(player p)
{
    [$p$ is laughing ]
}
PHRASE_TOTO2(bot b)
{
    [$b$ is sad ]
}
The first parameter is NOT automaticaly the bot that says the text as phraseEndNpcMsg_fss_ because a bot can make a player doing a emote text.

The emote msg must be send by a bot (that have a valid position).

queryEgs_sscfs_

Send a query msg to egs to know infos on a player. Answer is asynchronous so we have to indicates a group and a user event that will be triggered when answer will come back to AIS

Possible info to know are

Arguments: s(botIndex), s(query), c(groupThatWillBeTriggered), f(idOfTheUserEvent), s(msgId)

Parameters:
[in] botIndex the Position of the bot in the group ( see getBotIndexByName_s_f)
[in] query The query we want to send
[in] groupThatWillBeTriggered The group that will receive a user_event when the answer will come
[in] idOfTheUserEvent The number of the user event that will be triggered
[in] msgId The id of the msg
Answer will be given by the getParam

    //Sening msg to EGS
    (@groupToNotify)boss_group.context();
    ()queryEgs("Name", $playerEid, @groupToNotify, 4, "MSG_NAME");
    ()queryEgs("Hp", $playerEid, @groupToNotify, 4, "msg1");
    ()queryEgs("MaxHp", $playerEid, @groupToNotify, 4, "msg2");
    ()queryEgs("RatioHp", $playerEid, @groupToNotify, 4, "msg3");
    ()queryEgs("Sap", $playerEid, @groupToNotify, 4,  "msg4");
    ()queryEgs("MaxSap", $playerEid, @groupToNotify, 4,  "msg5");
    ()queryEgs("RatioSap", $playerEid, @groupToNotify, 4,  "msg6");
    ()queryEgs("Focus", $playerEid, @groupToNotify, 4,  "msg7");
    ()queryEgs("MaxFocus", $playerEid, @groupToNotify, 4,  "msg8");
    ()queryEgs("RatioFocus", $playerEid, @groupToNotify, 4,  "msg9");
    ()queryEgs("Stamina", $playerEid, @groupToNotify, 4,  "msg10");
    ()queryEgs("MaxStamina", $playerEid, @groupToNotify, 4,  "msg11");
    ()queryEgs("RatioStamina", $playerEid, @groupToNotify, 4,  "msg12");
    ()queryEgs("BestSkillLevel", $playerEid, @groupToNotify, 4, "msg13");
Answer of the EGS
    // the user_event 4 of groupToNotify will be trigered 
    ($msgName)getEventParam(0); // the msg name
    ($ret)getEventParam(1); // the return
    ($funName)getEventParam(2); // the name of the function
    ($playerEid)getEventParam(3); // the id of the player
    ($param1)getEventParam(4); // empty ot item, or sbrick or botEid

    if ($msgName == "MSG_NAME") {
        ()phrasePushString("literal", $ret);
        ()phrasePushString("player", $playerEid);
        ()boss_group.phraseEndNpcMsg(0, "say", "TEST_BOSS_TEST_MSG");
    }
    else
    {
        ()phrasePushString("player", $playerEid);
        ()phrasePushString("literal", $funName);
        ()phrasePushString("literal", $msgName);
        ()phrasePushString("integer", $ret);
        ()boss_group.phraseEndNpcMsg(0, "say", "TEST_BOSS_TEST_EGS_QUERY");

    }

summonPlayer_fs_

Summon a player to a bot.

Can be used by a boss to teleport a player. Or the create a teleporter.

A player EntityId is used to identify the player. A index is used to identified the bot (index for the current group)

Arguments: f(botIndex), s(playerEid) >

Parameters:
[in] botIndex is the index of the bot in the current group(static group)
[in] playerEid The entityId of the player
($playerId)getRandomPlayerAggroListTarget(0); 
()teleportPlayer(0, $playerEid); // teleport player to the boss.

teleportPlayer_sffff_

Teleport a player to a position

A player EntityId is used to identify the player. The position is identified by the value x,y,z and the heading

Arguments: s(playerId), f(x), f(y), f(z), f(heading) >

Parameters:
[in] playerId is EntityId of the player
[in] x,y,z,heading is the new position of the player
($playerId)getRandomPlayerAggroListTarget(0); 
()teleportPlayer($playerEid, 1000, 1000, 100, 0);

getBotEid_f_s

Get the bot EntityId by its Index. Arguments: f(botIndex) -> s(botEid)

Parameters:
[in] botIndex the Position of the bot in the group
[out] botEid The entity Id given by the bot (or empty) if the indexed bot is not from the group
(index)getBotIndexByName("bot_toto");
($botEid)getBotEid(index);
if (index != -1)
{
()phrasePushValue("entity", $botEid);
()phraseEndEmoteMsg(index, "PHRASE_YOUR_ARE_CLICKING_ON_ME");
}

getBotIndex_s_f

Get the bot Index by its entityId. Entity Id of a bot can be given via getCurrentSpeackerEid(). It can be usefull to Known the index of the bot in the group with the EntityId.

Arguments: s(botEid) -> f(botIndex),

Parameters:
[in] botEid The entity Id given by the bot
[out] botIndex the Position of the bot in the group (or -1 if the entity_id is not from a bot of the group)
($botEid)getCurrentSpeakerEid();
(index)getBotIndex($botEid);
if (index != -1)
{
()phrasePushValue("entity", $botEid);
()phraseEndNpcg(index, "PHRASE_YOUR_ARE_CLICKING_ON_ME");
}

getCurrentPlayerEid__s

Get the entity id of the player that is clicking on a bot.

WARNING the function is only valid when called from an player_target_npc event.

Arguments: -> s(playerEidAsString),

Parameters:
[out] playerEidAsString is EntityId as string from the player.
($playerEid)getCurrentPlayerEid();
(index)getBotIndexByName("toto");
(distance)getPlayerDistance(index, $playerEid);
phrasePushString("player", $playerEid);
phrasePushValue("interger", distance);
phraseEndNpcMsg(index, "say", "MSG_BOT_B_SAYS_THE_PLAYER_P_IS_AT_DISTANCE_D");

getCurrentSpeakerEid__s

Get the entity id of the bot at which the player as that is clicking at.

WARNING the function is only valid when called from an player_target_npc event.

Arguments: -> s(botEidAsString),

Parameters:
[out] botEidAsString is EntityId as string from the bot.
($botEid)getCurrentSpeakerEid();
($playerEid)getCurrentSpeakerEid();

phrasePushString("player", $playerEid);
phrasePushValue("bot", $botEid);
phraseEndEmotMsg(index, "EMOT_PLAYER_INSULT_BOT");

sitDown__

Make the group sit Down

Arguments: ->

()sitDown();

standUp

Make the group stand up (if was previously stand down)

Arguments: ->

()standUp(); 

standUp

Use to implement setConditionRet

Arguments: ->

()setConditionRet(1); 

setFactionProp_ss_

Set a property of the faction profile. Valid values for Property are:

There are special faction that are automatically attributed to entities. Special factions are:

Arguments: s(Property),s(Content) ->

Parameters:
Property is the property to modify
Content is a '|' seperated list of faction names
()setFactionProp("ennemyFaction", "Player");

moveToZone_ss_

Moves the current group from one zone to another.

Arguments: s(From), s(To) ->

Parameters:
[in] From is a zone name
[in] To is a zone name
()moveToZone($zone1, $zone2); // Move the current group from $zone1 to $zone2

setActivity_s_

Changes the activity of the group. Valid activities are:

Arguments: s(Activity) ->

Parameters:
[in] Activity is an activity name the group will take
()setActivity("bandit"); // Gives a bandit activity to the group

waitInZone_s_

Makes the group wander in the specified zone. It's useful to prevent the group from looping previous movement profile).

Arguments: s(Zone) ->

Parameters:
[in] Zone is a zone name
()waitInZone($zone); // Makes the group wander in $zone

stopMoving__

Makes the group stop moving and stand at its current position.

Arguments: ->

()stopMoving(); // Makes the group stop moving

wander__

Makes the group wander in the current npc state zone.

Arguments: ->

()wander(); // Makes the group wander

setAttackable_f_

Sets the group as being attackable (or not) by bots and players. 0 means not attackable, 1 means attackable.

Arguments: f(Attackable) ->

Parameters:
[in] Attackable tells whether the group is attackable
()setAttackable(1); // Make the group attackable by players and bots

setPlayerAttackable_f_

Sets the group as being attackable (or not) by players. 0 means not attackable, 1 means attackable.

Arguments: f(Attackable) ->

Parameters:
[in] Attackable tells whether the group is attackable
()setPlayerAttackable(1); // Make the group attackable by players

setBotAttackable_f_

Sets the group as being attackable (or not) by bots. 0 means not attackable, 1 means attackable.

Arguments: f(Attackable) ->

Parameters:
[in] Attackable tells whether the group is attackable
()setBotAttackable(0); // Make the group not attackable by bots

setFactionAttackableAbove_sff_

Sets the group as being attackable (or not) by players having their fame matching the specified condition. If player fame for Faction is above specified Threshold the bot will be attackable by that player or not depending on Attackable parameter, 0 meaning not attackable, 1 meaning attackable.

Note: Bots must not be player attackable for the faction to be taken into account.

Arguments: s(Faction),f(Threshold),f(Attackable) ->

Parameters:
[in] Faction tells the faction against which player fame will be tested
[in] Threshold is the test threshold above which player will be able to attack
[in] Attackable tells whether the group is attackable or not
()setFactionAttackableAbove("TribeNightTurners", 0, 1); // Make the group attackable by players with positive tribe_night_turners fame

setFactionAttackableBelow_sff_

Sets the group as being attackable (or not) by players having their fame matching the specified condition. If player fame for Faction is below specified Threshold the bot will be attackable by that player or not depending on Attackable parameter, 0 meaning not attackable, 1 meaning attackable.

Note: Bots must not be player attackable for the faction to be taken into account.

Arguments: s(Faction),f(Threshold),f(Attackable) ->

Parameters:
[in] Faction tells the faction against which player fame will be tested
[in] Threshold is the test threshold below which player will be able to attack
[in] Attackable tells whether the group is attackable or not
()setFactionAttackableBelow("TribeMatisianBorderGuards", 0, 1); // Make the group attackable by players with negative tribe_matisian_border_guards fame

addBotChat_s_

Add an entry in the botchat menu of every bot of the group. Specified text ID can be created dynamically with setSimplePhrase (setSimplePhrase_ss_).

Arguments: s(BotChat) ->

Parameters:
[in] BotChat is a text ID
()addBotChat("menu:QUESTION:REPONSE");

clearBotChat__

Removes all entries from the botchat menu of every bot of the group.

Arguments: ->

()clearBotChat();

ignoreOffensiveActions_f_

Make the bots of the group ignore offensive actions issued on them.

Arguments: f(IgnoreOffensiveActions) ->

Parameters:
[in] IgnoreOffensiveActions is tells whethere to ignore offensive actions (1) or not (0)
()ignoreOffensiveActions(1);

setDespawnTime_f_

Sets the time before current group being despawned.

Arguments: f(DespawnTime) ->

Parameters:
[in] DespawnTime is the despawn time in ticks (-1 will set "pseudo-infinite")
()setDespawnTime(80);
()setDespawnTime(-1);

despawnBotByAlias_s_

Despawn a specific Bot by its alias

Arguments: f(alias), ->

Parameters:
[in] alias is the alias of the bot
()despawnBotByAlias('(A:1000:10560)');

setRespawnTime_f_

Sets the time in game cycles before current group being respawned.

Arguments: f(RespawnTime) ->

Parameters:
[in] RespawnTime is the respawn time in ticks (-1 will set "pseudo-infinite")
()setRespawnTime(80);
()setRespawnTime(-1);

addHpUpTrigger_ff_

Registers a trigger on HP increases. Whenever the HP level of a bot upcross the threshold it triggers the specified user event. Several triggers can be registered on the same group, even with the same threshold and event.

Arguments: f(threshold),f(user_event_n) ->

Parameters:
[in] threshold is a HP threshold
[in] user_event_n is the user event to trigger
()addHpUpTrigger(0.5, 4);

delHpUpTrigger_ff_

Unregisters a trigger on HP increases. The same values used when registering the trigger must be passed. If several triggers were defined with the same parameters only one is removed.

Arguments: f(threshold),f(user_event_n) ->

Parameters:
[in] threshold is a HP threshold
[in] user_event_n is the user event to trigger
()delHpUpTrigger(0.5, 4);

addHpDownTrigger_ff_

Registers a trigger on HP decreases. Whenever the HP level of a bot downcross the threshold it triggers the specified user event. Several triggers can be registered on the same group, even with the same threshold and event.

Arguments: f(threshold),f(user_event_n) ->

Parameters:
[in] threshold is a HP threshold
[in] user_event_n is the user event to trigger
()addHpDownTrigger(0.5, 5);

delHpDownTrigger_ff_

Unregisters a trigger on HP decreases. The same values used when registering the trigger must be passed. If several triggers were defined with the same parameters only one is removed.

Arguments: f(threshold),f(user_event_n) ->

Parameters:
[in] threshold is a HP threshold
[in] user_event_n is the user event to trigger
()delHpDownTrigger(0.5, 5);

addHpUpTrigger_fs_

See also:
addHpUpTrigger_ff_
These triggers call a script function instead of trigger a user event.

Arguments: f(threshold),s(callback) ->

Parameters:
[in] threshold is a HP threshold
[in] callback is the script callback to trigger
()addHpUpTrigger(0.5, "onHPIncrease");

delHpUpTrigger_fs_

See also:
delHpUpTrigger_ff_
This function is used to remove script function triggers.

Arguments: f(threshold),s(callback) ->

Parameters:
[in] threshold is a HP threshold
[in] callback is the script callback to trigger
()delHpUpTrigger(0.5, "onHPIncrease");

addHpDownTrigger_fs_

See also:
addHpDownTrigger_ff_
These triggers call a script function instead of trigger a user event.

Arguments: f(threshold),s(callback) ->

Parameters:
[in] threshold is a HP threshold
[in] callback is the script callback to trigger
()addHpDownTrigger(0.5, "onHPDecrease");

delHpDownTrigger_fs_

See also:
delHpDownTrigger_ff_
This function is used to remove script function triggers.

Arguments: f(threshold),s(callback) ->

Parameters:
[in] threshold is a HP threshold
[in] callback is the script callback to trigger
()delHpDownTrigger(0.5, "onHPDecrease");

addNamedEntityListener_ssf_

Associates a listeners with a named entity property. Whenever that field changes the specified user event is triggered. Valid property names are:

Arguments: s(name),s(prop),f(event) ->

Parameters:
[in] name is a the name of the named entity to listen
[in] prop is a the property of the named entity to listen
[in] event is a the user event to trigger
()addNamedEntityListener("Invasion", "state", 6);

delNamedEntityListener_ssf_

Removes a listener from a named entity property. If several listeners with the same parameters are registered, only one is removed.

Arguments: s(name),s(prop),f(event) ->

Parameters:
[in] name is a the name of the named entity to listen
[in] prop is a the property of the named entity to listen
[in] event is a the user event to trigger
()delNamedEntityListener("Invasion", "state", 6);

addNamedEntityListener_sss_

See also:
addNamedEntityListener_ssf_
These listeners call a script function instead of triggering a user event.

Arguments: s(name),s(prop),s(cbFunc) ->

Parameters:
[in] name is a the name of the named entity to listen
[in] prop is a the property of the named entity to listen
[in] cbFunc is a the callback to trigger
()addNamedEntityListener("Invasion", "state", "onStateChange");

delNamedEntityListener_sss_

See also:
delNamedEntityListener_ssf_
This function removes script function listeners.

Arguments: s(name),s(prop),s(cbFunc) ->

Parameters:
[in] name is a the name of the named entity to listen
[in] prop is a the property of the named entity to listen
[in] cbFunc is a the callback to trigger
()delNamedEntityListener("Invasion", "state", "onStateChange");

setPlayerController_ss_

Make a player control a npc.

Arguments: s(botId),s(playerId) ->

Parameters:
[in] botId is the entity id of the bot the player will control
[in] playerId is the entity id of the player that will control the bot
()setPlayerController("(0x0002015bb4:01:88:88)", "(0x0000004880:00:00:00)");

clearPlayerController_s_

Stop the control of a npc by a player.

Arguments: s(botId) ->

Parameters:
[in] botId is the entity id of the bot
()clearPlayerController("(0x0002015bb4:01:88:88)");

activateEasterEgg_fffsffffsss_

Call the EGS function CCharacterControl::activateEasterEgg

Arguments: f(easterEggId), f(scenarioId), f(actId), s(items), f(x), f(y), f(z),f(heading), f(groupname), f(name), f(clientSheet)->

Parameters:
[in] items is the sheet/quantity vector (a string of format "item1:qty1;item2:qty2;...")
()activateEasterEgg(2, 1601, 4, "toto.sitem:2;tata.sitem:1;titi.sitem:3", 1247, 4627, 0, 0);

deactivateEasterEgg_fff_

Call the EGS function CCharacterControl::deactivateEasterEgg

Arguments: f(easterEggId), f(scenarioId), f(actId) ->

()deactivateEasterEgg(0, 4);

receiveMissionItems_ssc_

The npc will ask mission items to the targeter player.

A new entry of the npc contextual menu will propose to the targeter player to give mission items to the npc if he has the requested items.

Then user events are triggered on the group to inform it about what happens:

Warning: this function can only be called after the event "player_target_npc".

Arguments: s(missionItems), s(missionText), c(groupToNotify) ->

Parameters:
[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...".
[in] missionText is the text which will appear in the npc contextual menu.
[in] groupToNotify is the npc group which will receive the user events.
(@groupToNotify)group_name.context();
()receiveMissionItems("toto.sitem:2;tata.sitem:1;titi.sitem:3", "Mission text", @groupToNotify);

giveMissionItems_ssc_

The npc will give mission items to the targeter player.

A new entry of the npc contextual menu will propose to the targeter player to receive mission items from the npc.

Then user events are triggered on the group to inform it about what happens:

Warning: this function can only be called after the event "player_target_npc".

Arguments: s(missionItems), s(missionText), c(groupToNotify) ->

Parameters:
[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...".
[in] missionText is the text which will appear in the npc contextual menu.
[in] groupToNotify is the npc group which will receive the user events.
(@groupToNotify)group_name.context();
()giveMissionItems("toto.sitem:2;tata.sitem:1;titi.sitem:3", "Mission text", @groupToNotify);

talkTo_sc_

A new entry of the npc contextual menu will propose to the targeter player to talk to the npc.

Then user events are triggered on the group to inform it about what happens:

Warning: this function can only be called after the event "player_target_npc".

Arguments: s(missionText), c(groupToNotify) ->

Parameters:
[in] missionText is the text which will appear in the npc contextual menu.
[in] groupToNotify is the npc group which will receive the user events.
(@groupToNotify)group_name.context();
()talkTo("Mission text", @groupToNotify);

facing_cscs_

The npc1 will turn to npc2

Arguments: c(group1), s(botname1), c(group2), s(botname2), ->

Parameters:
[in] group1 is the npc group of the boot that turn to the other bot
[in] botname1 is the name of the bot
[in] group2 is the npc group of the boot that is the target
[in] botname2 is the name of the bot that is targeted
(@group1)group_name1.context();
(@group1)group_name2.context();
()facing(@group1, "bob", @group2, "bobette");

npcSay_css_

A new entry of the npc contextual menu will propose to the targeter player to talk to the npc.

Make a npc say a text

There are 3 type of text

Arguments: c(group), s(botname), s(text), ->

Parameters:
[in] group is the npc group of the boot that does the emote
[in] botname is the name of the bot
[in] text is the name of the emote
(@group)group_name.context();
()emote(@group, "bob", "DSS_1601 RtEntryText_6") ;// Send To dss
()emote(@group, "bob", "RAW Ca farte?"); // phrase direcly send to IOS as raw (for debug)
()emote(@group, "bob", "answer_group_no_m"); //phrase id

deactivateEasterEgg_fff_

Call the DSS function CAnimationModule::dssMessage

Arguments: f(easterEggId), f(scenarioId), f(actId) ->

()dssMessage(114, "BC", "Bob", "Life is harde");

setScenarioPoints

Call the DSS function CAnimationModule::setScenarioPoints

Arguments: f(scenarioInstance), f(scenarioPoints) ->

()setScenarioPoints(114, 42);

startScenarioTiming

Call the DSS function CAnimationModule::startScenarioTiming

Arguments: f(scenarioInstance),

()startScenarioTiming(114, 42);

endScenarioTiming

Call the DSS function CAnimationModule::endScenarioTiming

Arguments: f(scenarioInstance),

()endScenarioTiming(114, 42);

emote_css_

Make a npc launch a emote

Arguments: c(group1), s(botname1), c(group2), s(botname2), ->

Parameters:
[in] group1 is the npc group of the boot that does the emote
[in] botname1 is the name of the bot
[in] emote is the name of the emote
(@group1)group_name.context();
()emote(@group1, "bob", "sad")

maxHitRange_f_

Sets the max hit range possible for player, in meters

Arguments: f(MaxHitRange) ->

Parameters:
[in] MaxHitRange set the max range for player can hit this npc group
()maxHitRange(50); // Set the max hit range in 50 meters all npc in group