Counter-Strike Nexon

Counter-Strike Nexon

59 ratings
[Studio] Lua. Documentation
By FosterZ [koncha.su]
Since the developers did not submit the official Studio Lua. documentation available on Steam. I decided to write this myself for the community.

Lua 5.3 Reference Manual [www.lua.org]
Based on 1.5 CSO Korea Studio Script API [cso.dn.nexoncdn.co.kr]
   
Award
Favorite
Favorited
Unfavorite

Grateful to everyone!
Modules and Classes
Modules
Common
This module contains scripting functions that work together on both clients and servers.
Game
This module contains functions for scripts returned from the server.
UI
This module contains functions for scripts that are returned to the client.

Classes
Common.WeaponOption
Weapon options class
Game.Entity
Class of players and monsters
Game.EntityBlock
Studio device blocks
Game.Rule
Game rule class
Game.Monster
Game monsters class
Game.Player
Game players class
Game.SyncValue
Variables that are automatically synchronized to the client
Game.Weapon
Weapon class
UI.SyncValue
Variables that are automatically synchronized with the server
UI.Box
UI screen draws a specific rectangle
UI.Event
UI event callbacks
UI.Text
UI screen draws a specific text
Common
Module Common
This module contains scripting functions that work together on both clients and servers.

It is used in project.json
game.lua ui.lua


Function
GetWeaponOption (weaponid)
Get weapon option (WeaponOption)
UseWeaponInven (value)
Enable Weapon Inventory
SetSaveCurrentWeapons (value)
Set to save the current weapon
SetSaveWeaponInven (value)
Enable to save weapon inventory content (UseWeaponInven must be set first)
SetAutoLoad (value)
Load saved information automatically
DisableWeaponParts (value)
Disable Weapon Parts
DisableWeaponEnhance (value)
Disable Weapon Enhancement
DontGiveDefaultItems (value)
Do not give default weapon on start
DontCheckTeamKill (value)
Dont check Team Kills
UseScenarioBuymenu (value)
Make the store use the scenario store window
SetNeedMoney (value)
Set cost when you buy a gun
UseAdvancedMuzzle (value)
Draw the muzzle effect in a new form on shoot
SetMuzzleScale (value)
Fixed muzzle effect size on shoot
SetBloodScale (value)
Fixed blood effect size on hit
SetGunsparkScale (value)
Fixed effect size when bullet hit wall
SetHitboxScale (value)
Edit hitbox size
SetMouseoverOutline (value, color)
Make the outline visible when hovering over an entity such as a monster
SetUnitedPrimaryAmmoPrice (price)
Single price for all primary weapons shop
SetUnitedSecondaryAmmoPrice (price)
Single price for all secondary weapons shop
SetBuymenuWeaponList (list)
Store weapons list setting (requires UseScenarioBuymenu setting)

Tables
WEAPON
The script generates a editable weapon
color
Entity color

Class
WeaponOption
Set weapon stats for each weapon type. For example, if you modify the WeaponOption of an AK-47, the modified stats will be reflected for all AK-47s used in the game.

Functions

GetWeaponOption (weaponid) Get weapon option Parameters:
value: (bool) on/off

UseWeaponInven (value) Enable Weapon Inventory Parameters:
value: (bool) on/off

SetSaveCurrentWeapons (value) Set to save the current weapon Parameters:
value: (bool) on/off

SetSaveWeaponInven (value) Enable to save weapon inventory content (UseWeaponInven must be set first) Parameters:
value: (bool) on/off

SetAutoLoad (value) Load saved information automatically Parameters:
value: (bool) on/off

DisableWeaponParts (value) Disable Weapon Parts Parameters:
value: (bool) on/off

DisableWeaponEnhance (value) Disable Weapon Enhancement Parameters:
value: (bool) on/off

DontGiveDefaultItems (value) Do not give default weapon on start Parameters:
value: (bool) on/off

DontCheckTeamKill (value) Dont check Team Kills Parameters:
value: (bool) on/off

UseScenarioBuymenu (value) Make the store use the scenario store window Parameters:
value: (bool) on/off

SetNeedMoney (value) Set cost when you buy a gun Parameters:
value: (bool) on/off

UseAdvancedMuzzle (value) Draw the muzzle effect in a new form on shoot Parameters:
value: (bool) on/off

SetMuzzleScale (value) Fixed muzzle effect size on shoot Parameters:
value: (number) scale

SetBloodScale (value) Fixed blood effect size on hit Parameters:
value: (number) scale

SetGunsparkScale (value) Fixed effect size when bullet hit wall Parameters:
value: (number) scale

SetHitboxScale (value) Edit hitbox size Parameters:
value: (number) scale

SetMouseoverOutline (value, color) Make the outline visible when hovering over an entity such as a monster Parameters:
value: (bool) on/off color: (color) overline color

SetUnitedPrimaryAmmoPrice (price) Single price for all primary weapons shop Parameters:
price: (int) cost

SetUnitedSecondaryAmmoPrice (price) Single price for all secondary weapons shop Parameters:
price: (int) cost

SetBuymenuWeaponList (list) Store weapons list setting (requires UseScenarioBuymenu setting) Parameters:
list: (table) weapon list

Tables
The script generates a editable weapon Fields:
P228 Scout XM1014 MAC10 AUG DualBeretta FiveSeven UMP45 SG550Commando Galil FAMAS USP45 Glock18C AWP MP5 M249 M3 M4A1 TMP G3SG1 DesertEagle50C SG552 AK47 P90 SCAR USAS12 QBB95 MG3 DualMP7A1 AK47Custom DesertEagle50CGold WinchesterM1887 M134Minigun M134 F2000 WinchesterM1887Gold LightningAR1 M24 DualInfinity DualInfinityCustom QBB95AdditionalMag MP7A1ExtendedMag SawedOffM79 DualInfinityFinal Crossbow USAS12CAMO DoubleBarrelShotgun KrissSuperV TAR21 BarrettM95 DualKriss AN94 M16A4 P90Lapin Volcano MG36 Salamander LightningSG1 Tempest BlackDragonCannon TMPDragon MK48 FNFNC L85A2 AKM HK416 LightningAR2 Ethereal M32MGL BALROGVII OICW TripleBarrelShotgun Ripper K3 Needler SKULL4 BALROGXI AK74U AK74U PlasmaGun Leviathan UTS15PinkGold CompoundBow ARX160 GaeBolg Cyclone SPAS12Maverick Aeolis PetrolBoomer RailCannon Eruptor Slasher RPG7 Guillotine CrossbowAdvance FireVulcan JackHammer Coilgun DualUZI LaserMinigun M4A1DarkKnight AK47Paladin AttackM950 MagnumDrill DesertEagleCrimsonHunter FlameJackhammer SG552Lycanthrope BroadDivine PythonDesperado CHARGER7 BOUNCER StunRifle DualBerettaGunslinger M249Phoenix StarChaserAR M32MGLVenom MG3CSOGSEdition ThunderGhostWalker Stinger InfinityLaserFist ShiningHeartRod

color Entity color Fields:
r: (int) red (0-255) g: (int) green (0-255) b: (int) blue (0-255)

Class
WeaponOption Set weapon stats for each weapon type. For example, if you modify the WeaponOption of an AK-47, the modified stats will be reflected for all AK-47s used in the game.
WeaponOption: (Common.WeaponOption)
Common.WeaponOption
Weapon option class

Tables
Common.WeaponOption.color
Data type representing color

Fields
Common.WeaponOption.weaponid
Gets the weapon type that is ID.
Common.WeaponOption.user
A table that can store user data.
Common.WeaponOption.price
Weapon Purchase Price (Common.SetNeedMoney must be set)
Common.WeaponOption.damage
Damage multiplier (multiply both when set with the Game.Weapon class)
Common.WeaponOption.penetration
Penetration Ratio
Common.WeaponOption.rangemod
Magnification for Damage Attenuation Rate Over Distance
Common.WeaponOption.cycletime
cycle time multiplier
Common.WeaponOption.reloadtime
reload time multiplier
Common.WeaponOption.accuracy
Accuracy magnification
Common.WeaponOption.spread
Magnification for the degree of inaccuracy when performing an action

