Skip to content

functions

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

title: AI Script Function Reference description: published: true date: 2023-03-12T17:43:15.239Z tags: editor: markdown dateCreated: 2023-03-12T09:18:34.306Z

AI Script Functions

Quick reference list of native functions

NPC Group Functions

Spawn

spawn__ despawn_f_

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

Actions

setEvent_f_ getEventParam_f_f getEventParam_f_s setTimer_ff_ timerSetRyzomDaytime_fff_ timerDisable_f_ timerSuspend_f_ timerResume_f_ timerAdd_ff_ timerIsEnabled_f_f timerIsSuspended_f_f dssStartAct_ff_ postNextState_s_ moveToZone_ss_ waitInZone_s_ stopMoving__ 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_

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

giveRewardTo_sc_ giveReward_ssssc_

(Non-ring regular)

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_sf_

sitDown__ standUp__

emote_css_ emote_ss_ emote_s_

rename_s_ vpx_s_

npcSay_css_ npcSay_ss_

dssMessage_fsss_ 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

newNpcChildGroupPos_ssff_c newNpcChildGroupPos_ssff_ newNpcChildGroupPos_ssfff_c newNpcChildGroupPos_ssfff_

newNpcChildGroupMl_sssf_c newNpcChildGroupMl_sssf_ newNpcChildGroupMl_sssff_c newNpcChildGroupMl_sssff_

newNpcChildGroupPosMl_ssfff_c newNpcChildGroupPosMl_ssfff_ newNpcChildGroupPosMl_ssffff_c newNpcChildGroupPosMl_ssffff_

Primitive Lookup

getGroupTemplateWithFlags_ss_s getGroupTemplateWithFlags_sss_s

getZoneWithFlags_sss_s getZoneWithFlags_ssss_s

getNeighbourZoneWithFlags_sss_s getNeighbourZoneWithFlags_ssss_s

getNearestZoneWithFlags_ffss_s getNearestZoneWithFlags_ffsss_s getNearestZoneWithFlagsStrict_ffsss_s getNearestZoneWithFlagsStrict_ffss_s

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

NPC Group Parameters

getMidPos__ff getStateName__s setActivity_s_

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
()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_sff_ setFactionAttackableBelow_sff_ setMode_s_ setDespawnTime_f_ setRespawnTime_f_ setAutoSpawn_f_ setFactionProp_ss_ addProfileParameter_s_ addProfileParameter_ss_ addProfileParameter_sf_ removeProfileParameter_s_ addBotChat_s_ clearBotChat__

addPersistentProfileParameter_s_ addPersistentProfileParameter_ss_ addPersistentProfileParameter_sf_ removePersistentProfileParameter_s_

setSheet_s_ setClientSheet_s_ setHealer_f_

ignoreOffensiveActions_f_ maxHitRange_f_

Phrase management

setSimplePhrase_ss_

Persistency Functions

dataGetVar_s_s dataGetVar_s_f dataSetVar_ss_ dataSetVar_sf_ dataSave__

Boss Functions

Custom Phrases

phraseBegin__ phrasePushValue_sf_ phrasePushString_ss_ phraseEndNpcMsg_fss_ phraseEndSystemMsg_fss_ phraseEndEmoteMsg_fs_

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

getPlayerStat_ss_f getPlayerDistance_fs_f getCurrentPlayerEid__s queryEgs_sscfs_ queryEgs_ssscfs_

Bot Info

getBotIndex_s_f getBotEid_f_s getCurrentSpeakerEid__s 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.

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

abs_f_f sin_f_f asin_f_f sinh_f_f cos_f_f acos_f_f cosh_f_f tan_f_f atan_f_f tanh_f_f sqrt_f_f exp_f_f pow_ff_f

String Functions

strlen_s_f substr_sff_s

Function Documentation Description
(f)strtof(s)
(f, f)strtof(s)
(f, f, f)strtof(s)
String to Float Convert a string to a float
import_s_

NeL Variables

setNelVar_sf_ setNelVar_ss_

getNelVar_s_f getNelVar_s_s

delNelVar_sf_ delNelVar_ss_

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_

Scenario

setScenarioPoints_ff_ startScenarioTiming_f_ endScenarioTiming_f_

Clone this wiki locally