AI Lua API: Difference between revisions

From Off Grid Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- This file is auto generated, please don't edit manually! -->
<!-- This file is auto generated, please don't edit manually! -->
= AI Gestures =
= AI =
== Description ==
== Description ==
The enums on this page can be used by AI agent definitions to play an animation when an action is taken. These enums map directly on to states in the character animator, which is shared by all characters. Make sure you type the name exactly as it appears here, it's case sensitive.
API to control the logic of AI in the mission
== Fields ==
== Functions ==
=== LookAround ===
=== Pause ===
Looks from side to side.
<syntaxhighlight source lang="lua">AI.Pause(characterName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|}
'''Description''': Pauses the agent, and stops it from doing anything.


=== LookAtPhone ===
'''Returns''': Nothing
Retrieves phone from pocket, has a look at it, then puts it away.


=== StandingTypingCalm ===
'''Notes''': The AI will be hidden from networks, meaning it will no longer interact with devices or send/receive messages.
Typing from a standing position, in a fairly normal manner.
=== Unpause ===
<syntaxhighlight source lang="lua">AI.Unpause(characterName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|}
'''Description''': Unpauses a hidden agent, resuming standard behaviour.


=== StandingTypingStealth ===
'''Returns''': Nothing
Typing from a standing position, in a sneaky manner.


=== StandingFilingCabinetSearch ===
=== IsPaused ===
Searches a filing cabinet.
<syntaxhighlight source lang="lua">AI.IsPaused(characterName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|}
'''Description''': Returns a bool based on if a character is currently paused or not


=== StandingLookAtHipHeight ===
'''Returns''': bool
Not sure.


=== StandingAmokDeviceHit ===
=== AddGoal ===
Hits a device that's in front of the character.
<syntaxhighlight source lang="lua">AI.AddGoal(characterName, goal)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| goal || Lua Table
|}
'''Description''': Adds a defined goal


=== UseSodaMachine ===
'''Returns''': Nothing
Press button, retrieve soda, drink it, discard can.


=== UseSodaMachineHacked ===
=== RemoveGoal ===
Press button, get hit by can, keel over.
<syntaxhighlight source lang="lua">AI.RemoveGoal(characterName, goalName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| goalName || string
|}
'''Description''': Removes any defined goals


=== UseCoffeeMachine ===
'''Returns''': Nothing
Press button, retrieve coffee cup, drink.


=== UseCoffeeMachineHacked ===
=== AddTemporaryGoal ===
Press button, get hit by steam, panic and writhe in pain.
<syntaxhighlight source lang="lua">AI.AddTemporaryGoal(characterName, goal)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| goal || Lua Table
|}
'''Description''': Adds a goal, taking top priority, to the named AI


=== DanceHipHop ===
'''Returns''': Nothing
Hip hop dancing.


=== DanceGuitar ===
'''Notes''': This goal will be removed from the AI once complete. If it isn't achievable it will be removed immediately.
Air guitar!
=== GetNPCProfileByTag ===
<syntaxhighlight source lang="lua">AI.GetNPCProfileByTag(characterName, tag)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| tag || string
|}
'''Description''': Get all values of a tag from a chaarcter's profile, if the tag exists.


=== DanceSalsa ===
'''Returns''': System.String[]
Strictly come Off Grid.


=== Yawn ===
=== Lua_CheckNPCProfile ===
Yawn, with arms outstretched.
<syntaxhighlight source lang="lua">AI.Lua_CheckNPCProfile(characterName, tag, value)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| tag || string
|-
| value || string
|}
'''Description''': Check if character's profile data contains a specific tag wiht a specific value


=== StandingTalkingCalmly ===
'''Returns''': bool
Standing talking calmly with hands near waist.


=== StandingTalkingAngrily ===
=== GetNPCStat ===
Standing talking angrily with hand gestures.
<syntaxhighlight source lang="lua">AI.GetNPCStat(characterName, statName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| statName || string
|}
'''Description''': Returns current value of NPC's stat