Methods
Common.WeaponOption:SetBulletColor (color)
When the gun is fired, the fire path of the specified color is displayed.


Tables
Common.WeaponOption.color Data type representing color Fields:
r: (int) red (0-255) g: (int) green (0-255) b: (int) blue (0-255)

Fields
Common.WeaponOption.weaponid Gets the weapon type that is ID.
weaponid: (Common.WEAPON)
Common.WeaponOption.user A table that can store user data.
user: (table)
Common.WeaponOption.price Weapon Purchase Price (Common.SetNeedMoney must be set)
price: (int)
Common.WeaponOption.damage Damage multiplier (multiply both when set with the Game.Weapon class)
damage: (number)
Common.WeaponOption.penetration Penetration Ratio
penetration: (number)
Common.WeaponOption.rangemod Magnification for Damage Attenuation Rate Over Distance
rangemod: (number)
Common.WeaponOption.cycletime cycle time multiplier
cycletime: (number)
Common.WeaponOption.reloadtime reload time multiplier
reloadtime: (number)
Common.WeaponOption.accuracy Accuracy magnification
accuracy: (number)
Common.WeaponOption.spread Magnification for the degree of inaccuracy when performing an action
spread: (number)

Methods
Common.WeaponOption:SetBulletColor (color) When the gun is fired, the fire path of the specified color is displayed. Parameters:
color: (color)
Game
Module Game
This module contains functions for scripts returned from the server.

It is used in project.json
game.lua

Functions

FindPlayerAt (position)
Find the player located at a specific coordinate.
GetTime ()
Get the current game time.
SetTrigger (name, value)
Activate the script trigger LUA-Block.
GetEntity (index)
Get the script-generated entity.
RandomInt (min, max)
Get a random integer
RandomFloat (min, max)
Get a random float
GetTriggerEntity ()
Gets the player or monster entity that triggered the script call block.
GetScriptCaller ()
Gets the script call block that called the currently executing function.
KillAllMonsters ()
Kill all monsters after the next OnUpdate

Tables

TEAM
player team
MODEL
player model
WEAPONTYPE
weapon type
HITBOX
player hitboxes
ENTITYTYPE
entity type
MONSTERTYPE
monster type
RENDERFX
Type of effect when drawing an object
WEAPONCOLOR
weapon color
THIRDPERSON_FIXED_PLANE
ThirdPersonFixedView based on the method of calculating the position of the mouse pointer
position
Data type representing a specific block coordinate

Class
SyncValue
Synchronization variables
Rule
Game rule
Entity
Entity
Player
Game player
Monster
Monster
EntityBlock
Entity Block
Weapon
Weapon

Functions

FindPlayerAt (position) Find the player located at a specific coordinate. Parameters:
position: (position)
Returns:
(Game.Player or nil) Nil if there is no player in this coordinate
GetTime () Get the current game time. Same as Game.Rule.OnUpdate
Returns: (number) Current game time
SetTrigger (name, value) Works with LUA trigger blocks. Activate the script trigger LUA-Block. Parameters:
name: (string) name value: (bool) on/off
GetEntity (index) Returns an entity created using a script. Parameters:
index: (int) object index
Returns:
(Game.Entity or nil) If no entity exists in this index, then nil
RandomInt (min, max) Get a random integer Parameters:
min:(int) minimal value max:(int) max value
Returns:
(int)
RandomFloat (min, max) Get a random float Parameters:
min:(int) minimal value max:(int) max value
Returns:
(number)
GetTriggerEntity () Gets the player or monster entity that triggered the script call block. It is available only for functions executed through the script call block. Returns:
(Game.Entity or nil) [player or monster] entity, if not zero
GetScriptCaller () Gets the script call block that called the currently executing function. It is available only for functions executed through the script call block. Returns:
(Game.EntityBlock or nil) Nil if not executed via script call block
KillAllMonsters () Kill all monsters after the next OnUpdate

Tables

TEAM player team Fields:
UNASSIGNED TR CT SPECTATOR
MODEL player model Fields:
DEFAULT SEAL GSG9 GIGN SAS SPETSNAZ GUERILLA PHOENIX ELITE ARCTIC MILITIA HERO HEROINE NORMAL_ZOMBIE LIGHT_ZOMBIE HEAVY_ZOMBIE PHYCHO_ZOMBIE VOODOO_ZOMBIE DEIMOS_ZOMBIE GANYMEDE_ZOMBIE STAMPER_ZOMBIE BANSHEE_ZOMBIE VENOMGUARD_ZOMBIE STINGFINGER_ZOMBIE METATRON_ZOMBIE LILITH_ZOMBIE CHASER_ZOMBIE BLOTTER_ZOMBIE RUSTYWING_ZOMBIE AKSHA_ZOMBIE NORMAL_ZOMBIE_HOST LIGHT_ZOMBIE_HOST HEAVY_ZOMBIE_HOST PHYCHO_ZOMBIE_HOST VOODOO_ZOMBIE_HOST DEIMOS_ZOMBIE_HOST GANYMEDE_ZOMBIE_HOST STAMPER_ZOMBIE_HOST BANSHEE_ZOMBIE_HOST VENOMGUARD_ZOMBIE_HOST STINGFINGER_ZOMBIE_HOST METATRON_ZOMBIE_HOST LILITH_ZOMBIE_HOST CHASER_ZOMBIE_HOST BLOTTER_ZOMBIE_HOST RUSTYWING_ZOMBIE_HOST AKSHA_ZOMBIE_HOST
WEAPONTYPE weapon type Fields:
NONE KNIFE PISTOL GRENADE SUBMACHINEGUN SHOTGUN MACHINEGUN RIFLE SNIPERRIFLE EQUIPMENT
HITBOX player hitboxes Fields:
HEAD CHEST STOMACH LEFTARM RIGHTARM LEFTLEG RIGHTLEG
ENTITYTYPE entity type Fields:
ENTITY MONSTER PLAYER
MONSTERTYPE monster type Fields:
NORMAL0 NORMAL1 NORMAL2 NORMAL3 NORMAL4 NORMAL5 NORMAL6 RUNNER0 RUNNER1 RUNNER2 RUNNER3 RUNNER4 RUNNER5 RUNNER6 HEAVY1 HEAVY2 GHOST PUMPKIN PUMPKINHEAD A101AR A104RL
RENDERFX Type of effect when drawing an object Fields:
NONE GLOWSHELL
WEAPONCOLOR weapon color Apply the color and color of the weapon inventory when the weapon drops. Fields:
NONE GREEN WHITE RED BLUE YELLOW ORANGE
THIRDPERSON_FIXED_PLANE ThirdPersonFixedView based on the method of calculating the position of the mouse pointer Default value = GROUND Fields:
GROUND Based on XY plane, various objects and player position XY Based on XY plane XZ Based on XZ plane YZ Based on YZ plane
position Data type representing a specific block coordinate Fields:
x: (int) y: (int) z: (int)

Class
SyncValue Synchronization variables
SyncValue: (Game.SyncValue)

Rule Game rule
Rule: (Game.Rule)

Entity Entity
Entity: (Game.Entity)

Player Game player
Player: (Game.Player)

Monster Monster
Monster: (Game.Monster)

EntityBlock Entity Block
EntityBlock: (Game.EntityBlock)
Weapon Weapon
Weapon: (Game.Weapon)
Game.Entity
Parent class of players and monsters

All variables and functions defined here can be used by players and monsters.

Tables
Game.Entity.position
Data type representing a specific block coordinate
Game.Entity.velocity
Data type representing a certain speed
Game.Entity.color
Data type representing color

Fields
Game.Entity.index
Gets the index number of the entity.
Game.Entity.user
A table that can store user data.
Game.Entity.health
Gets or changes the health of the entity.
Game.Entity.maxhealth
Gets or changes the maximum health of the entity.
Game.Entity.armor
Gets or changes the body armor of an entity.
Game.Entity.maxarmor
Gets or changes the maximum body armor of the entity.
Game.Entity.position
Gets or changes the block coordinates of the entity's location.
Game.Entity.velocity
Gets or changes the speed of the entity.

