Skip to content

functions

Jan Boon edited this page Mar 13, 2023 · 288 revisions

title: AI Script Function Reference description: published: true date: 2023-03-13T00:28:59.226Z tags: editor: markdown dateCreated: 2023-03-12T09:18:34.306Z

AI Script Functions

Reference list of native functions.

NPC Group Functions

Spawn and Despawn

Function Documentation Description
()spawn() Spawn Spawn the current group
()despawn(f) Despawn Despawn the current group

General Purpose Timers and Event Triggers

Function Documentation Description
()setEvent(f) Set Event Trigger a user event by ID between 0 and 9
()setTimer(f, f) Set Timer Sets a timer delay and starts it
()timerSetRyzomDaytime(f, f, f) Timer Set Ryzom Daytime Sets a timer at a specified hour in Ryzom time and starts it
()timerDisable(f) Timer Disable Disable a timer
()timerSuspend(f) Timer Suspend Suspend a timer
()timerResume(f) Timer Resume Resume a timer
()timerAdd(f, f) Timer Add Extend a timer by adding a time delta
(f)timerIsEnabled(f) Timer Is Enabled Check if a timer is enabled
(f)timerIsSuspended(f) Timer Is Suspended Returns whether a timer is suspended or not

Specialized Event Handlers

Function Documentation Description
()addHpUpTrigger(f, f)
()addHpUpTrigger(f, s)
Add HP Up Trigger Register a user event or script function to trigger when a bot's HP level increases and crosses a threshold
()delHpUpTrigger(f, f)
()delHpUpTrigger(f, s)
Delete HP Up Trigger Unregister a previously registered HP increase trigger
()addHpDownTrigger(f, f)
()addHpDownTrigger(f, s)
Add HP Down Trigger Register a user event or script function to trigger on HP decreases that cross a threshold
()delHpDownTrigger(f, f)
()delHpDownTrigger(f, s)
Delete HP Down Trigger Unregisters a trigger on HP decreases for a specified user event or script function

Behavioural Logic State

Function Documentation Description
(s)getStateName() Get State Name Returns the name of the group's current state
()postNextState(s) Post Next State Triggers a state change by posting the next state with the given name

Actions

Function Documentation Description
(f)getEventParam(f)
(s)getEventParam(f)
Get Event Param Retrieves the content of a parameter passed by an EGS ai_event message

Behaviour Activity Movement State

Function Documentation Description
()startWander(f) Start Wander Set activity to wander in current position
()startMoving(f, f, f) Start Moving Sets an activity to move a group to a specified position
()followPlayer(s, f) Follow Player Sets the AI activity to follow the given player with the specified radius
()moveToZone(s, s) Move To Zone Moves the current group from one zone to another
()waitInZone(s) Wait in Zone Makes the group wander in the specified zone
()stopMoving() Stop Moving Makes the group stop moving and stand at its current position

wander__ downScaleHP_f_ upScaleHP_f_ scaleHP_f_ setHPLevel_f_ addHP_f_ aiAction_s_ aiActionSelf_s_ setPlayerController_ss_ clearPlayerController_s_ activateEasterEgg_fffsfff_ deactivateEasterEgg_fff_

receiveMissionItems_ssc_ giveMissionItems_ssc_

Behaviour Actions

Function Documentation Description
()sitDown() Sit Down Make the group sit down
()standUp() Stand Up Make the group stand up
()emote(c, s, s)
()emote(s, s)
()emote(s)
Emote Launch an emote for a bot or a group of bots

NPC Group Parameters

Function Documentation Description
(f, f)getMidPos() Get Mid Pos Returns the position (x, y) of the current group

setActivity_s_

Event stuff

Function Documentation Description
()rename(s) Rename Changes the displayed name of all bots in a group
()vpx(s) VPX Sets the VisualPropertyA, VisualPropertyB, or VisualPropertyC bitfield value for a bot NPC

Ring stuff

