Mission Lua API: Difference between revisions

From Off Grid Wiki
Jump to navigation Jump to search
(Add Mission lua api documentation)
 
No edit summary
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<!-- This file is auto generated, please don't edit manually! -->
= Mission =
= Mission =
== Description ==
== Description ==
The Mission API controls the flow of the mission, this includes starting and stopping the mission, triggering hints and messages and sending data between varying mission characters
The Mission API controls the flow of the mission, this includes starting and stopping the mission, and dealing with objectives and other mission-related information
== Functions ==
== Functions ==
=== MissionStarted ===
=== MissionStarted ===
Line 17: Line 18:
'''Returns''': Nothing
'''Returns''': Nothing


=== AddCharacter ===
=== MissionFailed ===
<syntaxhighlight source lang="lua">Mission.AddCharacter(characterTable)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.MissionFailed()</syntaxhighlight>
'''Description''': This function will fail the current mission, as if Joe had been tazed (or similar).
 
'''Returns''': Nothing
 
=== SpawnCharacter ===
<syntaxhighlight source lang="lua">Mission.SpawnCharacter(internalName)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| characterTable || Lua Table
! Name !! Type
|-
| internalName || string
|}
|}
'''Description''': Register and spawn a chracter in the game
'''Description''': Spawn a registered character in the game


'''Returns''': Nothing
'''Returns''': Nothing


=== SendMessageToPlayer ===
=== ObjectiveIsActive ===
<syntaxhighlight source lang="lua">Mission.SendMessageToPlayer(sender, message)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.ObjectiveIsActive(objectiveName)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| sender || string
! Name !! Type
|-
|-
| message || string
| objectiveName || string
|}
|}
'''Description''': Send an SMS with the contents _message_ from _sender_
'''Description''': Returns true if objective has been started but not completed yet.


'''Returns''': Nothing
'''Returns''': bool


=== SendMessageToDevice ===
=== ObjectiveIsCompleted ===
<syntaxhighlight source lang="lua">Mission.SendMessageToDevice(sender, recipiantName, message)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.ObjectiveIsCompleted(objectiveName)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| sender || string
! Name !! Type
|-
| objectiveName || string
|}
'''Description''': Returns true if objective has been completed.
 
'''Returns''': bool
 
=== StartObjective ===
<syntaxhighlight source lang="lua">Mission.StartObjective(objectiveName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
|-
| recipiantName || string
! Name !! Type
|-
|-
| message || string
| objectiveName || string
|}
|}
'''Description''': Sends an abitrary message to a hackable device, this can be used for intercommunication between devices
'''Description''': Start the provided objective


'''Returns''': Nothing
'''Returns''': Nothing


=== AddNetwork ===
=== CompleteObjective ===
<syntaxhighlight source lang="lua">Mission.AddNetwork(networkTable)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.CompleteObjective(objectiveName)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| networkTable || Lua Table
! Name !! Type
|-
| objectiveName || string
|}
|}
'''Description''': Register a network to the game
'''Description''': Complete the provided objective


'''Returns''': Nothing
'''Returns''': Nothing


=== ConnectToNetwork ===
=== GetCurrentObjective ===
<syntaxhighlight source lang="lua">Mission.ConnectToNetwork(characterTable, networkName, accessKey)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.GetCurrentObjective()</syntaxhighlight>
'''Description''': Get the name of the current objective
 
'''Returns''': string
 
=== TriggerAutoSave ===
<syntaxhighlight source lang="lua">Mission.TriggerAutoSave()</syntaxhighlight>
'''Description''': Triggers an autosave, only if the game is current in a mission
 
'''Returns''': Nothing
 
=== SetMissionObjectInteractionRequirement ===
<syntaxhighlight source lang="lua">Mission.SetMissionObjectInteractionRequirement(name, requirement)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| characterTable || Lua Table
! Name !! Type
|-
|-
| networkName || string
| name || string
|-
|-
| accessKey || string
| requirement || number
|}
|}
'''Description''': Connect a device to a specified network
'''Description''': Sets if a MissionObject should request the player to sleect an item or data file before interaction
 
'''Returns''': Nothing
 
=== DevicesConnected ===
<syntaxhighlight source lang="lua">Mission.DevicesConnected()</syntaxhighlight>
'''Description''': Call this AFTER all Devices have been connected to their networks. This allows DataPoints to be processed correctly.


'''Returns''': Nothing
'''Returns''': Nothing


=== SendData ===
=== SetPlayerControlled ===
<syntaxhighlight source lang="lua">Mission.SendData(sender, receiver, dataTable)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.SetPlayerControlled(tf)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| sender || Lua Table
! Name !! Type
|-
| tf || bool
|}
'''Description''': Set whether the player is currently in control (or not). Used for cutscenes, and other things that we haven't thought of yet.
 
'''Returns''': Nothing
 
=== GetBool ===
<syntaxhighlight source lang="lua">Mission.GetBool(key)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
|-
| receiver || Lua Table
! Name !! Type
|-
|-
| dataTable || Lua Table
| key || string
|}
|}
'''Description''': Send a data file from one device to another
'''Description''': Get a boolean value of a key in mission Lua script. Returns false if key doesn't exist.