Methods
Game.Entity:GetEntityType ()
Gets the entity type.
Game.Entity:IsMonster ()
Checks if the entity is a monster
Game.Entity:IsPlayer ()
Checks if the entity is a player
Game.Entity:ToMonster ()
Transform the entity into a monster and get it.
Game.Entity:ToPlayer ()
Get the entity converted to player.
Game.Entity:ShowOverheadDamage (damage, playerIndex)
Show damage above the head of the entity.
Game.Entity:SetRenderFX (fx)
Set the effect on the entity model.
Game.Entity:SetRenderColor (color)
Sets the color of the entity model.


Tables
Game.Entity.position Data type representing a specific block coordinate [h]Fields:[/h]
x: (int) y: (int) z: (int)
Game.Entity.velocity Data type representing a certain speed [h]Fields:[/h]
x: (number) y: (number) z: (number)
Game.Entity.color Data type representing color [h]Fields:[/h]
x: (int) red (0-255) y: (int) green (0-255) z: (int) blue (0-255)

Fields

Game.Entity.index Gets the index number of the entity. The index starts at 1.
index: (int)

Game.Entity.user A table that can store user data.
health: (int)

Game.Entity.health Gets or changes the health of the entity. If you change it to a value greater than your maximum health, your maximum health will increase as well. You can change from 1 to 1000000.
health: (int)

Game.Entity.maxhealth Gets or changes the maximum health of the entity. If you change it to a value less than your current health, your current health will also decrease. You can change from 1 to 1000000.
maxhealth: (int)



Game.Entity.armor Gets or changes the body armor of an entity. If you change it to a value higher than your maximum body armor, your maximum body armor will increase as well. You can change from 1 to 1000000.
armor: (int)

Game.Entity.maxarmor Gets or changes the maximum body armor of the entity. If you change it to a smaller value than your current body armor, your current body armor will also decrease. You can change from 1 to 1000000.
maxarmor: (int)


Game.Entity.position Gets or changes the block coordinates of the entity's location. If you change to an area that you can't move, nothing happens.
position: (position)
Usage:
player.position = { x = 10, y = -25, z = 0 }

Game.Entity.velocity Gets or changes the speed of the entity. Only some can be changed.
velocity: (velocity)
Usage:
player.velocity = { x = 0, y = 10.5, z = 100.0 } player.velocity = { z = 100.0 }

Game.Entity:GetEntityType () Gets the entity type. You can see if the entity is a player or a monster. Returns:
(Game.ENTITYTYPE) Entity Type
Game.Entity:IsMonster () Checks if the entity is a monster Returns:
(bool) Monster if true
Game.Entity:IsPlayer () Checks if the entity is a player Returns:
(bool) Player if true
Game.Entity:ToMonster () Transform the entity into a monster and get it. Returns:
(Game.Monster or nil) If not monster then nil
Game.Entity:ToPlayer () Get the entity converted to player. Returns:
(Game.Player or nil) nil if not player
Game.Entity:ShowOverheadDamage (damage, playerIndex) Show damage above the head of the entity. Parameters:
damage: (number) Damage to display playerIndex: (int) Player index to see the display. If 0, then it will be displayed for everyone.
Game.Entity:SetRenderFX (fx) Set the effect on the entity model. Parameters:
fx: (Game.RENDERFX) Type
Game.Entity:SetRenderColor (color) Sets the color of the entity model. Parameters:
color (color) color
Game.EntityBlock
Studio device blocks

Tables
Game.EntityBlock.position
Data type representing a specific block coordinate
Game.EntityBlock.EventArg
Data type that contains event information of device block
There are also actions that apply only to specific device blocks.

Fields
Game.EntityBlock.id
Get the id of the device block.
Game.EntityBlock.position
Get the coordinates of the device block.
Game.EntityBlock.onoff
Get the current (On/Off) status of the device.

Methods
Game.EntityBlock:Create (position)
Get the device block at that coordinate.
Game.EntityBlock:Event (arg, index)
Function to operate a device block.

Event Callback
Game.EntityBlock:OnUse (player)
Event callback invoked when the player uses the device block.
Game.EntityBlock:OnTouch (player)
Event callback invoked when the player touches an area device block.

Tables
Game.EntityBlock.position Data type representing a specific block coordinate Fields
x: (int) y: (int) z: (int)
Game.EntityBlock.EventArg Data type that contains event information of device block There are also actions that apply only to specific device blocks. Fields
action: (optional string) Trigger a specific event. value: (optional string) Used as an argument of a specific action.

Fields
Game.EntityBlock.id Get the id of the device block.
id: (int)
Game.EntityBlock.position Get the coordinates of the device block.
position: (position)
Game.EntityBlock.onoff Get the current (On/Off) status of the device.
onoff: (bool)

Methods
Game.EntityBlock:Create (position) Get the device block at that coordinate. Parameters:
position: (position)
Returns:
(EntityBlock or nil) Nil if wrong coordinates or normal block
Game.EntityBlock:Event (arg, index) Function to operate a device block. Each device may have its own event. The basic action is as follows:
action = "use": If the device is available, use the device. action = "touch": If the area block, touch the device. action = "reset": Reset the device.
Parameters:
arg: (EventArg) index: (Game.Player.index) The index number of the player firing the event
Usage:
local door = EntityBlock.Create(46, 31, 15) door.Event({action = "use"}, 1) local trigger = EntityBlock.Create(20, 0, 16) trigger.Event({action="touch"}, 0)

Event Callback
Game.EntityBlock:OnUse (player) Event callback invoked when the player uses the device block. Parameters:
player: (Game.Player or nil) Nil if acting as a signal from another device
Game.EntityBlock:OnTouch (player) Event callback invoked when the player touches an area device block. Parameters
player: (Game.Player or nil) Nil if acting as a signal from another device
Game.Rule
Game rule class

Fields
Game.Rule.name
Gets or changes the rule name.
Game.Rule.desc
Gets or changes the rule description.
Game.Rule.user
Table that can store user data.
Game.Rule.respawnable
Gets or changes whether the player is respawn.
Game.Rule.respawnTime
Gets or changes the player respawn time in seconds.
Game.Rule.enemyfire
Gets or changes whether another team attacks.
Game.Rule.friendlyfire
Gets or changes whether a friendly attack occurs.
Game.Rule.breakable
Gets or changes the player's ability to break the map.

Event callback
Game.Rule: OnPlayerConnect (player)
Event callback called when the player is connected.
Game.Rule: OnPlayerDisconnect (player)
Event callback that is called when the player disconnects.
Game.Rule: OnRoundStart ()
The event callback that is called when the round starts.
Game.Rule: OnRoundStartFinished ()
Event callback that is called after the round starts.
Game.Rule: OnPlayerSpawn (player)
Event callback called when the player is spawned.
Game.Rule: OnPlayerJoiningSpawn (player)
Event callback called when the player is first spawned after selecting a class.
Game.Rule: OnPlayerKilled (victim, killer, weapontype, hitbox)
Event callback called when the player dies.
Game.Rule: OnKilled (victim, killer)
Event callback that is called when the player or monster dies.
Game.Rule: OnPlayerSignal (player, signal)
Event callback that is called when using UI.Signal.
Game.Rule: OnUpdate (time)
Event callback that is called every time.
Game.Rule: OnPlayerAttack (victim, attacker, damage, weapontype, hitbox)
Event callback called when the player is attacked.
Game.Rule: OnTakeDamage (victim, attacker, damage, weapontype, hitbox)
Event callback called when the player or monster is attacked.
Game.Rule: CanBuyWeapon (player, weaponid)
Event callback to check if a weapon can be purchased.
Game.Rule: CanHaveWeaponInHand (player, weaponid, weapon)
Event callback to check if the weapon can be held.
Game.Rule: OnGetWeapon (player, weaponid, weapon)
Event callback called when a weapon is acquired.
Game.Rule: OnReload (player, weapon, time)
Event callback called when loading.
Game.Rule: OnReloadFinished (player, weapon)
Event callback called after the loading is over.
Game.Rule: OnSwitchWeapon (player)
Event callback called when replacing the weapon.
Game.Rule: PostFireWeapon (player, weapon, time)
Event callback called after firing.
Game.Rule: OnGameSave (player)
Event callback called when save per player save information.
Game.Rule: OnLoadGameSave (player)
Event callback called when player-specific save information is loaded.
Game.Rule: OnClearGameSave (player)
Event callback called when deleting player specific save information.

