迷你世界UGC3.0脚本Wiki
Menu
On this page
Sidebar Navigation
快速入门
欢迎MOD、组件介绍
什么是Lua编程
组件介绍
组件说明组件函数
组件属性
事件
触发器事件管理组件事件管理
函数库
服务模块
世界模块管理接口 World对象模块管理接口 GameObject
角色模块管理接口 Actor
玩家模块管理接口 Player
生物模块管理接口 Monster
方块模块管理接口 Block
道具模块管理接口 Item
背包模块管理接口 Backpack
界面模块管理接口 CustomUI
图文信息模块管理接口 Graphics
区域模块管理接口 Area
容器模块管理接口 WorldContainer
资源模块管理接口 Mod
计时器模块管理接口 Timer
状态模块管理接口 Buff
消息模块管理接口 Chat
普通变量数据管理接口 Data
数组变量数据管理接口 Array
二维表变量数据管理接口 Table
云服模块管理接口 CloudSever
全局函数
全局函数枚举
枚举库脚本常见问题
开发者常见问题进阶指南
全局函数触发器脚本交互
对象介绍
二维表介绍
更新日志
更新日志内置枚举库
可在代码里直接调用无需新建对象,调用形式如下:
local errorCode = ErrorCode.OK
local worldType = WorldType.OWTYPE_GAMEMAKER
Lua原生数据及其他全局数据的用法描述如下Lua原生数据类型
数据名称 用法描述
nil 表示一个无效值(在条件表达式中相当于false)
boolean 布尔值,包含两个值:false和true
number 实数,表示双精度类型的实浮点数,也可以是整数
string 字符串,由一对单引号或双引号来表示
table Lua的一种数据结构,可用来创建不同的数据类型,如:数组、字典等
function 由 C 或 Lua 编写的函数
游戏模式
名称 用法描述
WorldType.Single 单人模式
WorldType.Create 多人创造模式
WorldType.Extremity 极限模式
WorldType.CreateToRungame 由创造模式转的生存
WorldType.Gamemaker 自制玩法的编辑模式
WorldType.GamemakerRun 自制玩法的运行模式
WorldType.Freemode 冒险模式之自由模式
WorldType.Record 录像模式
游戏地形
名称 用法描述
TerrainType.Flat 平坦地形
TerrainType.Normal 随机地形
自定义视角编辑状态
名称 用法描述
CameraEditState.Null 空
CameraEditState.Edit 编辑
CameraEditState.Test 测试
装备部位类型
名称 用法描述
EquipSlotType.Head 头
EquipSlotType.Breast 身体
EquipSlotType.Legging 腿
EquipSlotType.Shoe 脚
EquipSlotType.Pifeng 披风
EquipSlotType.Weapon 武器
EquipSlotType.MaxSlots 最大装备栏(用于判断有效性)
游戏战斗结果
名称 用法描述
TeamResults.None 胜负未定
TeamResults.Win 胜利
TeamResults.Lose 失败
TeamResults.Dogfall 平局
玩家背包类型
名称 用法描述
BackpackType.Shortcut 快捷栏
BackpackType.Inventory 存储栏
BackpackType.Equip 装备栏
BackpackType.Extend 扩展背包
背包起始索引
名称 用法描述
BackpackBeginIndex.Shortcut 快捷栏
BackpackBeginIndex.Inventory 存储栏
BackpackBeginIndex.Equip 装备栏
BackpackBeginIndex.ExtBackpack 扩展背包
朝向
名称 用法描述
FaceDir.None 未指定
FaceDir.NegX x反方向, 西
FaceDir.PosX x正方向, 东
FaceDir.NegZ z反方向, 南
FaceDir.PosZ z正方向, 北
FaceDir.NegY y反方向, 下
FaceDir.PosY y正方向, 上
朝向类型
名称 用法描述
FaceType.Yaw 面朝方向
FaceType.Pitch 面仰角
生物属性枚举
名称 用法描述
CreatureAttr.MaxHp 最大生命值
CreatureAttr.CurHp 当前生命值
CreatureAttr.HpRecover 生命恢复
CreatureAttr.MaxHunger 最大饥饿值
CreatureAttr.CurHunger 当前饥饿值
CreatureAttr.CurOxygen 当前氧气值
CreatureAttr.WalkSpeed 移动速度
CreatureAttr.SwinSpeed 游泳速度
CreatureAttr.JumpPower 跳跃力
CreatureAttr.Dodge 闪避率
CreatureAttr.AtkMelee 近战攻击
CreatureAttr.AtkRemote 远程攻击
CreatureAttr.DefMelee 近战防御
CreatureAttr.DefRemote 远程防御
CreatureAttr.Dimension 模型大小
CreatureAttr.Level 等级
CreatureAttr.DefChaos 混乱防御
CreatureAttr.PackSize 背包空间
CreatureAttr.ViewDistance 视野距离
CreatureAttr.BodyLerpSpeed 转身速度
CreatureAttr.AtkPhysical 物理攻击
CreatureAttr.AtkMagic 元素攻击
CreatureAttr.DefPhysical 物理防御
CreatureAttr.DefMagic 元素防御
CreatureAttr.ExtraHp 临时生命值
CreatureAttr.Toughness 韧性值
CreatureAttr.FlySpeed 飞行速度
CreatureAttr.ViewDis 视野范围
CreatureAttr.AttackDis 攻击距离
CreatureAttr.Atk 攻击力
CreatureAttr.EnableMove 可移动
CreatureAttr.EnableAttack 可攻击
CreatureAttr.EnableBeattacked 可被攻击
CreatureAttr.EnableBekilled 可被杀死
CreatureAttr.EnablePickup 可拾取道具
CreatureAttr.EnableDeathdropitem 死亡掉落
生物/玩家
名称 用法描述
RoleAttr.MaxHp 最大生命值
RoleAttr.CurHp 当前生命值
RoleAttr.HpRecover 生命恢复
RoleAttr.CurHunger 饥饿度
RoleAttr.MaxOxygen 最大氧气值
RoleAttr.CurOxygen 当前氧气值
RoleAttr.WalkSpeed 移动速度
RoleAttr.RunSpeed 奔跑速度
RoleAttr.SwinSpeed 游泳速度
RoleAttr.JumpPower 跳跃力
RoleAttr.Gravity 重力值
RoleAttr.CurStrength 当前体力值
RoleAttr.MaxStrength 当前最大体力值
RoleAttr.FlySpeed 飞行速度
RoleAttr.AttackDis 攻击距离
RoleAttr.ViewDis 视野距离
RoleAttr.Atk 攻击力
RoleAttr.PunchArmor 近战防御
RoleAttr.RangeArmor 远程防御
道具设置枚举
名称 用法描述
ItemAbility.Throw 道具不可丢弃
ItemAbility.Drop 道具不可掉落
生物行为枚举
名称 用法描述
CreatureMotion.Idle 空闲
CreatureMotion.Standby 待机
CreatureMotion.Stroll 闲逛
CreatureMotion.AtkMelee 近战攻击
CreatureMotion.AtkRemote 远程攻击
CreatureMotion.Follow 跟随
CreatureMotion.Swim 游泳
CreatureMotion.RunAway 逃跑
CreatureMotion.SelfBomb 自爆
CreatureMotion.Beattracted 被吸引
CreatureMotion.Copulation 交配
玩家行为枚举
名称 用法描述
PlayerMotion.Static 静止
PlayerMotion.Walk 行走
PlayerMotion.Run 奔跑
PlayerMotion.Jump 跳跃
PlayerMotion.JumpTwice 二段跳
PlayerMotion.Sneak 潜行
PlayerMotion.FallGround 落地
PlayerMotion.Swim 游泳
角色行为枚举
名称 用法描述
RoleMotion.Stand 站立
RoleMotion.Walk 行走
RoleMotion.Run 奔跑
RoleMotion.Jump 跳跃
RoleMotion.Sneak 潜行
RoleMotion.FallGround 落地
RoleMotion.Swim 游泳
伤害类型枚举
名称 用法描述
HurtType.All 所有伤害(只设置免疫伤害接口有效)
队伍属性枚举
名称 用法描述
TeamAttr.PlayerNum 玩家数量
TeamAttr.Score 分数
方块属性枚举
名称 用法描述
BlockAttr.ExplodeResistance 爆炸抗性
BlockAttr.Hardness 硬度
BlockAttr.Glissade 滑行惯性
BlockAttr.BurningSpeed 燃烧速度
BlockAttr.BurningProbability 燃烧几率
BlockAttr.Lightness 亮度
方块权限
名称 用法描述
BlockLimits.EnableDestroyed 可破坏
BlockLimits.EnableBeoperated 可操作
BlockLimits.EnableBepushed 可被推动
BlockLimits.EnableDropItem 可掉落道具
BlockLimits.BepushedDropItem 被推动掉落
方块状态
名称 用法描述
BlockStatus.Active 活跃(被激活)
BlockStatus.Inactive 不活跃(未被激活)
天气状态枚举,局部天气
名称 用法描述
GroupWeatherType.ShineAndRain 晴雨交替
GroupWeatherType.Shine 晴天
GroupWeatherType.Rain 雨天
GroupWeatherType.Thunder 雷暴
GroupWeatherType.Bad 恶劣天气
GroupWeatherType.Snow 雪天
GroupWeatherType.Sandduststorm 沙尘暴
GroupWeatherType.Tempest 暴风雨
GroupWeatherType.Blizzard 暴风雪
地形组枚举值
名称 用法描述
WeatherGroup.Global 全局对象
WeatherGroup.Common 常见组
WeatherGroup.Ocean 海洋组
WeatherGroup.Desert 沙漠组
WeatherGroup.Frigidzone 普通寒带组
WeatherGroup.Coldzone 高峰寒带组
WeatherGroup.Volcano 火山组
WeatherGroup.Nunja 湿地组
WeatherGroup.Plain 平坦组
WeatherGroup.AirIsland 空岛组
视口方向
名称 用法描述
ViewPortType.Main 主视角
ViewPortType.Back 背视角
ViewPortType.Front 正视角
ViewPortType.Back2 背视角2
ViewPortType.Top 俯视角
ViewPortType.Custom 自定义视角
变量类型
名称 用法描述
VarType.Pos 位置
VarType.Areains 区域
VarType.Number 数值
VarType.String 字符串
VarType.Boolean 布尔值
VarType.Player 玩家
VarType.PlayerGroup 玩家组
VarType.BlockType 方块类型
VarType.ItemType 道具类型
VarType.Creature 生物
VarType.CreatureType 生物类型
VarType.CreatureGroup 生物组
VarType.Timer 定时器
VarType.EffectType 特效类型
VarType.PosGroup 位置组
VarType.AreaGroup 区域组
VarType.NumberGroup 数值组
VarType.StringGroup 字符串组
VarType.BooleanGroup 布尔值组
VarType.BlockTypeGroup 方块类型组
VarType.ItemTypeGroup 道具类型组
VarType.CreatureTypeGroup 生物类型组
VarType.TimerGroup 计时器组
VarType.EffectTypeGroup 特效类型组
图文信息枚举
名称 用法描述
GraphicsType.Hornbook 文字板
GraphicsType.Suspendbook 漂浮文字
GraphicsType.Progress 进度条
GraphicsType.ArrowPos 箭头 指向位置
GraphicsType.ArrowActor 箭头 指向生物
GraphicsType.LinePos 线 指向位置
GraphicsType.LineActor 线 指向生物
GraphicsType.SurfacePos 面 指向界面
GraphicsType.SurfaceActor 面 指向生物
GraphicsType.Image 图片
排序方式
名称 用法描述
SortType.Up 升序,
SortType.Down 降序,
移动方式
名称 用法描述
MoveType.Walking 行走,
MoveType.Flying 飞行,
MoveType.Swimming 游泳,
MoveType.Auto 自动调整
显示板视频播放模式
名称 用法描述
ViedoPlayMode.Repeat 循环播放
ViedoPlayMode.Once 单次播放
时间值枚举
名称 用法描述
EventDate.Year 年
EventDate.Month 月
EventDate.Day 日
EventDate.Hour 时
EventDate.Minute 分
EventDate.Second 秒
EventDate.Timestamp 时间戳
EventDate.Dayofweek 星期几
道具属性
名称 用法描述
ItemAttr.Attack 攻击力
ItemAttr.Stackmax 叠加数
ItemAttr.ShortDefense 近战防御
ItemAttr.LongDefense 远程防御
ItemAttr.ExplodeDefense 爆炸防御
ItemAttr.FireDefense 燃烧防御
ItemAttr.PoisonDefense 毒素防御
ItemAttr.WitherDefense 混乱防御
ItemAttr.Duration 耐久度
ItemAttr.FireInterval 射击间隔
ItemAttr.Magazines 弹夹量
ItemAttr.Quality 品质
ItemAttr.ItemType 道具类型
掉落物掉落方式
名称 用法描述
DropMode.DiscardItem 丢弃道具
DropMode.DestroyBox 箱子被破坏掉落
DropMode.DefeatMob 生物被击败掉落
DropMode.DestroyBlock 方块被破坏掉落
DropMode.SpawnItem 触发器创建
DropMode.ChangePlayMode 掉落物对象转玩法创建
动作播放方式
名称 用法描述
AnimMode.Loop 循环播放
AnimMode.Once 播放一次
AnimMode.OnceStop 播放一次完毕,停在末尾
AnimMode.Default 表格默认值播放
线性变换
名称 用法描述
Easing.None 无动画
Easing.Linear 直线变换
Easing.QuadIn 平方曲线1渐入
Easing.QuadOut 平方曲线2渐出
Easing.QuadInOut 平方曲线3进出
Easing.ExpoIn 指数曲线1渐入
Easing.ExpoOut 指数曲线2渐出
Easing.ExpoInOut 指数曲线3进出
Easing.CircIn 圆曲线1渐入
Easing.CircOut 圆曲线2渐出
Easing.CircInOut 圆曲线3进出
Easing.ElasticIn 弹簧曲线1渐入
Easing.ElasticOut 弹簧曲线2渐出
Easing.ElasticInOut 弹簧曲线3进出
Easing.BackIn 回退曲线1渐入
Easing.BackOut 回退曲线2渐出
Easing.BackInOut 回退曲线3进出
Easing.BounceIn 弹跳曲线1渐入
Easing.BounceOut 弹跳曲线1渐出
Easing.BounceInOut 弹跳曲线1进出
天空盒贴图
名称 用法描述
SkyboxMap.Sky 天空贴图
SkyboxMap.Sun 太阳贴图
SkyboxMap.Moon 月亮贴图
天空盒颜色
名称 用法描述
SkyboxColor.Top 天空顶部颜色
SkyboxColor.Middle 天空腰部颜色
SkyboxColor.Bottom 天空底部颜色
SkyboxColor.Light 天空光照颜色
SkyboxColor.Env 环境光颜色
SkyboxColor.Sun 太阳颜色
SkyboxColor.Moon 月亮颜色
SkyboxColor.Cloud 云颜色
SkyboxColor.Fog 雾颜色
天空盒参数
名称 用法描述
SkyboxAttr.SunScale 太阳大小
SkyboxAttr.MoonScale 月亮大小
SkyboxAttr.StarDensity 星星密度
SkyboxAttr.CloudSpeed 云的运动速度
SkyboxAttr.CloudDensity 云的密度
SkyboxAttr.CloudHigh 云的高度
SkyboxAttr.FogreMinDis 雾的最近距离
SkyboxAttr.FogreMaxDis 雾的最远距离
SkyboxAttr.Template 模板
天空盒环境粒子参数
名称 用法描述
SkyboxParticle.Strength 强度
SkyboxParticle.Range 范围
SkyboxParticle.Speed 速度
SkyboxParticle.Randomness 运动不规则度
天空盒滤镜参数
名称 用法描述
SkyboxFilter.Contrast 对比度
SkyboxFilter.Saturation 饱和度
SkyboxFilter.Flood 泛光强度
SkyboxFilter.Exposure 曝光强度
SkyboxFilter.Volumelight 体积光强度
SkyboxFilter.Gamma 伽马强度
SkyboxFilter.Dof 景深强度-暂时没用到
SkyboxFilter.Color 滤镜颜色
SkyboxFilter.Lut 色彩校正
SkyboxFilter.Template 滤镜模板
天空盒开关
名称 用法描述
SkyboxSwitch.Fogenable 雾开关
摄像机属性
名称 用法描述
CameraModel.MoveFollow 跟随角色移动
CameraModel.RotateFollow 跟随角色旋转
CameraModel.Autoindent 阻挡后自动缩进
CameraModel.RelativeRotate 相对人物旋转
CameraModel.RoleTranslucent 角色半透
摄像机旋转模式
名称 用法描述
CameraRotate.AllDir 全方向
CameraRotate.OnlyYaw 仅左右
CameraRotate.OnlyPitch 仅上下
CameraRotate.NoTurn 无法转动
绝对阵营
名称 用法描述
AbsoluteCampType.Noteam 无队伍
AbsoluteCampType.Team1 队伍1
AbsoluteCampType.Team2 队伍2
AbsoluteCampType.Team3 队伍3
AbsoluteCampType.Team4 队伍4
AbsoluteCampType.Team5 队伍5
AbsoluteCampType.Team6 队伍6
AbsoluteCampType.TeamNpc1 绝对阵营-npc队伍1
AbsoluteCampType.TeamNpc2 绝对阵营-npc队伍2
AbsoluteCampType.TeamNpc3 绝对阵营-npc队伍3
AbsoluteCampType.Enemy 中立敌对
AbsoluteCampType.Passive 中立被动
相对阵营
名称 用法描述
RelativeCampType.Friendly 友方
RelativeCampType.Enemy 敌方
RelativeCampType.Neutral 中立
RelativeCampType.Any 任意
玩家关系
名称 用法描述
PlayerRelations.CollectMaps 收藏地图
PlayerRelations.EvaluateMaps 评价地图
PlayerRelations.InviteFriend 邀请好友
货币类型
名称 用法描述
MiniCurrency.MiniBean 迷你豆
MiniCurrency.MiniCoin 迷你币
MiniCurrency.MiniPoint 迷你点
开发者商店页面类型
名称 用法描述
MiniShopPage.Item 道具购买
MiniShopPage.Skin 皮肤
MiniShopPage.Convert 兑换
MiniShopPage.Welfare 福利
MiniShopPage.MiniVip 大会员
MiniShopPage.WareHouse 打开仓库
MiniShopPage.CustomCoin 打开自定义货币界面
像素单位
名称 用法描述
PixelUnits.Percentage 百分比
PixelUnits.Value 绝对值
水平偏移
名称 用法描述
HorizontalOffset.Left 居左
HorizontalOffset.Centered 居中
HorizontalOffset.Right 居右
垂直偏移
名称 用法描述
VerticalOffset.Top 居上
VerticalOffset.Centered 居中
VerticalOffset.Bottom 居下
元件类型
名称 用法描述
ElementType.Texture 图片
ElementType.Button 按钮
ElementType.Text 文本
ElementType.InputText 输入框
ElementType.Loader3D 3d装载器
ElementType.SlidingContainer 滑动容器
插件类型
名称 用法描述
CustomModType.Block 方块插件 预制
CustomModType.Monster 生物插件
CustomModType.Item 道具插件
CustomModType.Recipe 配方插件
CustomModType.Furnace 熔炼插件
CustomModType.Status 状态插件
CustomModType.Biome 地形插件
CustomModType.Actor 实体
CustomModType.UI UI
CustomModType.Rule 世界规则
天气类型
名称 用法描述
WeatherType.None 无天气
WeatherType.Sunshine 晴天
WeatherType.Rain 雨天
WeatherType.Sandstorm 沙尘暴
WeatherType.Snow 雪天
WeatherType.UnderWater 暴雨
WeatherType.Volcano 火山
WeatherType.Custom 自定义
进度图案
名称 用法描述
ProgressImg.Background 进度背景
ProgressImg.Progress 进度值
射线检测返回类型
名称 用法描述
RayDetectType.Block 方块类型
RayDetectType.Player 玩家
RayDetectType.Actor 生物
RayDetectType.ActorType 生物类型
获取玩家内部控件高度
名称 用法描述
PlayerBodyUIHight.Nick 昵称
PlayerBodyUIHight.Title 称号
PlayerBodyUIHight.EffEct 头部动效
PlayerBodyUIHight.HpBar 血条
UI滑动方向
名称 用法描述
UIScollDir.Horizontal 水平滑动
UIScollDir.Vertical 垂直滑动
UIScollDir.Both 自由滑动
角度朝向
名称 用法描述
TurnFaceDir.Yaw 水平朝向
TurnFaceDir.Pitch 垂直朝向
进度值类型
名称 用法描述
ProgressVal.Min 最小值
ProgressVal.Max 最大值
ProgressVal.Current 当前值
ProgressVal.CurAndMax 当前值和最大值
天空盒时间
名称 用法描述
SkyboxTime.Current 当前时间
SkyboxTime.Time0 天空盒0点
SkyboxTime.Time4 天空盒4点
SkyboxTime.Time6 天空盒6点
SkyboxTime.Time8 天空盒8点
SkyboxTime.Time12 天空盒12点
SkyboxTime.Time16 天空盒16点
SkyboxTime.Time18 天空盒18点
SkyboxTime.Time20 天空盒20点
SkyboxTime.TimeAll 所有时间段
枪械状态
名称 用法描述
GunState.Entry 进入
GunState.Exit 离开
枪械触发事件类型
名称 用法描述
GunAction.Equip 举枪
GunAction.Idle 腰射待机
GunAction.Fire 腰射开火
GunAction.Load 腰射手动上膛
GunAction.Run 持枪冲刺
GunAction.Aim 瞄准待机
GunAction.AimFire 瞄准开火
GunAction.AimLoad 瞄准手动上膛
GunAction.Reload 腰射换弹
GunAction.ReloadEmpty 腰射空仓换弹
GunAction.Inspect 检视
枪械禁用类型
名称 用法描述
GunActionBan.Equip 举枪
GunActionBan.Fire 腰射开火
GunActionBan.Load 腰射手动上膛
GunActionBan.Run 持枪冲刺
GunActionBan.Aim 瞄准待机
GunActionBan.AimFire 瞄准开火
GunActionBan.AimLoad 瞄准手动上膛
GunActionBan.Reload 腰射换弹
GunActionBan.ReloadEmpty 腰射空仓换弹
GunActionBan.Inspect 检视
动作总开关
名称 用法描述
Ability.Movement 移动能力总开关
Ability.Walking 行走
Ability.Flying 飞行
Ability.Swimming 游泳
Ability.Sneaking 潜行
Ability.Sprinting 疾跑
Ability.Cube 方块能力总开关
Ability.Interaction 交互方块
Ability.Place 摆放方块
Ability.Break 破坏方块
Ability.Item 道具能力总开关
Ability.Use 使用道具
Ability.Pick 拾取道具
Ability.Drop 丢弃道具
Ability.Attack 普通攻击
Ability.CanBePickup 可被举起
Ability.CanUseItemWhenBePickup 被举起时可否使用道具
Ability.EnableBeattacked 可受伤
Ability.EnableBekilled 可被杀死
Ability.EnableDeathdropitem 杀死有掉落物
Ability.EnableSwitchShortcut 可切换快捷栏
Ability.EnableRotatingCamera 可旋转摄像机
输出日志等级
名称 用法描述
LogLevel.Print 普通输出
LogLevel.Warn 警告输出
LogLevel.Error 错误输出
错误码
名称 用法描述
ErrorCode.OK 成功
ErrorCode.FAILED 失败
举起动作类型
名称 用法描述
PickupActionType.Pickup 拾取
PickupActionType.Drop 放下
PickupActionType.Throw 投掷
PickupActionType.Unbind 解绑
玩家内置UI类型
名称 用法描述
PlayerNameType.Nick 昵称
PlayerNameType.Title 称号
PlayerNameType.EffEct 头部特效
枪械属性
名称 用法描述
GunAttr.ReloadPhase2Time 换弹行为时间
GunAttr.ReloadPhase2TimeEmpty 空仓换弹行为时间
对象类型
名称 用法描述
ObjType.Entity 实体
ObjType.Mob 生物
ObjType.Player 玩家
ObjType.World 世界
ObjType.Block 方块
ObjType.UI UI编辑界面
ObjType.Area 区域
ObjType.Projectile 投掷物对象
ObjType.Pos 位置
ObjType.DropItem 掉落物
组件属性访问权限
名称 用法描述
CmpProPermission.Public 公开
CmpProPermission.Private 私有
CmpProPermission.Read 只读
设备类型
名称 用法描述
DeviceType.PC PC端
DeviceType.Android 安卓
DeviceType.IOS 苹果
DeviceType.Other 其他
Last updated: 2025/4/21 15:55Pager
Previous page
全局函数
Next page
开发者常见问题