'''Returns''': Nothing
'''Returns''': bool


'''Notes''': Much like _ConnectToNetwork_ both _senderName_ and _receiverName_ can be character names (assuming those characters have net devices)
=== SetBool ===
=== SetNetDeviceNFCData ===
<syntaxhighlight source lang="lua">Mission.SetBool(key, newBool)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.SetNetDeviceNFCData(deviceTable, dataTable)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| deviceTable || Lua Table
! Name !! Type
|-
| key || string
|-
|-
| dataTable || Lua Table
| newBool || bool
|}
|}
'''Description''': Sets NFC data on a mission object
'''Description''': Sets a boolean value of a key in mission Lua script.


'''Returns''': Nothing
'''Returns''': Nothing


=== SetNetDeviceNFC ===
=== GetString ===
<syntaxhighlight source lang="lua">Mission.SetNetDeviceNFC(deviceTable, enabled)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.GetString(key)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| deviceTable || Lua Table
! Name !! Type
|-
|-
| enabled || bool
| key || string
|}
|}
'''Description''': Set if a mission object supports NFCAddNetDevice
'''Description''': Get a string value of a key in mission Lua script. Returns empty if key doesn't exist.


'''Returns''': Nothing
'''Returns''': string


=== AddNetDevice ===
=== SetString ===
<syntaxhighlight source lang="lua">Mission.AddNetDevice(deviceTable)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.SetString(key, newString)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| deviceTable || Lua Table
! Name !! Type
|-
| key || string
|-
| newString || string
|}
|}
'''Description''': Add a network device to the mission that's not hackable but can communicate with other devices
'''Description''': Sets a string value of a key in mission Lua script.


'''Returns''': Nothing
'''Returns''': Nothing


=== AddHackableDevice ===
=== GetNumber ===
<syntaxhighlight source lang="lua">Mission.AddHackableDevice(deviceTable)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.GetNumber(key)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| deviceTable || Lua Table
! Name !! Type
|-
| key || string
|}
|}
'''Description''': Add a hackable device to the mission
'''Description''': Get a numeric value of a key in mission Lua script. Returns 0 if key doesn't exist.


'''Returns''': Nothing
'''Returns''': number


=== StartObjective ===
=== SetNumber ===
<syntaxhighlight source lang="lua">Mission.StartObjective(objective)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.SetNumber(key, newValue)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| objective || Lua Table
! Name !! Type
|-
| key || string
|-
| newValue || number
|}
|}
'''Description''': Start the provided objective
'''Description''': Sets a numeric value of a key in mission Lua script.


'''Returns''': Nothing
'''Returns''': Nothing


=== CompleteObjective ===
=== StartVibrationEvent ===
<syntaxhighlight source lang="lua">Mission.CompleteObjective(objective)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.StartVibrationEvent(objectName)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| objective || Lua Table
! Name !! Type
|-
| objectName || string
|}
|}
'''Description''': Complete the provided objective
'''Description''': Start a mission object vibration event


'''Returns''': Nothing
'''Returns''': Nothing


=== SendNextHint ===
=== StopVibrationEvent ===
<syntaxhighlight source lang="lua">Mission.SendNextHint(objective)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.StopVibrationEvent(objectName)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| objective || Lua Table
! Name !! Type
|-
| objectName || string
|}
|}
'''Description''': Send the next hint in the Objective's hint array
'''Description''': Stop a mission object vibration event


'''Returns''': Nothing
'''Returns''': Nothing


=== SendNextMessage ===
=== SpawnWanderNPCs ===
<syntaxhighlight source lang="lua">Mission.SendNextMessage(fromCharacter, objective)</syntaxhighlight>
<syntaxhighlight source lang="lua">Mission.SpawnWanderNPCs(spawnPoint, spawnNum, characterPrefabs, headProps, colorTextures, metalTextures, gestures)</syntaxhighlight>
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
|-
| fromCharacter || Lua Table
! Name !! Type
|-
| spawnPoint || Lua Type
|-
| spawnNum || number
|-
| characterPrefabs || Lua Type
|-
|-
| objective || Lua Table
| headProps || Lua Type
|-
| colorTextures || Lua Type
|-
| metalTextures || Lua Type
|-
| gestures || Lua Type
|}
|}
'''Description''': Send the next message in the Objective's message array from _fromCharacter_
'''Description''': Spawns various Wander NPCs in a randomized way


'''Returns''': Nothing
'''Returns''': Nothing


=== GetCurrentObjective ===
'''Notes''': All the parameters, expect the spawnNum, can be a string or a table of strings. For the head props and the the gestures the string "None" can be used to have the possibility to not have any head props and gestures, respectively, in the wander NPCs. Also for the color textures and metal textures the string "Default" can be used for the character's default textures.
<syntaxhighlight source lang="lua">Mission.GetCurrentObjective()</syntaxhighlight>
'''Description''': Get the name of the current objective
 