=== StandingUseTazer ===
'''Returns''': number
Standing raises right arm in front.


=== StandingPhoneMalfunctioning ===
'''Notes''': This is only intended for debugging purposes, and not recommended in any actual game scripts.
Gets phone out, swipes frantically, puts phone away and looks around.
=== SetNPCStat ===
<syntaxhighlight source lang="lua">AI.SetNPCStat(characterName, statName, newValue)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| statName || string
|-
| newValue || number
|}
'''Description''': Sets an NPC's AI stat to absolute value


=== StandingLookingHunched ===
'''Returns''': Nothing
Standing, almost crouches down and peers around.


=== StandingLookingSideToSide ===
'''Notes''': This is only intended for debugging purposes, and not recommended in any actual game scripts.
Standing, looks side to side.
=== AlterNPCStat ===
<syntaxhighlight source lang="lua">AI.AlterNPCStat(characterName, statName, statDelta)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| statName || string
|-
| statDelta || number
|}
'''Description''': Alters an NPC's AI stat by relative value


=== StandingHitFace ===
'''Returns''': Nothing
Standing, quickly brings hands to face.


=== PickupLow ===
=== AlterNPCWorldState ===
Standing pick up from ankle hight.
<syntaxhighlight source lang="lua">AI.AlterNPCWorldState(characterName, state, value)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| state || string
|-
| value || Lua Type
|}
'''Description''': Change the World State of an NPC.


=== PickupMed ===
'''Returns''': Nothing
Standing pick up from waist hight.


=== PickupHigh ===
=== FavourInterest ===
Standing pick up from head hight.
<syntaxhighlight source lang="lua">AI.FavourInterest(characterName, device, permanent)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| device || string
|-
| permanent || bool
|}
'''Description''': Reduce the cost of an AI using a particular Interest


=== LockedDoor ===
'''Returns''': Nothing
Standing, puts hand on handle, struggles.


=== WashingDryingHands ===
'''Notes''': If permanent is false, the cost will revert to normal the next time this is successfully used
Standing, hands out in front rubbing together.
=== AvoidInterest ===
<syntaxhighlight source lang="lua">AI.AvoidInterest(characterName, device, permanent)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| device || string
|-
| permanent || bool
|}
'''Description''': Increase the cost of an AI using a particular Interest


=== WaitingHandsOnHips ===
'''Returns''': Nothing
Standing with hands on hips.


=== WashFace ===
'''Notes''': If permanent is false, the cost will revert to normal the next time this is successfully used
Standing washing face.
=== SetNPCFavouredComputer ===
<syntaxhighlight source lang="lua">AI.SetNPCFavouredComputer(characterName, computer)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| computer || MissionObject
|}
'''Description''': Set NPC's computer, this will be used for a variety of actions


=== UseSnackMachine ===
'''Returns''': Nothing


=== AddAction ===
<syntaxhighlight source lang="lua">AI.AddAction(characterName, action)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| action || Lua Table
|}
'''Description''': Adds an action that can be used immediately


=== UseSnackMachineHacked ===
'''Returns''': Nothing


=== RemoveAction ===
<syntaxhighlight source lang="lua">AI.RemoveAction(characterName, actionName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| characterName || string
|-
| actionName || string
|}
'''Description''': Removes any action
'''Returns''': Nothing




Line 101: Line 275:
This file is auto generated, please don't edit manually!
This file is auto generated, please don't edit manually!


'''Docs last hacked together on''': 23/07/2020 11:58
'''Docs last hacked together on''': 29/08/2023 16:24
[[Category:Modding]][[Category:LuaAPI]]
[[Category:Modding]][[Category:LuaAPI]]

Latest revision as of 13:50, 29 August 2023

AI

Description

API to control the logic of AI in the mission

Functions

Pause

AI.Pause(characterName)

Expected parameter types

Name Type
characterName string

Description: Pauses the agent, and stops it from doing anything.