Methods
Game.Rule: Win (team, exit)
The specific team wins.
Game.Rule: Respawn ()
Forces all players to be spawned.
Game.Rule: CanSave ()
Checks if the current map is saveable.
Game.Rule: SetGameSave (name, value)
Adds a value to save to the group.
Game.Rule: GetGameSave (name)
Gets the value stored in the group.

Fields
Game.Rule.name Gets or changes the rule name.
name: (string)
Game.Rule.desc Gets or changes the rule description.
desc: (string)
Game.Rule.user Table that can store user data.
user: (table)
Game.Rule.respawnable Gets or changes whether the player is respawn. The full browser's world setting is ignored.
respawnable: (bool) (default true)
Game.Rule.respawnTime Gets or changes the player respawn time in seconds. The full browser's world setting is ignored. You can change from 0 to 60 seconds.
respawnTime: (number) (default 5)
Game.Rule.enemyfire Gets or changes whether another team attacks. The full browser's world setting is ignored.
enemyfire: (bool) (default true)
Game.Rule.friendlyfire Gets or changes whether a friendly attack occurs. The full browser's world setting is ignored.
friendlyfire: (bool) (default false)
Game.Rule.breakable Gets or changes the player's ability to break the map. The full browser's world setting is ignored.
breakable: (bool) (default false)

Methods
Game.Rule: Win (team, exit) The specific team wins. If there is no exit argument, the game ends after the victory. Parameters:
team: (Game.TEAM) exit: (optional bool) Game end after victory
Game.Rule: Respawn () Forces all players to be spawned.
Game.Rule: CanSave () Checks if the current map is saveable. Returns true if a group is specified. See the help for details. Returns:
(bool) Save activated
Game.Rule: SetGameSave (name, value) Adds a value to save to the group. This data is shared between the same groups regardless of the player. See the help for details. Parameters:
name: (string) value: (number,string or bool)
Game.Rule: GetGameSave (name) Gets the value stored in the group. This data is shared between the same groups regardless of the player. If no name is found, returns nil. See the help for details. Parameters
name: (string)
Returns:
(number, string, bool or nil) Stored value
Game.Rule Event callback
Event callback
Game.Rule: OnPlayerConnect (player) The event callback called when the player connects. Parameters:
player (Game.Player)
Game.Rule: OnPlayerDisconnect (player) Event callback called when the player closes the connection. Parameters:
player (Game.Player)
Game.Rule: OnRoundStart () The event callback that is called when the round starts.
Game.Rule: OnRoundStartFinished () Event callback that is called after the round starts. Use this function to initialize the map.
Game.Rule: OnPlayerSpawn (player) Event callback called when the player is spawned. Parameters:
player (Game.Player)
Game.Rule: OnPlayerJoiningSpawn (player) Event callback called when the player first spawns after selecting a class. Parameters:
player (Game.Player)
Game.Rule: OnPlayerKilled (victim, killer, weapontype, hitbox) Event callback that is called when the player dies. Parameters:
victim (Game.Player) Attacked Player killer (Game.Player or nil) nil if killed for reasons other than player attack weapontype (Game.WEAPONTYPE) Attacked weapon type hitbox (Game.HITBOX) Attacked Area
Game.Rule: OnKilled (victim, killer) Event callback that is called when the player or monster dies. Parameters:
victim (Game.Entity) Attacked Entity killer (Game.Entity) or nil nil if killed for a non-Entity attack
Game.Rule: OnPlayerSignal (player, signal) The event callback invoked when using UI.Signal. Parameters:
player (Game.Player) The player who sent the signal signal (int) The signal value sent by the player
Game.Rule: OnUpdate (time) Event callback that is called every hour. Called about every 0.1 seconds. Parameters:
time (number) Current game time
Game.Rule: OnPlayerAttack (victim, attacker, damage, weapontype, hitbox) Event callback invoked when the player is attacked. You can change the damage received by returning any number. Parameters:
victim (Game.Player) Attacked Player attacker (Game.Player) or nil Attacked player (nil if not player)[/b] damage (int) damage weapontype (Game.WEAPONTYPE) Attacked weapon type hitbox (Game.HITBOX) Attacked Area
Returns: optional (int) Damage modified Usage:
Game.Rule: OnPlayerAttack (victim, attacker, damage, weapontype, hitbox) Melee weapons deal 0 damage if weapontype == Game.WEAPONTYPE.KNIFE then return 0 -Otherwise, damage is intact end
Game.Rule: OnTakeDamage (victim, attacker, damage, weapontype, hitbox) Event callback invoked when the player or monster is attacked. You can change the damage received by returning any number. Parameters:
victim (Game.Entity) Attacked Entity attacker (Game.Entity) or nil Attacked entity (nil if not player or monster)[/b] damage (int) damage weapontype (Game.WEAPONTYPE) Attacked weapon type hitbox (Game.HITBOX) Attacked Area Returns: optional (int) Damage modified
Game.Rule: CanBuyWeapon (player, weaponid) Event callback to check if a weapon can be purchased. Weapons not included in the Script Weapon List are not called. Parameters:
player (Game.Player) target player weaponid (Common.WEAPON) weapon type Returns: true if a bool weapon can be purchased
Game.Rule: CanHaveWeaponInHand (player, weaponid, weapon) Event callback to check if the weapon is available. Weapons not included in the Script Weapon List are not called. If the Weapon class has never been used, the weapon argument is passed as nil. Parameters:
player (Game.Player) target player weaponid (Common.WEAPON) weapon type weapon (Game.Weapon or nil) weapon Returns: true if you can hold a bool weapon
Game.Rule: OnGetWeapon (player, weaponid, weapon) Event callback called when a weapon is acquired. Weapons not included in the Script Weapon List are not called. If the Weapon class has never been used, the weapon argument is passed as nil. Parameters:
player (Game.Player) target player weaponid (Common.WEAPON) weapon type weapon (Game.Weapon or nil) weapon
Game.Rule: OnReload (player, weapon, time) Event callback called when loading. The weapon argument is passed as nil if the Weapon class has never been used or if it is not a script weapon. Parameters:
player (Game.Player) target player weapon (Game.Weapon or nil) weapon time number
Game.Rule: OnReloadFinished (player, weapon) Event callback called after loading. The weapon argument is passed as nil if the Weapon class has never been used or if it is not a script weapon. Parameters:
player (Game.Player) target player weapon (Game.Weapon or nil) weapon
Game.Rule: OnSwitchWeapon (player) Event callback called when replacing a weapon. Parameters:
player (Game.Player) target player
Game.Rule: PostFireWeapon (player, weapon, time) Event callback called after launch. The weapon argument is passed as nil if the Weapon class has never been used or if it is not a script weapon. Parameters:
player (Game.Player) target player weapon (Game.Weapon or nil) weapon time number Time to next shot
Game.Rule: OnGameSave (player) This event callback is called when the player-specific save information is saved. Parameters:
player (Game.Player) target player
Game.Rule: OnLoadGameSave (player) Event callback called when player-specific save information is loaded. Parameters:
player (Game.Player) target player
Game.Rule: OnClearGameSave (player) Event callback called when deleting player specific save information. Parameters:
player (Game.Player) target player
Game.Monster
Monster class

Inherits all the contents of the Game.Entity

Tables
Game.Monster.position
A data type representing a specific block coordinate

Fields
Game.Monster.type
Monster Type
Game.Monster.damage
Monster's Damage Actual Value
Game.Monster.speed
Monster's Movement Speed ​​Multiplier
Game.Monster.viewDistance
Monster's Field of View Actual Value
Game.Monster.coin
The coin you get when you catch a monster
Game.Monster.applyKnockback
Whether to apply knockback to monsters
Game.Monster.canJump
Whether the monster can jump
Game.Monster.checkAngle
Monster's Field of View Actual Value