'''Returns''': string




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


'''Docs last hacked together on''': 09/05/2017 12:46
'''Docs last hacked together on''': 13/10/2021 15:55
[[Category:Modding]][[Category:LuaAPI]]

Revision as of 08:57, 14 October 2021

Mission

Description

The Mission API controls the flow of the mission, this includes starting and stopping the mission, and dealing with objectives and other mission-related information

Functions

MissionStarted

Mission.MissionStarted()

Description: This should be called once the initial state of the mission has been set It will cause the game to begin gameplay

Returns: Nothing

MissionCompleted

Mission.MissionCompleted()

Description: This should be called when the final objective of the mission has been completed It will trigger the game to fade to black and return to the main menu

Returns: Nothing

MissionFailed

Mission.MissionFailed()

Description: This function will fail the current mission, as if Joe had been tazed (or similar).

Returns: Nothing

SpawnCharacter

Mission.SpawnCharacter(internalName)

Expected parameter types

Name Type
internalName string

Description: Spawn a registered character in the game

Returns: Nothing

ObjectiveIsActive

Mission.ObjectiveIsActive(objectiveName)

Expected parameter types

Name Type
objectiveName string

Description: Returns true if objective has been started but not completed yet.

Returns: bool

ObjectiveIsCompleted

Mission.ObjectiveIsCompleted(objectiveName)

Expected parameter types

Name Type
objectiveName string

Description: Returns true if objective has been completed.

Returns: bool

StartObjective

Mission.StartObjective(objectiveName)

Expected parameter types

Name Type
objectiveName string

Description: Start the provided objective

Returns: Nothing

CompleteObjective

Mission.CompleteObjective(objectiveName)

Expected parameter types

Name Type
objectiveName string

Description: Complete the provided objective

Returns: Nothing

GetCurrentObjective

Mission.GetCurrentObjective()

Description: Get the name of the current objective

Returns: string

TriggerAutoSave

Mission.TriggerAutoSave()

Description: Triggers an autosave, only if the game is current in a mission

Returns: Nothing

SetMissionObjectInteractionRequirement

Mission.SetMissionObjectInteractionRequirement(name, requirement)

Expected parameter types

Name Type
name string
requirement number

Description: Sets if a MissionObject should request the player to sleect an item or data file before interaction

Returns: Nothing

DevicesConnected

Mission.DevicesConnected()

Description: Call this AFTER all Devices have been connected to their networks. This allows DataPoints to be processed correctly.

Returns: Nothing

SetPlayerControlled

Mission.SetPlayerControlled(tf)

Expected parameter types

Name Type
tf bool

Description: Set whether the player is currently in control (or not). Used for cutscenes, and other things that we haven't thought of yet.

Returns: Nothing

GetBool

Mission.GetBool(key)

Expected parameter types

Name Type
key string

Description: Get a boolean value of a key in mission Lua script. Returns false if key doesn't exist.

Returns: bool

SetBool

Mission.SetBool(key, newBool)

Expected parameter types

Name Type
key string
newBool bool

Description: Sets a boolean value of a key in mission Lua script.

Returns: Nothing

GetString

Mission.GetString(key)

Expected parameter types

Name Type
key string

Description: Get a string value of a key in mission Lua script. Returns empty if key doesn't exist.

Returns: string

SetString

Mission.SetString(key, newString)

Expected parameter types

Name Type
key string
newString string

Description: Sets a string value of a key in mission Lua script.

Returns: Nothing

GetNumber

Mission.GetNumber(key)

Expected parameter types

Name Type
key string

Description: Get a numeric value of a key in mission Lua script. Returns 0 if key doesn't exist.

Returns: number

SetNumber

Mission.SetNumber(key, newValue)

Expected parameter types

Name Type
key string
newValue number

Description: Sets a numeric value of a key in mission Lua script.

Returns: Nothing

StartVibrationEvent

Mission.StartVibrationEvent(objectName)

Expected parameter types

Name Type
objectName string

Description: Start a mission object vibration event

Returns: Nothing

StopVibrationEvent

Mission.StopVibrationEvent(objectName)

Expected parameter types

Name Type
objectName string

Description: Stop a mission object vibration event

Returns: Nothing

SpawnWanderNPCs

Mission.SpawnWanderNPCs(spawnPoint, spawnNum, characterPrefabs, headProps, colorTextures, metalTextures, gestures)

Expected parameter types

Name Type
spawnPoint Lua Type
spawnNum number
characterPrefabs Lua Type
headProps Lua Type
colorTextures Lua Type
metalTextures Lua Type
gestures Lua Type

Description: Spawns various Wander NPCs in a randomized way

Returns: Nothing

Notes: All the parameters, expect the spawnNum, can be a string or a table of strings. For the head props and the the gestures the string "None" can be used to have the possibility to not have any head props and gestures, respectively, in the wander NPCs. Also for the color textures and metal textures the string "Default" can be used for the character's default textures.


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

Docs last hacked together on: 13/10/2021 15:55