Function Documentation Description
()talkTo(s, c) Talk To Adds an entry to the NPC contextual menu allowing a player to talk to the NPC
()giveReward(s, s, s, s, c) Give Reward Send a reward to a player and notify the specified NPC group
()npcSay(s, s)
()npcSay(c, s, s)
NPC Say Make an NPC say a text in chat

Weird Ring stuff

Function Documentation Description
()dssMessage(f, s, s, s) DSS Message Calls the DSS function CAnimationModule::dssMessage
()setScenarioPoints(f, f) Set Scenario Points Calls the DSS function CAnimationModule::setScenarioPoints
()startScenarioTiming(f) Start Scenario Timing Starts the timing of a DSS scenario
()endScenarioTiming(f) End Scenario Timing Calls the DSS function CAnimationModule::endScenarioTiming

dssStartAct_ff_

despawnBotByAlias_s_

isAlived__f setMaxHP_ff_ setBotHPScaleByAlias_fs_ setConditionSuccess_f_

Function Documentation Description
()facing(f)
()facing(c, s, c, s)
Facing Make all NPCs in a group face a certain direction or make one NPC turn and face another NPC
()setUrl(s, s) Set URL Sets the name and URL of an action in the bot's right-click context menu

NPC Group Creation

Function Documentation Description
(c)newNpcChildGroup(s, s, s)
()newNpcChildGroup(s, s, s)
(c)newNpcChildGroup(s, s, s, f)
()newNpcChildGroup(s, s, s, f)
New NPC Child Group Creates a dynamic NPC group with a parent/children relation
(c)newNpcChildGroupPos(s, s, f, f)
()newNpcChildGroupPos(s, s, f, f)
(c)newNpcChildGroupPos(s, s, f, f, f)
()newNpcChildGroupPos(s, s, f, f, f)
New NPC Child Group Pos Create a dynamic NPC group with a parent/children relation based on the provided position
(c)newNpcChildGroupMl(s, s, s, f)
()newNpcChildGroupMl(s, s, s, f)
(c)newNpcChildGroupMl(s, s, s, f, f)
()newNpcChildGroupMl(s, s, s, f, f)
New NPC Child Group Multilevel Creates a multilevel dynamic NPC group with a parent/children relation
(c)newNpcChildGroupPosMl(s, s, f, f, f)
()newNpcChildGroupPosMl(s, s, f, f, f)
(c)newNpcChildGroupPosMl(s, s, f, f, f, f)
()newNpcChildGroupPosMl(s, s, f, f, f, f)
New NPC Child Group Pos Multilevel Create a multilevel dynamic NPC group with a parent/children relation based on the provided position

Primitive Lookup

Function Documentation Description
(s)getGroupTemplateWithFlags(s, s)
(s)getGroupTemplateWithFlags(s, s, s)
Get Group Template With Flags Get a randomly chosen group template name that matches specified flags
(s)getZoneWithFlags(s, s, s)
(s)getZoneWithFlags(s, s, s, s)
Get Zone With Flags Selects a zone based on a set of flags and returns the name of the selected zone
(s)getNeighbourZoneWithFlags(s, s, s)
(s)getNeighbourZoneWithFlags(s, s, s, s)
Get Neighbour Zone With Flags Returns the name of a zone matching the specified flags in the current or neighbouring cells
(s)getNearestZoneWithFlags(f, f, s, s)
(s)getNearestZoneWithFlags(f, f, s, s, s)
(s)getNearestZoneWithFlagsStrict(f, f, s, s)
(s)getNearestZoneWithFlagsStrict(f, f, s, s, s)
Get Nearest Zone With Flags Return the zone nearest to a specified point that matches a set of specified criteria, with or without considering the zone's free space

Named Entities