Methods
Game.Monster:Create (type, position)
Creates a monster at that coordinate.
Game.Monster:AttackPlayer (player)
Instructs the monster to attack the player.
Game.Monster:AttackTo (position)
Instructs the monster to move to that coordinate.
Game.Monster:MoveTo (position)
Instructs the monster to move to that coordinate.
Game.Monster:Hold ()
Tells the monster to stay in place.
Game.Monster:Stop ()
Tells the monster to stay in place.

Tables
Game.Monster.position A data type representing a specific block coordinate Fields:
x: (int) y: (int) z: (int)

Fields
Game.Monster.type Monster Type
type: (Game.MONSTERTYPE)
Game.Monster.damage Monster's Damage Actual Value
damage: (number)
Game.Monster.speed Monster's Movement Speed ​​Multiplier
speed: (number)
Game.Monster.viewDistance Monster's Field of View Actual Value
viewDistance: (number)
Game.Monster.coin The coin you get when you catch a monster
coin: (int)
Game.Monster.applyKnockback Whether to apply knockback to monsters
applyKnockback: (bool)
Game.Monster.canJump Whether the monster can jump
canJump: (bool)
Game.Monster.checkAngle Monster's Field of View Actual Value
checkAngle: (number)

Methods
Game.Monster:Create (type, position) Create a monster at that coordinate. If another object already exists at the coordinates, try to create it somewhere else nearby (z is fixed). If all coordinates within the range cannot be generated, nil is returned. Parameters:
type: (Game.MONSTERTYPE) position: (position)
Returns:
(Monster or nil) Nil if invalid type, coordinates, or creation restricted by internal game logic
Game.Monster:AttackPlayer (player) Inscodeucts the monster to attack the player. Parameters:
player: (Game.Player) Player to attack
Game.Monster:AttackTo (position) Instruct the monster to move to that coordinate. If you have something to attack while on the move, switch to attack. Parameters:
position: (position)
Game.Monster:MoveTo (position) Instruct the monster to move to that coordinate. If you have something to attack while on the move, it will not attack. Parameters:
position: (position)
Game.Monster:Hold () Command the monster to stay in place. If there is a target to attack within range, attack it.
Game.Monster:Stop () Command the monster to stay in place. If there is a target within attack range, it will not attack.
Game.Player
Player class

Inherits all the contents of the Game.Entity

Tables
Game.Player.position
A data type representing a specific block coordinate
Game.Player.velocity
A type representing a specific speed

Fields
Game.Player.name
Gets the nickname of the player.
Game.Player.death
Gets the number of deaths of the player.
Game.Player.team
Gets or changes the team of the player.
Game.Player.coin
Gets or changes the player's studio items.
Game.Player.model
Gets or changes the current class of the player.
Game.Player.flinch
Gets or changes the rigidity scale of the player.
Game.Player.knockback
Gets or changes the knockback scale of the player.
Game.Player.maxspeed
Gets or changes the maximum speed multiplier for the player.
Game.Player.gravity
Gets or changes the gravity scale of the player.
Game.Player.infiniteclip
Enable infinity clip .

Methods
Game.Player:Create (index)
Gets the player corresponding to the index number.
Game.Player:Respawn()
The player is respawned.
Game.Player:Kill()
The player dies.
Game.Player:Win (exit)
Player wins.
Game.Player:ShowBuymenu()
Shows your favorite weapon purchases.
Game.Player:RemoveWeapon()
Removes all player weapons.
Game.Player:SetGameSave (name, value)
Add a value to save to the group.
Game.Player:GetGameSave (name)
Gets the value stored in the group.
Game.Player:SetFirstPersonView()
Changes the player's camera to first-person view.
Game.Player:SetThirdPersonView (minDist, maxDist)
Changes the player's camera to third person view.
Game.Player:SetThirdPersonFixedView (yaw, pitch, minDist, maxDist)
Changes the player's camera to third person view and locks the angle.
Game.Player:SetThirdPersonFixedPlane (plane)
Modifies how raypoints are calculated for the mouse pointer in the ThirdPersonFixedView state.
Game.Player:ShowWeaponInven()
Shows the weapon inventory.
Game.Player:ToggleWeaponInven()
Toggles the weapon inventory.
Game.Player:Signal (signal)
Sends a random signal to the player.
Game.Player:SetLevelUI (level, expRate)
Displays and modifies the level / experience UI on the player's screen.
Game.Player:SetBuymenuLockedUI (weaponid, uiLocked, level)
Sets the lock mark for each weapon item in the shop window.
Game.Player:SetWeaponInvenLockedUI (weapon, uiLocked, level)
Sets the lock mark for each weapon item in the weapon inventory window.
Game.Player:GetPrimaryWeapon()
Gets the main weapon the player is currently holding.
Game.Player:GetSecondaryWeapon()
Gets the secondary weapon the player is currently holding.
Game.Player:GetWeaponInvenList()
Gets the list of weapons the player currently has in the weapons inventory.

Event callback
Game.Player:OnSpawn()
The event callback that is called when the player is spawned.
Game.Player:OnKilled (killer)
Event callback that is called when the player dies.
Game.Player:OnAssist (victim, killer)
Event callback called when the player assists

Tables
Game.Player.position A data type representing a specific block coordinate Fields:
x: (int) y: (int) z: (int)
Game.Player.velocity A type representing a specific speed Fields:
x: (int) y: (int) z: (int)

Fields
Game.Player.name Gets the nickname of the player.
name: (string)
Game.Player.death Gets the number of deaths of the player.
death: (int)
Game.Player.team Gets or changes the team of the player.
team: (Game.TEAM)
Game.Player.coin Gets or changes the player's studio items. It can be changed from 0 to 1,000,000,000.
coin: (int)
Game.Player.model Gets or changes the player's current class. Game.MODEL.DEFAULT is the class the player chooses to enter. If you change to a zombie model, all weapons are automatically removed and you cannot acquire weapons.
model: (Game.MODEL)
Game.Player.flinch Gets or changes the rigid scale of the player. 0.0 to 1.0, the default is 1.0. It is multiplied by the existing stiffness.
flinch: (number)
Usage:
player.finch = 0.8 (30 % 0.8 = 24% when the default stiffness is 30%)
Game.Player.knockback Gets or changes the knockback ratio of the player. 0.0 to 3.0, the default is 1.0. It is multiplied by the existing knockback.
knockback: (number)
Usage:
player.knockback = 2.0 (When default knockback is 80, changed to 80% 2.0 = 160)
Game.Player.maxspeed Gets or changes the player's maximum speed multiplier. From 0.0 to 10.0, the default is 1.0. The existing value is multiplied. The multiplied value cannot be higher than the maximum speed defined by the game engine.
maxspeed: (number)
Game.Player.gravity Gets or changes the gravity scale of the player. From 0.0 to 10.0, the default is 1.0. The existing value is multiplied. The multiplied value cannot be higher than the maximum gravity defined by the game engine.
gravity: (number)
Game.Player.infiniteclip Enable infinity clip
infiniteclip: (bool)