Returns: Nothing

Notes: The AI will be hidden from networks, meaning it will no longer interact with devices or send/receive messages.

Unpause

AI.Unpause(characterName)

Expected parameter types

Name Type
characterName string

Description: Unpauses a hidden agent, resuming standard behaviour.

Returns: Nothing

IsPaused

AI.IsPaused(characterName)

Expected parameter types

Name Type
characterName string

Description: Returns a bool based on if a character is currently paused or not

Returns: bool

AddGoal

AI.AddGoal(characterName, goal)

Expected parameter types

Name Type
characterName string
goal Lua Table

Description: Adds a defined goal

Returns: Nothing

RemoveGoal

AI.RemoveGoal(characterName, goalName)

Expected parameter types

Name Type
characterName string
goalName string

Description: Removes any defined goals

Returns: Nothing

AddTemporaryGoal

AI.AddTemporaryGoal(characterName, goal)

Expected parameter types

Name Type
characterName string
goal Lua Table

Description: Adds a goal, taking top priority, to the named AI

Returns: Nothing

Notes: This goal will be removed from the AI once complete. If it isn't achievable it will be removed immediately.

GetNPCProfileByTag

AI.GetNPCProfileByTag(characterName, tag)

Expected parameter types

Name Type
characterName string
tag string

Description: Get all values of a tag from a chaarcter's profile, if the tag exists.

Returns: System.String[]

Lua_CheckNPCProfile

AI.Lua_CheckNPCProfile(characterName, tag, value)

Expected parameter types

Name Type
characterName string
tag string
value string

Description: Check if character's profile data contains a specific tag wiht a specific value

Returns: bool

GetNPCStat

AI.GetNPCStat(characterName, statName)

Expected parameter types

Name Type
characterName string
statName string

Description: Returns current value of NPC's stat

Returns: number

Notes: This is only intended for debugging purposes, and not recommended in any actual game scripts.

SetNPCStat

AI.SetNPCStat(characterName, statName, newValue)

Expected parameter types

Name Type
characterName string
statName string
newValue number

Description: Sets an NPC's AI stat to absolute value

Returns: Nothing

Notes: This is only intended for debugging purposes, and not recommended in any actual game scripts.

AlterNPCStat

AI.AlterNPCStat(characterName, statName, statDelta)

Expected parameter types

Name Type
characterName string
statName string
statDelta number

Description: Alters an NPC's AI stat by relative value

Returns: Nothing

AlterNPCWorldState

AI.AlterNPCWorldState(characterName, state, value)

Expected parameter types

Name Type
characterName string
state string
value Lua Type

Description: Change the World State of an NPC.

Returns: Nothing

FavourInterest

AI.FavourInterest(characterName, device, permanent)

Expected parameter types

Name Type
characterName string
device string
permanent bool

Description: Reduce the cost of an AI using a particular Interest

Returns: Nothing

Notes: If permanent is false, the cost will revert to normal the next time this is successfully used

AvoidInterest

AI.AvoidInterest(characterName, device, permanent)

Expected parameter types

Name Type
characterName string
device string
permanent bool

Description: Increase the cost of an AI using a particular Interest

Returns: Nothing

Notes: If permanent is false, the cost will revert to normal the next time this is successfully used

SetNPCFavouredComputer

AI.SetNPCFavouredComputer(characterName, computer)

Expected parameter types

Name Type
characterName string
computer MissionObject

Description: Set NPC's computer, this will be used for a variety of actions

Returns: Nothing

AddAction

AI.AddAction(characterName, action)

Expected parameter types

Name Type
characterName string
action Lua Table

Description: Adds an action that can be used immediately

Returns: Nothing

RemoveAction

AI.RemoveAction(characterName, actionName)

Expected parameter types

Name Type
characterName string
actionName string

Description: Removes any action

Returns: Nothing


This file is auto generated, please don't edit manually!

Docs last hacked together on: 29/08/2023 16:24