developer_center:developer_editor:script:game_event
Table of Contents
Game Class
How to Write Event
ScriptSupportEvent:registerEvent([[EventName]],callbackFunctionName)
Example
ScriptSupportEvent:registerEvent([[Game.RunTime]],Update)
Eventlist
EventName | Parameters | Description |
---|---|---|
Game.Hour | hours | World hour time change |
Game.RunTime | second, ticks | World Tick changes (Every 0.05 Seconds or Tick) |
How to Write Gamerule
GameRule.Name = Value
Example
GameRule.EndTime = 6
Gamerule
Name | Descriptionn |
---|---|
GameRule.CurTime | Game time set in edit mode |
GameRule.TimeLocked | Whether to lock the time set in edit mode (0: not locked, 1: locked) |
GameRule.Weather | The weather set in edit mode (0: sunny and rainy, 1: sunny, 2: rainy, 3: thunderstorm) |
GameRule.MaxPlayers | Maximum number of players set in edit mode |
GameRule.BlockDestroy | Whether the block can be destroyed in the edit mode setting (0: no, 1: yes) |
GameRule.BlockPlace | Whether the block can be placed in the edit mode setting (0: no, 1: yes) |
GameRule.BlockUse | Whether the block can be used in the edit mode setting (0: no, 1: yes) |
GameRule.GravityFactor | Gravity multiplier set in edit mode (between 0.1 and 10) |
GameRule.CameraDir | The angle of view set in edit mode (0: main angle of view, 1: back angle of view, 2: front angle of view, 3: lock of main angle of view, 4: lock of back angle of view, 5: lock of front angle of view, 6: lock of top angle of view, 7: lock of custom angle of view, 8: back angle of view 2, 9: Lock back view angle 2) |
GameRule.StartMode | Game start mode for edit mode settings (0: Enabled by the homeowner, 1: Automatically enabled when the number of people reached, 2: Automatically enabled for unlimited conditions) |
GameRule.StartPlayers | The number of people required to start the game set in edit mode |
GameRule.TeamNum | Number of teams set in edit mode |
GameRule.AttackPlayerMode | Attack mode set in edit mode (0: Inter-team attack, 1: Prohibition of attacking players, 2: Free attack) |
GameRule.EndTime | Whether the game set in edit mode is time-limited (0: no time limit, 1-60: time limit 1-60 minutes) |
GameRule.EndScore | Whether to reach the score set in the edit mode to win (0: no, 1-999: reach 1-999 to win) |
GameRule.ScoreKillPlayer | Victory Player Score score for edit mode settings |
GameRule.ScoreKillMob | Defeat monster score set in edit mode |
GameRule.ScoreCollectStar | Edit mode settings get stars score points |
GameRule.ReviveMode | Re-challenge time set in edit mode (0: default, 1-320: automatic resurrection 1-320 seconds after death) |
GameRule.ReviveInvulnerable | Re-challenge protection time set in edit mode (between 1 and 99 seconds, 0 is the default 5 seconds) |
GameRule.DisplayName | Player name display mode for edit mode settings (0: Visible to everyone, 1: Visible only to your own team, 2: Visible only to the enemy team, 3: Invisible to all) |
GameRule.WinLoseEndTime | Victory determination at the end of the time set in edit mode (0: the team with the highest score wins, 1: all win at the end of time, 2: all lose at the end of time) |
GameRule.SaveMode | Edit mode setting whether to exit reset (0: No, 1: Yes) |
GameRule.KillNotify | Whether to open the battle prompt in the edit mode setting (0: no, 1: yes) |
GameRule.BgMusicMode | Game background music set in edit mode (-1: no music, 0: default, 1-8: bgm1-8) |
GameRule.MobGen | Whether to generate monsters set in edit mode (-1: Generate monsters is not checked when creating, 0: No, 1: Yes) |
GameRule.SpawnPtMode | Rally point rules set in edit mode (0: Randomly go to the team’s rally point, 1: Go to the nearest team’s rally point) |
GameRule.MinimapTeams | Map display options set in edit mode (0: Visible to different teams, 1: Not visible to different teams) |
GameRule.PlayerDieDrops | Whether the player in the edit mode setting will drop items after defeating (0: normal drop, 1: empty backpack, 2: reserved items, 3: drop box) |
GameRule.DisplayScore | Whether to display the score and time set by the edit mode (0: no, 1: yes) |
GameRule.LifeNum | Whether to limit the number of lives in the edit mode (0: no limit, 1-99: limit the number of lives to 1-99) |
GameRule.ShowSight | Whether to display the crosshair in the edit mode setting (0: no display, 1: display) |
GameRule.ScoreColorChange | Dye score score set in edit mode |
GameRule.GPoisonSwitch | Whether to open the polluted area in the edit mode setting (0: no, 1: yes) |
GameRule.GPoisonSafeD0 | The radius of the first safe zone set in edit mode (1 to 100 blocks) |
GameRule.GPoisonSafeT0 | The first safe time set in edit mode (1 to 600 seconds) |
GameRule.AllowMidwayJoin | Whether to allow to join the game in the middle of the edit mode setting (0: no, 1: yes) |
GameRule.LifeNumTeamShare | Whether to enable the shared life of the team in the edit mode setting (0: No, 1: Yes) |
GameRule.ViewMode | Whether to open the failure spectator in the edit mode setting (0: no, 1: yes) |
GameRule.ViewType | The spectator type set in edit mode (0: free spectator, 1: follow the screen, 2: switchable) |
GameRule.CountDown | The game start countdown time set in edit mode (1 to 100 seconds) |
GameRule.ScoreResetRound | Whether to enable the round mode in the edit mode setting (0: no, 1: yes) |
GameRule.ResetScore | The score (1 to 100) set by edit mode to reach the score reset |
Api List
Class:apiName(parameters) | Return | Description |
---|---|---|
Game.doGameEnd() | code: number | Game over |
Game.dispatchEvent(msgid: string, params: table) | code: number | Dispatch custom events |
Game.getDefString(id: string) | code: number | Get the default string |
Game.setScriptVar(index: number, val) | code: number | Set script parameters for custom use |
Game.getScriptVar(index: number) | code: number, val | Get script parameters, custom use |
Game.sendScriptVars2Client() | code: number | Upload the set script parameters |
Game.addRenderGlobalEffect(path: string) | code: number | Add global effect |
Game.removeRenderGlobalEffect(path: string) | code: number | Remove the global effect |
Game.setRenderGlobalEffectPos(effectid: string, x: number, y: number, z: number) | code: number | Set the global effect position |
Game.setRenderGlobalEffectScale(effectid: string, scalex: number, scaley: number, scalez: number) | code: number | Set the global effect scaling |
Game.msgBox(msg: string) | code: number | Show a message box |
Game.splitStr(str: string, mark: string) | code: number, strs: table | Split the string |
developer_center/developer_editor/script/game_event.txt · Last modified: 2023/07/17 07:07 by hhuxx1