Event callback
Game.Player:OnSpawn() The event callback that is called when the player is spawned.
Game.Player:OnKilled (killer) Event callback that is called when the player dies. Parameters:
killer: (Game.Player or nil) Nil if killed for reasons other than player attack
Game.Player:OnAssist (victim, killer) Event callback called when the player assists Parameters:
victim: (Game.Player) Attacked player killer: (Game.Player or nil) Nil if killed for reasons other than player attack
Game.Player Methods
Methods
Game.Player:Create (index) Gets the player corresponding to the index number. Index starts at 1. Parameters:
index: (int)
Returns:
(Players or nil) Nil if invalid index
Game.Player:Respawn() The player is respawned.
Game.Player:Kill() The player dies.
Game.Player:Win (exit) Player win. If there is no exit argument, the game ends after the victory. Parameters:
exit: (optonal bool) Game end after victory
Game.Player:ShowBuymenu() Shows your favorite weapon purchases.
Game.Player:RemoveWeapon() Removes all player weapons.
Game.Player:SetGameSave (name, value) Add a value to store in the group. This data is stored separately for each player and shared between the same groups. See the help for details. Parameters
name: (string) value: (number, string or bool)
Game.Player:GetGameSave (name) Gets the value stored in the group. This data is stored separately for each player and shared between the same groups. See the help for details. If name is missing, returns nil. Parameters:
name: (string)
Returns
(number,string,bool or nil) Stored value
Game.Player:SetFirstPersonView() Changes the player's camera to first-person view.
Game.Player:SetThirdPersonView (minDist, maxDist) Changes the player's camera to third person view. Parameters:
minDist: (number) Minimum distance of camera maxDist: (number) Maximum distance of the camera
Game.Player:SetThirdPersonFixedView (yaw, pitch, minDist, maxDist) Change the player's camera to third-person view and lock the angle. The mouse pointer is shown and the user input method is changed to the method using the mouse pointer raycast. See Player.SetThirdPersonFixedPlane for the raycast calculation. [Use] and [Acquire] motions are changed from the existing camera viewpoint based on the player position. Weapons using zoom will raise the camera without foving. Among the weapons that fire grenades like the M32, weapons whose gravity is applied to the grenade will change their aiming methods. Parameters:
yaw: (number) pitch: (number) minDist: (number) maxDist: (number)
Game.Player:SetThirdPersonFixedPlane (plane) Modify how the mouse pointer calculates the raycast in the ThirdPersonFixedView state. It will not work if it is not ThirdPersonFixedView. For example, if you set it to XY plane, it will raycast the plane corresponding to the player's Z among the planes parallel to the XY plane and set the collision point as the reference point. The player character always looks at the base point and fires in the direction of the base point when firing a gun. GROUND and XY planes are suitable for the top view game genre, while XZ and YZ planes are suitable for the front view game genre. Parameters:
plane: (Game.THIRDPERSON_FIXED_PLANE) The plane on which the raycast calculation is based
Game.Player:ShowWeaponInven() Shows the weapon inventory.
Game.Player:ToggleWeaponInven() Toggles the weapon inventory.
Game.Player:Signal (signal) Send a random signal to the player. Upon receiving a signal, the UI.Event.OnSignal event is raised. Parameters:
signal: (int) Any integer value
Game.Player:SetLevelUI (level, expRate) Displays and modifies the level / experience UI on the player's screen. Parameters:
level: (int) Player level expRate: (number) Length ratio of experience bar. It can be set from 0.0 to 1.0.
Game.Player:SetBuymenuLockedUI (weaponid, uiLocked, level) Sets the lock mark for each weapon item in the shop window. Parameters
weaponid: (Common.WEAPON) Weapon id to lock uiLocked: (bool) Set the lock to true if true and clear it to false. level: (optional int) Displays level text with a lock. If you omit the value, it is not displayed.
Game.Player:SetWeaponInvenLockedUI (weapon, uiLocked, level) Set a lock mark for each weapon item in the weapon inventory window. It should be set to Common.UseWeaponInven. Parameters:
weaponid: (Common.WEAPON) Weapon id to lock uiLocked: (bool) Set the lock to true if true and clear it to false. level: (optional int) Displays level text with a lock. If you omit the value, it is not displayed.
Game.Player:GetPrimaryWeapon() Take the main weapon that the player is currently holding. Nil is returned if you are not holding the main weapon, have not used the Game.Weapon class, or are not included in the script weapon list. Returns:
(Game.Weapon or nil)
Game.Player:GetSecondaryWeapon() Get the secondary weapon the player is currently holding. Nil is returned if you are not holding a secondary weapon, have not used the Game.Weapon class, or are not included in the script weapon list. Returns:
(Game.Weapon or nil)
Game.Player:GetWeaponInvenList() Gets a list of weapons the player currently has in the weapons inventory. It should be set to Common.UseWeaponInven. Weapons in hands are not included. The resulting table contains Game.Weapons. Returns:
(table) weaponList
Game.SyncValue
Variables that are automatically synchronized to the client.

Fields
Game.SyncValue.name
Gets the name of the SyncValue.
Game.SyncValue.value
Gets or changes the value of SyncValue.

Methods
Game.SyncValue: Create (name)
Creates a Game.SyncValue with a specific name or gets a Game.SyncValue with the same name.

Fields
Game.SyncValue.name Gets the name of the SyncValue.
name: (string)
Game.SyncValue.value Gets or changes the value of SyncValue.
value: (number,string or bool)
Usage:
var1 = Game.SyncValue.Create('var1') print(var1.value) var1.value = 123

Methods
Game.SyncValue: Create (name) Creates a Game.SyncValue with a specific name or gets a Game.SyncValue with the same name. Synchronize with UI.SyncValue of the same name. Parameters:
name: (string)
Returns:
(Game.SyncValue)
Usage:
var1 = Game.SyncValue.Create('var1')
Game.Weapon
Weapon class

Tables
Game.Weapon.position
A data type representing a specific block coordinate

Fields
Game.Weapon.user
Table that can store arbitrary data.
Game.Weapon.weaponid
Get the type of weapon.
Game.Weapon.color
Gets or sets the color of the weapon.
Game.Weapon.damage
Gets or sets the scale of weapon damage.
Game.Weapon.speed
Gets or sets the magnification of the weapon's movement speed.
Game.Weapon.knockback
Gets or sets the scale of the weapon knockback.
Game.Weapon.flinch
Gets or sets the scale of the weapon stiffness.
Game.Weapon.criticalrate
Gets or sets the critical probability of the weapon.
Game.Weapon.criticaldamage
Gets or sets the critical damage ratio of the weapon. You can set a value between 0 and 100.
Game.Weapon.bloodsucking
Gets or sets the vampire ratio of a weapon. You can set a value between 0 and 100.
Game.Weapon.infiniteclip
Set the ammo of the weapon to infinity

Methods
Game.Weapon: CreateAndDrop (weaponid, position)
Creates and drops weapons at specific coordinates
Game.Weapon: GetWeaponType ()
Gets the WEAPONTYPE value of the weapon.
Game.Weapon: AddClip1 (clip)
Supplements the first of the magazines used by the weapon.

Tables
Game.Weapon.position A data type representing a specific block coordinate Fields:
x: (int) y: (int) z: (int)

Fields
Game.Weapon.user Table that can store arbicodeary data.
user: (table)
Game.Weapon.weaponid Get the type of weapon.
weaponid: (Common.WEAPON)
Game.Weapon.color Gets or sets the color of the weapon. The set color is applied to the effect color of the weapon when it is dropped and the color of the weapon inventory.
weaponid: (Game.WEAPONCOLOR)
Game.Weapon.damage Gets or sets the scale of weapon damage. You can set a value between 0 and 100.
damage: (number)
Game.Weapon.speed Gets or sets the magnification of the weapon's movement speed. You can set a value between 0 and 100.
speed: (number)
Game.Weapon.knockback Gets or sets the scale of the weapon knockback. You can set a value between 0 and 100.
knockback: (number)
Game.Weapon.flinch Gets or sets the scale of the weapon stiffness. You can set a value between 0 and 100.
flinch: (number)
Game.Weapon.criticalrate Gets or sets the critical probability of the weapon. You can set a value between 0 and 100.
criticalrate: (number)
Game.Weapon.criticaldamage Gets or sets the critical damage ratio of the weapon. You can set a value between 0 and 100. You can set a value between 0 and 100.
criticaldamage: (number)
Game.Weapon.bloodsucking Gets or sets the vampire ratio of a weapon. You can set a value between 0 and 100. You can set a value between 0 and 100.
bloodsucking: (number)
Game.Weapon.infiniteclip Set the ammo of the weapon to infinity
infiniteclip: (bool)

Methods
Game.Weapon: CreateAndDrop (weaponid, position) Creates and drops weapons at specific coordinates Parameters:
weaponid: (Common.WEAPON) Weapon types position: (position) Location where weapons fall after creation
Returns:
(Weapon or nil) Nil if invalid id, coordinates are passed or creation is restricted by internal game logic
Game.Weapon: GetWeaponType () Gets the WEAPONTYPE value of the weapon. Returns:
(Game.WEAPONTYPE)
Game.Weapon: AddClip1 (clip) Supplements the first of the magazines used by the weapon. Parameters:
clip: (int) Magazine
UI
Module UI
This module contains functions for scripts that are returned to the client.