Function Documentation Description
()createNamedEntity(s) Create Named Entity Creates a named entity in the current AI service
()setNamedEntityProp(s, s, s)
()setNamedEntityPropCb(s, s, s)
Set Named Entity Prop Set a property of an existing named entity
(s)getNamedEntityProp(s, s) Get Named Entity Prop Returns the content of a named entity property
()destroyNamedEntity(s) Destroy Named Entity Destroy a named entity
()addNamedEntityListener(s, s, f)
()addNamedEntityListener(s, s, s)
Add Named Entity Listener Associates a user event or script function in the current NPC group to trigger when a named entity property changes
()delNamedEntityListener(s, s, f)
()delNamedEntityListener(s, s, s)
Delete Named Entity Listener Removes a listener in the current NPC group from a named entity property

Dyn zone stuff

Function Documentation Description
()setDynEnergy(s, f, f) Set Dyn Energy Set energy values on an index, on all groups matching the specified request
()copyDynEnergy(s, f, f) Copy Dyn Energy Copy energy values from one index to another on groups that match a specified request

Attackable and aggro states, eat and rest modes, spawn options

Function Documentation Description
()setAggro(f, f) Set Aggro Set the aggro range and update period of the current group
()setCanAggro(f) Set Can Aggro Set whether a bot can aggro or not
()setAttackable(f) Set Attackable Set a group as attackable or non-attackable by bots and players
()setPlayerAttackable(f) Set Player Attackable Set whether a group is attackable by players or not
()setBotAttackable(f) Set Bot Attackable Set whether the group is attackable by bots or not
()setFactionAttackableAbove(s, f, f) Set Faction Attackable Above Set the attackable status of a group based on player faction fame threshold
()setFactionAttackableBelow(s, f, f) Set Faction Attackable Below Makes a group attackable by players with negative fame for a specific faction
()setMode(s) Set Mode Sets the mode of every bot of a group
()setDespawnTime(f) Set Despawn Time Set the time before the current group is despawned
()setRespawnTime(f) Set Respawn Time Sets the time in game cycles before the current group being respawned
()setAutoSpawn(f) Set Auto Spawn Sets whether the current group should respawn automatically after despawn

setFactionProp_ss_

addProfileParameter_s_ addProfileParameter_ss_ addProfileParameter_sf_

removeProfileParameter_s_

addPersistentProfileParameter_s_ addPersistentProfileParameter_ss_ addPersistentProfileParameter_sf_

removePersistentProfileParameter_s_

addBotChat_s_ clearBotChat__

Cool stuff

Function Documentation Description
()setSheet(s) Set Sheet Change the sheet of a creature
()setClientSheet(s) Set Client Sheet Change the client sheet of a creature to affect its visual appearance

Weird stuf

Function Documentation Description
()setHealer(f) Set Healer Sets the group as a healer (Not ready for production use)

ignoreOffensiveActions_f_ maxHitRange_f_

Phrase management

setSimplePhrase_ss_

Persistency Functions

dataGetVar_s_s dataGetVar_s_f

dataSetVar_ss_ dataSetVar_sf_

dataSave__

Boss Functions

Variadic Phrases

Function Documentation Description
()phraseBegin() Phrase Begin Clears the parameters stack used when creating a customized message via other phrase functions
()phrasePushValue(s, f) Phrase Push Value Push a numeric value onto the parameter stack used for creating customized messages
()phrasePushString(s, s) Phrase Push String Push a value as a string on the parameter stack
()phraseEndNpcMsg(f, s, s) Phrase End NPC Msg Send a message with parameters through a bot chat bubble
()phraseEndSystemMsg(f, s, s) Phrase End System Msg Send a message with parameters through a system broadcast message
()phraseEndEmoteMsg(f, s) Phrase End Emote Msg Send a custom emote message with parameters through a chat message

Time and Date

Function Documentation Description
(s)getServerTime() Get Server Time Returns the current server time as a string in seconds since 1970
(s)getServerTimeStr() Get Server Time String Returns the server time as a debug string
(s)getRyzomDate() Get Ryzom Date Returns the Ryzom game cycle tick count
(s)getRyzomDateStr() Get Ryzom Date String Returns the current Ryzom date and time as a debug string

