Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
venv
_build
__pycache__
.DS_Store
56 changes: 36 additions & 20 deletions docs/game-mechanics/scripting-system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,42 @@ Methods

- Localize(key: string)

GameObject
----------

- obj:GetVar(key: string)
- obj:SetVar(key: string, value: any)
- obj:SetNetworkVar(key: string, value: any)
- obj:GetNetworkVar(key: string) -> any
- obj:SendLuaNotificationRequest{requestTarget: GameObject, messageName: string}
- obj:SendLuaNotificationCancel{requestTarget: GameObject, messageName: string}
- obj:GetRotation() -> Rotation
- obj:Exists() -> bool
- obj:GetFlag{iFlagID: int} -> Flag
- obj:GetLocationsVisited() -> Locations
- obj:SetRotation{x: float , y: float, z: float , w: float}
- obj:SetProximityRadius{iconID: int, radius: int, name: string}
- obj:UnsetProximityRadius{name: string}
- obj:CheckListOfPreconditionsFromLua{PreconditionsToCheck: ?, requestingID: GameObject}
- obj:RequestPickTypeUpdate()
- obj:GetID()
- obj:NotifyObject{ name: string, param1: int, ObjIDSender: ObjectID}
GameObject :samp:`obj`
----------------------
| :samp:`function GetVar(key: string)`
| Gets the variable associated with the key :samp:`key` attached to :samp:`obj`. Example :script:`ai/RACING/OBJECTS/RACE_SMASH_SERVER.lua`.
| :samp:`function SetVar(key: string, value: any)`
| Sets a variable on the Entity :samp:`obj` with the key :samp:`key` and the value :samp:`value`. Example :script:`ai/RACING/OBJECTS/RACE_SMASH_SERVER.lua`.
| :samp:`function SetNetworkVar(key: string, value: any)`
| Sets a networked variable on the Entity :samp:`obj` with the key :samp:`key` and the value :samp:`value`. The message :gm:client:`ScriptNetworkVarUpdate` is then sent to the client to communicate this update. Example :script:`ai/FV/L_FV_PANDA_SERVER.lua`.
| :samp:`function GetNetworkVar(key: string) -> any`
| Gets a networked variable associated with the key :samp:`key`. Example :script:`02_client/Enemy/General/L_DRAGON_SMASHING_GOLEM_QB_CLIENT.lua`.
| :samp:`function SendLuaNotificationRequest{requestTarget: GameObject, messageName: string}`
| Adds the function :file:`notify{messageName}` to the :samp:`obj` so that function is called when the same :file:`on{messageName}` is called on :samp:`obj`. Example :script:`equipmenttriggers/gempack.lua`.
| :samp:`function SendLuaNotificationCancel{requestTarget: GameObject, messageName: string}`
| Removes the function :file:`notify{messageName}` from :samp:`obj` notifications so the function is no longer called. Example :script:`equipmenttriggers/gempack.lua`.
| :samp:`function GetRotation() -> Rotation`
| Gets the rotation of the :samp:`obj`. The rotation is a :packet:`Quaternion <world/struct.Quaternion>`. Example :script:`client/ai/AG/L_AG_CUSTOM_ROCKET.lua`.
| :samp:`function SetRotation{x: float , y: float, z: float , w: float} or obj:SetRotation(Quaternion)`
| Sets the rotation for the :samp:`obj`. Example :script:`client/ai/AG/L_AG_CUSTOM_ROCKET.lua`.
| :samp:`function Exists() -> bool`
| Returns :samp:`true` of :samp:`obj` exists, :samp:`false` otherwise. Example :script:`client/ai/NP/L_NP_NPC.lua`
| :samp:`function GetFlag{iFlagID: int} -> Flag`
| Gets the flag :samp:`iFlagID` from :samp:`obj`. True if the flag is set, false otherwise. See :doc:`flag-system` for more info. Example :script:`02_client/Map/NT/L_NT_IMAGIMETER_VISIBILITY_CLIENT.lua`
| :samp:`function GetLocationsVisited() -> Locations`
| Gets the locations :samp:`obj` has visited. Example :script:`02_client/Map/General/L_CHOOSE_YOUR_DESTINATION_NS_TO_NT_CLIENT.lua`
| :samp:`function SetProximityRadius{iconID: int, radius: int, name: string, collisionGroup: int, shapeType: string, height: int}`
| Sets a proximity radius for :samp:`obj` with radius :samp:`radius`, height :samp:`height`, the shape :samp:`shapeType` and attaches it to the collisionGroup :samp:`collisionGroup`. This new proximity radius also has the name :samp:`name` and an icon :samp:`iconID`. Example :script:`ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT.lua`
| :samp:`function UnsetProximityRadius{name: string}`
| Removes the proximity radius from the object with the name :samp:`name`. Example :script:`ai/AG/L_AG_QB_Elevator.lua`
| :samp:`function CheckListOfPreconditionsFromLua{PreconditionsToCheck: string? (there seems to be comparison of this var to ""), requestingID: GameObject}`
| Checks whether the preconditions :samp:`PreconditionsToCheck` are met for the :samp:`obj`. If a :samp:`requestingID` is provided, :samp:`requestingID` is the GameObject that is checking the preconditions. Example :script:`02_client/Map/AM/L_SKULLKIN_DRILL_CLIENT.lua`
| :samp:`function RequestPickTypeUpdate()`
| Used to update interactions? Example :script:`02_client/Map/AM/L_BLUE_X_CLIENT.lua`
| :samp:`function GetID()`
| Gets the GameObjectID of :samp:`obj`. Example :script:`o_ChoicebuildBonus.lua`
| :samp:`function NotifyObject{ name: string, param1: int, ObjIDSender: ObjectID}`
| Notifies the :samp:`obj` of the notification :samp:`name` with the optional parameter :samp:`param1` and the sender being :samp:`ObjIDSender`. Example :script:`ai/FV/L_FV_CONSOLE_RIGHT_QUICKBUILD.lua`

Game Messages
^^^^^^^^^^^^^
Expand Down