It is used in project.json
ui.lua


Functions
ScreenSize ()
Get screen size
Signal (signal)
Sends any signal to the server.
StopPlayerControl (stop)
Lock movement and attack for a certain amount of time.
PlayerIndex (index)
Get the player index number.
GetTime ()
Get the current playing time.

Tables
size
Screen size representing a data type.
KEY
Keyboard and mouse input.


Class
SyncValue
Synchronized variables.
Event
Events.
Text
Text UI.
Box
Box UI.

Functions
ScreenSize () Get Screen size Returns:
(size) size

Signal (signal) Sends any signal to the server. When you receive a signal, the Game.Rule.OnPlayerSignal function is triggered Parameters:
signal: (INT)Random integer value

StopPlayerControl (stop) Lock movement and attack for a certain period of time. Reset when player dies 0 to 60 seconds is possible. Parameters:
stop (bool) false or true

PlayerIndex (index) Get the player's index number. Same as Game.Entity.index Parameters:
index (int) Player Index

GetTime () Get the current playing time. Same as UI.Event.OnUpdate Returns:
(number) Time

Tables
size Screen size representing a data type Fields:
width: (int) height: (int)

KEY
Keyboard and mouse input. Fields:
NUM1 NUM2 NUM3 NUM4 NUM5 NUM6 NUM7 NUM8 NUM9 NUM0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z SHIFT SPACE ENTER UP DOWN LEFT RIGHT MOUSE1 MOUSE2

Class

SyncValue Synchronization variables
SyncValue: (UI.SyncValue)

Event Events.
Event: (UI.Event)

Text UI Text
Text: (UI.Text)

Box UI Box.
Box: (UI.Box)
UI.SyncValue
Class UI.SyncValue
Variables that are automatically synchronized with the server

Fields
UI.SyncValue.name
Gets the name of the SyncValue.
UI.SyncValue.value
Gets the value of the SyncValue.

Methods
UI.SyncValue: Create (name)
Creates a UI.SyncValue with a specific name or obtains a UI.SyncValue with the same name.

Event callback
UI.SyncValue: OnSync ()
Event callback called when SyncValue is synchronized.

Fields
UI.SyncValue.name Gets the name of the SyncValue.
name: (sting)
UI.SyncValue.value Gets the value of the SyncValue.
value: (number,string or bool)
Usage:
var1 = UI.SyncValue.Create('var1') print(var1.value)

Methods
UI.SyncValue: Create (name) Creates a UI.SyncValue with a specific name or obtains a UI.SyncValue with the same name. Parameters:
name: (string)
Returns:
(UI.SyncValue)
Usage:
var1 = UI.SyncValue.Create('var1')

Event callback

UI.SyncValue: OnSync () Event callback called when SyncValue is synchronized. Usage:
var1 = UI.SyncValue.Create('var1') function var1:OnSync() print(self.value .. ' is synced!') end
UI.Box
Class UI.Box
Rectangle UI screen draws a specific rectangle.

Tables
UI.Box.SetArg
Data type to set the attribute

Methods
UI.Box:Create ()
Creates a rectangular UI object.
UI.Box:Show ()
Shows on the screen.
UI.Box:Hide ()
Changes it so that it does not appear on the screen.
UI.Box:IsVisible ()
Gets whether or not the display is currently on screen.
UI.Box:Set (arg)
Changes the properties of an object.
UI.Box:Get ()
Gets a table that contains the properties of the object.

Tables
UI.Box.SetArg Data type to set the atcodeibute Fields:
x: (optional int) y: (optional int) width: (optional int) height: (optional int) r: (optional int) red (0-255) g: (optional int) green (0-255) b: (optional int) blue (0-255) a: (optional int) alpha (0-255)

Methods

UI.Box:Create () Create a rectangular UI object. You can create up to 1024 at the same time. Returns:
(UI.Box or nil) Nil if the number limit is exceeded
UI.Box:Show () Shows on the screen.
UI.Box:Hide () Changes it so that it does not appear on the screen.
UI.Box:IsVisible () Gets whether or not the display is currently on screen. Returns:
(bool)
UI.Box:Set (arg) Changes the properties of an object. Parameters:
arg: (SetArg)
UI.Box:Get () Gets a table that contains the properties of the object. Returns:
(SetArg) info
UI.Event
UI event callbacks

Event Callback
UI.Event:OnRoundStart ()
The event callback that is called when the round starts.
UI.Event:OnSpawn ()
The event callback invoked when the player is spawned.
UI.Event:OnKilled ()
The event callback that is called when the player dies.
UI.Event:OnInput (inputs)
Event callback that is called continuously when the player holds down the key.
UI.Event:OnUpdate (time)
Event callback called for each frame.
UI.Event:OnChat (text)
Event callback invoked when the player enters the chat.
UI.Event:OnSignal (signal)
The event callback invoked when a signal is received from the server.
UI.Event:OnKeyDown (inputs)
Event callback called when the player presses a key.
UI.Event:OnKeyUp (inputs)
The event callback invoked when the player releases a key.

Event Callback

UI.Event:OnRoundStart () The event callback that is called when the round starts.
UI.Event:OnSpawn () The event callback invoked when the player is spawned.
UI.Event:OnKilled () The event callback that is called when the player dies.
UI.Event:OnInput (inputs) Event callback that is called continuously when the player holds down the key. inputs is the array where the key state is stored. The state of each key can be obtained through the UI.KEY enumerator. Parameters:
inputs: (table) Key state array
Usage:
function UI.Event: OnInput (inputs) if inputs [UI.KEY.A] == true then print ('a key is pressed!') end
UI.Event:OnUpdate (time) Event callback called every frame. Warning-don't do much with this callback! Parameters:
time: (number) Current game time
UI.Event:OnChat (text) Event callback invoked when the player enters the chat. Parameters:
text: (string) Chat content
UI.Event:OnSignal (signal) The event callback invoked when a signal is received from the server. Parameters:
signal: (int)
UI.Event:OnKeyDown (inputs) Event callback called when the player presses a key. inputs is an array containing the keys on which the KeyDown event occurred. Usage is the same as OnInput Parameters:
inputs: (table) Key array
UI.Event:OnKeyUp (inputs) The event callback invoked when the player releases a key. inputs is an array containing the keys for which the KeyUp event occurred. Usage is the same as OnInput Parameters:
inputs: (table) Key array
UI.Text
Class UI.Text
Draw a specific string on the text UI screen.

Tables
UI.Text.SetArg
Data type for setting property

Methods
UI.Text:Create ()
Creates a text UI object.
UI.Text:Show ()
Displays on the screen.
UI.Text:Hide ()
Changes it so that it doesn't appear on the screen.
UI.Text:IsVisible ()
Gets whether or not the display is currently on screen.
UI.Text:Set (arg)
Changes the properties of an object.
UI.Text:Get ()
Gets a table that contains the properties of the object.

Tables

UI.Text.SetArg Data type for setting property Fields:
text: (optional string) text string font: (optional string) font size ("small","medium","large","verylarge") align: (optional string) text align ("left", "center", "right") x: (optional int) y: (optional int) width: (optional int) height: (optional int) r: (optional int) red (0-255) g: (optional int) green (0-255) b: (optional int) blue (0-255) a: (optional int) alpha (0-255)

Methods
UI.Text:Create () Creates a text UI object. You can create up to 1024 at the same time. Returns:
(UI.Text or nil) Nil if the number limit is exceeded
UI.Text:Show () Displays on the screen.
UI.Text:Hide () Changes it so that it doesn't appear on the screen.
UI.Text:IsVisible () Gets whether or not the display is currently on screen. Returns:
(bool)
UI.Text:Set (arg) Changes the properties of an object. Parameters:
arg: (SetArg)
UI.Text:Get () Gets a table that contains the properties of the object. Returns
(SetArg) info
simple script

game.lua