Player Info

Function Documentation Description
(f)isPlayerAlived(s) Is Player Alived Checks if a player is alive based on their entity ID
(f)getPlayerStat(s, s) Get Player Stat Retrieve a specific player stat given a player EntityId and the stat name
(f)getPlayerDistance(f, s) Get Player Distance Calculate the distance between a player and a bot in meters

getCurrentPlayerEid__s

queryEgs_sscfs_ queryEgs_ssscfs_

Bot Info

Function Documentation Description
(f)getBotIndex(s) Get Bot Index Get the bot index in the group by its entity ID
(s)getBotEid(f) Get Bot Eid Get the bot's entity ID by its index in the group
(s)getCurrentSpeakerEid() Get Current Speaker Eid Returns the entity ID of the bot at which the player is clicking

getBotIndexByName_s_f isGroupAlived__f isBotAlived_f_f

Aggro Functions

clearAggroList_f_ clearAggroList__

getCurrentPlayerAggroListTarget_f_s getRandomPlayerAggroListTarget_f_s getAggroListElement_ff_s getAggroListSize_f_f setAggroListTarget_fs_ setGroupAggroListTarget_s_ setManagerAggroListTarget_ss_

Teleport Functions

Function Documentation Description
()summonPlayer(f, s) Summon Player Summons a player to a bot by using the player's EntityId and the index of the bot
()teleportNear(f, f, f, c) Teleport Near Teleports a player to a specific location and sends notification user events of the teleportation to the specified NPC group
()teleportPlayer(s, f, f, f, f) Teleport Player Teleports a player to a specified position with a given heading

Misc Functions

Functions which do not relate to the current NPC group context.

General Purpose

Function Documentation Description
()import(s) Import Import and execute a script defined in a script rep

Math Functions

Function Documentation Description
(f)clamp(f, f, f) Clamp Restricts a value between two limits and returns the clamped value
(f)min(f, f) Min Returns the lowest of two values
(f)max(f, f) Max Returns the highest of two values
(f)rndm(f, f) Random Generates a random float value within the specified inclusive min and exclusive max bounds
(f)floor(f) Floor Returns the highest integer lower than or equal to a given real value
(f)ceil(f) Ceil Returns the lowest integer higher than or equal to an input value
(f)round(f) Round Rounds the input value to the nearest integer
(f)abs(f) Abs Returns the absolute value of the input value
(f)sin(f) Sin Returns the sinus of the input value
(f)asin(f) Asin Returns the arcsine of an input value
(f)sinh(f) Sinh Returns the hyperbolic sinus of an input value
(f)cos(f) Cos Returns the cosine of an input value
(f)acos(f) Acos Returns the arccosine of an input value
(f)cosh(f) Cosh Returns the hyperbolic cosine of the input value

tan_f_f atan_f_f tanh_f_f sqrt_f_f exp_f_f pow_ff_f

String Functions

strlen_s_f

Function Documentation Description
(s)substr(s, f, f) Substring Returns a substring of a given string starting at a specified index with a specified length
(f)strtof(s)
(f, f)strtof(s)
(f, f, f)strtof(s)
String to Float Convert a string to a float

NeL Variables

Function Documentation Description
()setNelVar(s, f)
()setNelVar(s, s)
Set NeL Variable Set the content of a NeL variable

getNelVar_s_f getNelVar_s_s

delNelVar_sf_ delNelVar_ss_

setGlobalNelVar_sf_ setGlobalNelVar_ss_

loadFile_s_

Foreign NPC Managers

spawnManager_s_ despawnManager_s_

Other

Other

setZoneState_sf_ break__ getName_c_s

context__c warning_s_ info_s_ debug_s_ warning_f_ info_f_ debug_f_

Outpost

getOutpostStateName__s isOutpostTribeOwner__f isOutpostGuildOwner__f setOupostMode_ss_

Clone this wiki locally