Script to spawn unlimited Robot march.
notes:
1. we cant destroy\remove 1 entity, only all 2. because entity:MoveTo() and OnUpdate() may not work stably we need to teleport entity to dead zone and wait until all entity then will teleported to dead zone. But we use OnUpdate() to check end positions for robots, and for teleport its. 3. use Game:KillAllMonsters() to remove all entity 4. use simple second timer to bypass function KillAllMonsters() ( it has a OnUpdate() delay, and you cant immediately create monsters, they can be removed) 5. create entity and start it

prepare:

code:

local FZ = {} FZ.Game = Game FZ.CFG = {} FZ.CFG.Robots = {} FZ.CFG.Robots.StartLine = {x=-35,y=96,z=0} -- start first robot position FZ.CFG.Robots.TeleportPos = {x=0,y=0,z=0} -- dead zone position (teleport to) FZ.CFG.Robots.InterPos = { line = 1, -- position between robots on the line group = 2 -- between groups } FZ.CFG.Robots.CountOnLine = 2 -- count robots on one line FZ.CFG.Robots.GroupsCount = 2 -- count groups FZ.CFG.Robots.WayAxis = "y" -- axis of direction way FZ.CFG.Robots.StepsCount = 50 -- steps count FZ.CFG.Robots.RespawnTimer = 2 -- respawn timer FZ.CFG.Robots.Monster = FZ.Game.MONSTERTYPE.A101AR -- monster type FZ.Wave = {} FZ.Wave.MovePositions = {} -- to record the final path for first line FZ.Wave.Groups = {} -- for groups FZ.Wave.Timer = 0 -- timer FZ.Wave.NeedRespawn = false function FOSTERZ_SET_ATT(robot) -- set robot attributes robot.damage = 0 -- set damage = 0 robot.canJump = false -- set cant jump robot.viewDistance = 0.1 -- set mininal view distance robot.speed = 1 -- normal speed end function FZ.Game.Rule:OnUpdate(time) if FZ.Wave.NeedRespawn == false then -- if bots maked for k,v in pairs(FZ.Wave.Groups) do local id = k -- k = group_index local robots_count = FZ.CFG.Robots.CountOnLine for k2,v2 in pairs(v) do -- v2 = robot (monster entity) if v2.position.x == v2.user.move_pos.x and v2.position.y == v2.user.move_pos.y then robots_count = robots_count - 1 end end if robots_count == 0 then -- if all robots in line is finish for k2,v2 in pairs(v) do local robot = v2:ToMonster() -- convert entity to monster data type, but its not necessary, as its already local group_id = robot.user.group_id -- get robot group index local line_id = robot.user.line_id -- get robot index on line robot.position = FZ.CFG.Robots.TeleportPos -- teleport to dead(wait) zone if robot.user.group_id == FZ.CFG.Robots.GroupsCount and robot.user.line_id == FZ.CFG.Robots.CountOnLine then FZ.Game:KillAllMonsters() -- kill all robots FZ.Wave.NeedRespawn = true -- set need respawn FZ.Wave.Timer = 0 -- set second timer end end end end end end function SECOND_INIT() -- 1s second timer on lua-block if FZ.Wave.NeedRespawn == true then -- if need respawn FZ.Wave.Timer = FZ.Wave.Timer + 1 -- add a timer if FZ.Wave.Timer == FZ.CFG.Robots.RespawnTimer then -- if timer = confg (FZ.CFG.Robots.RespawnTimer) FOSTERZ_CREATE_ROBOTS() -- make robots end end end FZ.Game.SetTrigger("InitChecker", true) -- set game .Lua block to use second timer (1s) function FOSTERZ_ROBOTS_RUN() -- run all robots to (move position) for k,v in pairs(FZ.Wave.Groups) do for t,r in pairs(v) do -- r = robot r:MoveTo(r.user.move_pos) end end end function FOSTERZ_CREATE_ROBOTS() FZ.Robots = {} FZ.Wave.Groups = {} FZ.Wave.NeedRespawn = false local index = 1 -- first line index = 1 local group_index = 1 -- first group = 1 because zero in the array counts from the end for i = 1, FZ.CFG.Robots.GroupsCount*FZ.CFG.Robots.CountOnLine do local entity = {} if index > FZ.CFG.Robots.CountOnLine then index = 1 group_index = group_index + 1 end if FZ.Wave.Groups[group_index] == nil then -- if table not maked then make it FZ.Wave.Groups[group_index] = {} end entity.start_pos = {x=0,y=0,z=0} -- how will we change the position start position if FZ.CFG.Robots.WayAxis == "x" then -- if way = x entity.start_pos = { x=FZ.CFG.Robots.StartLine.x-(group_index*FZ.CFG.Robots.InterPos.group), y=FZ.CFG.Robots.StartLine.y+index+(FZ.CFG.Robots.InterPos.line*index), z=FZ.CFG.Robots.StartLine.z } elseif FZ.CFG.Robots.WayAxis == "y" then -- if way = y entity.start_pos = { x=FZ.CFG.Robots.StartLine.x+index+(FZ.CFG.Robots.InterPos.line*index), y=FZ.CFG.Robots.StartLine.y-(group_index*FZ.CFG.Robots.InterPos.group), z=FZ.CFG.Robots.StartLine.z } end if group_index == 1 then -- the first group creates the end way position for anyone index on line entity.move_pos = { x=entity.start_pos.x, y=entity.start_pos.y, z=entity.start_pos.z } if FZ.CFG.Robots.WayAxis == "x" then entity.move_pos.x = entity.move_pos.x + FZ.CFG.Robots.StepsCount elseif FZ.CFG.Robots.WayAxis == "y" then entity.move_pos.y = entity.move_pos.y + FZ.CFG.Robots.StepsCount end if FZ.MovePositions[index] == nil then FZ.MovePositions[index] = {} FZ.MovePositions[index] = entity.move_pos end else entity.move_pos = FZ.MovePositions[index] -- if group > 1 then set (end position) end local robot = FZ.Game.Monster:Create(FZ.CFG.Robots.Monster,entity.start_pos) -- make robot on start position robot.user.start_pos = entity.start_pos -- set startpos into user info robot.user.group_id = group_index -- set group index into user info robot.user.line_id = index -- set line index into user info robot.user.move_pos = entity.move_pos -- set move position into user info, we will use this in FZ.Game.Rule:OnUpdate() FOSTERZ_SET_ATT(robot) -- set robot attr. table.insert(FZ.Wave.Groups[group_index],robot) -- insert robot to table, we will use this in FZ.Game.Rule:OnUpdate() if i == FZ.CFG.Robots.GroupsCount*FZ.CFG.Robots.CountOnLine then -- wait until all robots will be spawned FOSTERZ_ROBOTS_RUN() end -- or you can use this -- robot:MoveTo(robot.user.move_pos) index = index + 1 end end
or
link[pastebin.com]
14 Comments
AREDNAB 30 Sep, 2020 @ 6:16am 
Hey. In which section can I find here to show the speed while playing?
RaianCollyn 21 Apr, 2020 @ 7:58pm 
Thanks man, I needed this, I want to make a different map of the Zombie Scenario, but I wasn't finding the Documentation and API's of Lua Scripts from Studio
IgNiTE 15 Jan, 2020 @ 10:38am 
Nice guide, thanks :cozybethesda:
AfterHandsUp 14 Jan, 2020 @ 6:36pm 
wohhh i see them, thank you very much!
FosterZ [koncha.su]  [author] 14 Jan, 2020 @ 2:43pm 
it is on the pages Common and Game
AfterHandsUp 14 Jan, 2020 @ 7:30am 
guys can u share weapon id and monster for studio? please i need for my map hehe
FosterZ [koncha.su]  [author] 14 Jan, 2020 @ 4:41am 
added simple script
AnggaraNothing 12 Jan, 2020 @ 6:35pm 
Yes because it is still relevant reference.
FosterZ [koncha.su]  [author] 12 Jan, 2020 @ 6:27pm 
Updated. But In the Korean API documentation, the lua-ref. links go to version 5.1
AnggaraNothing 12 Jan, 2020 @ 5:44pm 
CSO Lua is using Lua version 5.3

What's new in 5.3? See here: https://www.lua.org/manual/5.3/readme.html#changes