# Event-System Event

# Game Event managementEvents

Simply add events that need to be monitored without creating event object, example as below:

--Game Event---
ScriptSupportEvent:registerEvent([=[Game.Start]=], Game_StartGame)
ScriptSupportEvent:registerEvent([=[Game.Run]=], Game_Update)
ScriptSupportEvent:registerEvent([=[Game.End]=], Game_GameOver)
--Player Event---
ScriptSupportEvent:registerEvent([=[Player.Die]=], Player_Dead)
ScriptSupportEvent:registerEvent([=[Player.Revive]=], Player_Revive)
ScriptSupportEvent:registerEvent([=[Player.AddItem]=], BackPack_AddItem)
--Block Event---
ScriptSupportEvent:registerEvent([=[Block.Add]=], Block_Add)
ScriptSupportEvent:registerEvent([=[Block.DestroyBy]=], Block_Destroy)
ScriptSupportEvent:registerEvent([=[Block.Trigger]=], Block_Trigger)

# Game Event Type and Description

No. Event Type Description
1 World Event Relevant events in map
2 Logic Event Game logic related events
3 Player Event Player related events
4 Creature Event Creature related events
5 Block Event Block related events
6 Item Event Item related events
7 Particle Event Particle related events

# World Event (World)

Name Description Params
Weather.Changed Change of weather None
Backpack.ItemTakeOut Container has item output {blockid, x, y, z, itemid, itemnum}1.1+
Backpack.ItemPutIn Container has item input {blockid, x, y, z, itemid, itemnum}1.1+
Backpack.ItemChange Change of backpack bar {blockid, x, y, z, itemid, itemnum}
  • World Event相关示例:

--写个函数,随便命名,当Change of weather时会执行此函数
local function Weather_Changed()
	Chat:sendSystemMsg("发生事件:Change of weather")
end
--注册监听器,Change of weather时执行Weather_Changed函数
--第一个参数是监听的事件,第二个参数Weather_Changed即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Weather.Changed]=],Weather_Changed)
--写个函数,随便命名,当Change of backpack bar时会执行此函数
local function Backpack_ItemChange(event)
	Chat:sendSystemMsg("发生事件:Change of backpack bar")
	Chat:sendSystemMsg("参数blockid为:"..event.blockid)
	Chat:sendSystemMsg("参数x为:"..event.x)
	Chat:sendSystemMsg("参数y为:"..event.y)
	Chat:sendSystemMsg("参数z为:"..event.z)
	Chat:sendSystemMsg("参数itemid为:"..event.itemid)
	Chat:sendSystemMsg("参数itemnum为:"..event.itemnum)
end
--注册监听器,Change of backpack bar时执行Backpack_ItemChange函数
--第一个参数是监听的事件,第二个参数Backpack_ItemChange即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Backpack.ItemChange]=],Backpack_ItemChange)

# Logic Event (Game)

Name Description Params
Game.AnyPlayer.Defeat Any player is defeated {eventobjid, toobjid}
Game.AnyPlayer.EnterGame Any player enters game {eventobjid, toobjid}
Game.AnyPlayer.LeaveGame Any player leaves game {eventobjid, toobjid}
Game.AnyPlayer.ReadStage Any player loads game None
Game.AnyPlayer.Victory Any player wins {eventobjid, toobjid}
Game.End Game over None
Game.Hour World time is [n] {hour}
Game.Load Start game None
Game.Run Game is running None
Game.RunTime World time is [n] second {second}
Game.Start Game start None
Game.TimeOver Game timeout None
minitimer.change Any change of Timer {timerid, timername}1.1+
  • Logic Event相关示例:
--写个函数,随便命名,当Any player is defeated时会执行此函数
local function Game_AnyPlayer_Defeat(event)
	Chat:sendSystemMsg("发生事件:Any player is defeated")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
end
--注册监听器,Any player is defeated时执行Game_AnyPlayer_Defeat函数
--第一个参数是监听的事件,第二个参数Game_AnyPlayer_Defeat即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.Defeat]=],Game_AnyPlayer_Defeat)
--写个函数,随便命名,当Any player enters game时会执行此函数
local function Game_AnyPlayer_EnterGame(event)
	Chat:sendSystemMsg("发生事件:Any player enters game")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
end
--注册监听器,Any player enters game时执行Game_AnyPlayer_EnterGame函数
--第一个参数是监听的事件,第二个参数Game_AnyPlayer_EnterGame即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.EnterGame]=],Game_AnyPlayer_EnterGame)
--写个函数,随便命名,当Any player leaves game时会执行此函数
local function Game_AnyPlayer_LeaveGame(event)
	Chat:sendSystemMsg("发生事件:Any player leaves game")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
end
--注册监听器,Any player leaves game时执行Game_AnyPlayer_LeaveGame函数
--第一个参数是监听的事件,第二个参数Game_AnyPlayer_LeaveGame即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.LeaveGame]=],Game_AnyPlayer_LeaveGame)
--写个函数,随便命名,当Any player loads game时会执行此函数
local function Game_AnyPlayer_ReadStage()
	Chat:sendSystemMsg("发生事件:Any player loads game")
end
--注册监听器,Any player loads game时执行Game_AnyPlayer_ReadStage函数
--第一个参数是监听的事件,第二个参数Game_AnyPlayer_ReadStage即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.ReadStage]=],Game_AnyPlayer_ReadStage)
--写个函数,随便命名,当Any player wins时会执行此函数
local function Game_AnyPlayer_Victory(event)
	Chat:sendSystemMsg("发生事件:Any player wins")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
end
--注册监听器,Any player wins时执行Game_AnyPlayer_Victory函数
--第一个参数是监听的事件,第二个参数Game_AnyPlayer_Victory即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.Victory]=],Game_AnyPlayer_Victory)
--写个函数,随便命名,当Game over时会执行此函数
local function Game_End()
	Chat:sendSystemMsg("发生事件:Game over")
end
--注册监听器,Game over时执行Game_End函数
--第一个参数是监听的事件,第二个参数Game_End即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.End]=],Game_End)
--写个函数,随便命名,当World time is [n]时会执行此函数
local function Game_Hour(event)
	Chat:sendSystemMsg("发生事件:World time is [n]")
	Chat:sendSystemMsg("参数hour为:"..event.hour)
end
--注册监听器,World time is [n]时执行Game_Hour函数
--第一个参数是监听的事件,第二个参数Game_Hour即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.Hour]=],Game_Hour)
--写个函数,随便命名,当Start game时会执行此函数
local function Game_Load()
	Chat:sendSystemMsg("发生事件:Start game")
end
--注册监听器,Start game时执行Game_Load函数
--第一个参数是监听的事件,第二个参数Game_Load即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.Load]=],Game_Load)
--写个函数,随便命名,当Game is running时会执行此函数
--这个事件每50ms会被触发一次,所以函数内部不宜调用发送消息的接口,否则聊天框会被刷屏
local function Game_Run()
	--Chat:sendSystemMsg("发生事件:Game is running")
	--每50ms给房主血量增加1,直到血量不低于100
	local result,hp=Player:getAttr(0,2)--获取房主当前血量
	if hp<100 then--如果血量小于100
		Player:setAttr(0,2,hp+1)--给房主血量加一
	end
end
--注册监听器,Game is running时执行Game_Run函数
--第一个参数是监听的事件,第二个参数Game_Run即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.Run]=],Game_Run)
--写个函数,随便命名,当World time is [n] second时会执行此函数
--这个事件每秒都会被触发一次,所以函数内部不宜调用发送消息的接口,否则聊天框会被刷屏
local function Game_RunTime(event)
	--Chat:sendSystemMsg("发生事件:World time is [n] second")
	--Chat:sendSystemMsg("参数second为:"..event.second)
	--每秒给房主饥饿值增加1,直到饥饿值不低于100
	local result,hunger=Player:getAttr(0,6)--获取房主当前饥饿值
	if hunger<100 then--如果饥饿值小于100
		Player:setAttr(0,6,hunger+1)--给房主饥饿值加一
	end
end
--注册监听器,World time is [n] second时执行Game_RunTime函数
--第一个参数是监听的事件,第二个参数Game_RunTime即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.RunTime]=],Game_RunTime)
--写个函数,随便命名,当Game start时会执行此函数
local function Game_Start()
	Chat:sendSystemMsg("发生事件:Game start")
end
--注册监听器,Game start时执行Game_Start函数
--第一个参数是监听的事件,第二个参数Game_Start即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.Start]=],Game_Start)
--写个函数,随便命名,当Game timeout时会执行此函数
local function Game_TimeOver()
	Chat:sendSystemMsg("发生事件:Game timeout")
end
--注册监听器,Game timeout时执行Game_TimeOver函数
--第一个参数是监听的事件,第二个参数Game_TimeOver即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Game.TimeOver]=],Game_TimeOver)
--写个函数,随便命名,当Any change of Timer时会执行此函数
local function minitimer_change(event)
	Chat:sendSystemMsg("发生事件:Any change of Timer")
	Chat:sendSystemMsg("参数timerid为:"..event.timerid)
	Chat:sendSystemMsg("参数timername为:"..event.timername)
end
--注册监听器,Any change of Timer时执行minitimer_change函数
--第一个参数是监听的事件,第二个参数minitimer_change即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[minitimer.change]=],minitimer_change)

# Player Event (Player)

Name Description Params
Player.AddItem Add new item {eventobjid, toobjid, itemid, itemnum}
Player.AreaIn Player enters area {eventobjid, areaid}
Player.AreaOut Player leaves area {eventobjid, areaid}
Player.Attack Player attacking {eventobjid, toobjid}
Player.AttackHit Player attack hits {eventobjid, toobjid}
Player.BackPackChange Change of backpack bar {eventobjid, toobjid, itemid, itemnum}
Player.BeHurt Player take damage {eventobjid, toobjid}
Player.ChangeAttr Change of attribute {eventobjid, playerattr}
Player.ClickActor Click on creation {eventobjid, toobjid}
Player.ClickBlock Click on block {eventobjid, blockid, x, y, z}
Player.Collide Collide with other player {eventobjid, toobjid}
Player.ConsumeItem Consume item {eventobjid, toobjid, itemid, itemnum}
Player.DamageActor Deals damage to other player {eventobjid, toobjid}
Player.DefeatActor Defeat object {eventobjid, toobjid}
Player.Die Player die {eventobjid, toobjid}
Player.DiscardItem Discard item {eventobjid, toobjid, itemid, itemnum}1.1+
Player.DismountActor Cancel riding mount {eventobjid, toobjid}
Player.EquipChange Change of armor bar {eventobjid, toobjid, itemid, itemnum}
Player.EquipOff Unequip armor {eventobjid, toobjid, itemid, itemnum}1.1+
Player.EquipOn Equip armor {eventobjid, toobjid, itemid, itemnum}1.1+
Player.Init Player is restored {eventobjid, toobjid}
Player.InputContent Events triggered by changes in chat box {eventobjid, content}1.1+
Player.InputKeyDown Button pressed {eventobjid, vkey}1.5+
Player.InputKeyOnPress Button being pressed {eventobjid, vkey}1.5+
Player.InputKeyUp Button released {eventobjid, vkey}1.5+
Player.JoinTeam Join team {eventobjid, toobjid}
Player.MotionStateChange Change motion state {eventobjid, playermotion}
Player.MountActor Ride mount/vehicles {eventobjid, toobjid}
Player.MoveOneBlockSize Move one block {eventobjid, toobjid}
Player.NewInputContent Enter text string {eventobjid, content}1.4+
Player.PickUpItem Pick up drop item {eventobjid, toobjid, itemid, itemnum}
Player.PlayAction Change of expression {eventobjid, act}
Player.Revive Player respawn {eventobjid, toobjid}
Player.SelectShortcut Make selection on shortcut bar {eventobjid, toobjid, itemid, itemnum}
Player.ShortcutChange Change of shortcut bar {eventobjid, toobjid, itemid, itemnum}
Player.UseItem Use item {eventobjid, toobjid, itemid, itemnum}
  • Player Event相关示例:
--写个函数,随便命名,当Add new item时会执行此函数
local function Player_AddItem(event)
	Chat:sendSystemMsg("发生事件:Add new item")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
	Chat:sendSystemMsg("参数itemid为:"..event.itemid)
	Chat:sendSystemMsg("参数itemnum为:"..event.itemnum)
end
--注册监听器,Add new item时执行Player_AddItem函数
--第一个参数是监听的事件,第二个参数Player_AddItem即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Player.AddItem]=],Player_AddItem)
--写个函数,随便命名,当Player enters area时会执行此函数
local function Player_AreaIn(event)
	Chat:sendSystemMsg("发生事件:Player enters area")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数areaid为:"..event.areaid)
end
--注册监听器,Player enters area时执行Player_AreaIn函数
--第一个参数是监听的事件,第二个参数Player_AreaIn即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Player.AreaIn]=],Player_AreaIn)
--写个函数,随便命名,当Player leaves area时会执行此函数
local function Player_AreaOut(event)
	Chat:sendSystemMsg("发生事件:Player leaves area")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数areaid为:"..event.areaid)
end
--注册监听器,Player leaves area时执行Player_AreaOut函数
--第一个参数是监听的事件,第二个参数Player_AreaOut即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Player.AreaOut]=],Player_AreaOut)

# Creature Event (Actor)

Name Description Params
Actor.AreaIn Creature enters area {eventobjid, areaid}
Actor.AreaOut Creature leaves area {eventobjid, areaid}
Actor.Attack Creature attacking {eventobjid, toobjid}
Actor.AttackHit Creature attack hits {eventobjid, toobjid}
Actor.BeHurt Creature take damage {eventobjid, toobjid}
Actor.Beat Creature defeat other player/creature {eventobjid, toobjid}
Actor.ChangeAttr Change of attribute {eventobjid, actorattr}
Actor.ChangeMotion Creature change motion state {eventobjid, actormotion}
Actor.Collide Collide with other player or creature {eventobjid, toobjid}
Actor.Create Creature is created {eventobjid, toobjid}
Actor.Damage Deals damage to others {eventobjid, toobjid}
Actor.Die Creature die {eventobjid, toobjid}
Actor.Projectile.Hit Smashed by projectile {eventobjid, toobjid(opt), blockid(opt), x, y, z}
  • Creature Event相关示例:
--写个函数,随便命名,当Creature enters area时会执行此函数
local function Actor_AreaIn(event)
	Chat:sendSystemMsg("发生事件:Creature enters area")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数areaid为:"..event.areaid)
end
--注册监听器,Creature enters area时执行Actor_AreaIn函数
--第一个参数是监听的事件,第二个参数Actor_AreaIn即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Actor.AreaIn]=],Actor_AreaIn)
---Actor.AreaOut---49
--写个函数,随便命名,当Creature leaves area时会执行此函数
local function Actor_AreaOut(event)
	Chat:sendSystemMsg("发生事件:Creature leaves area")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数areaid为:"..event.areaid)
end
--注册监听器,Creature leaves area时执行Actor_AreaOut函数
--第一个参数是监听的事件,第二个参数Actor_AreaOut即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Actor.AreaOut]=],Actor_AreaOut)
---Actor.Attack---50
--写个函数,随便命名,当Creature attacking时会执行此函数
local function Actor_Attack(event)
	Chat:sendSystemMsg("发生事件:Creature attacking")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
end
--注册监听器,Creature attacking时执行Actor_Attack函数
--第一个参数是监听的事件,第二个参数Actor_Attack即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Actor.Attack]=],Actor_Attack)
---Actor.AttackHit---51
--写个函数,随便命名,当Creature attack hits时会执行此函数
local function Actor_AttackHit(event)
	Chat:sendSystemMsg("发生事件:Creature attack hits")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
end
--注册监听器,Creature attack hits时执行Actor_AttackHit函数
--第一个参数是监听的事件,第二个参数Actor_AttackHit即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Actor.AttackHit]=],Actor_AttackHit)

# Block Event (Block)

Name Description Params
Block.Add Block is created {blockid, x, y, z}
Block.DestroyBy Block is destoryed {eventobjid(opt), blockid, x, y, z}
Block.Dig.Begin Start mining block {eventobjid, blockid, x, y, z}
Block.Dig.Cancel Cancel mining block {eventobjid, blockid, x, y, z}
Block.Dig.End Complete mining block {eventobjid, blockid, x, y, z}
Block.Fertilize Block being fertilized {eventobjid, blockid, x, y, z}
Block.PlaceBy Block being placed {eventobjid, blockid, x, y, z}
Block.Remove Block being removed {blockid, x, y, z}
Block.Trigger Block being triggered {eventobjid, blockid, x, y, z}
  • Block Event相关示例:
--写个函数,随便命名,当Block is created时会执行此函数
local function Block_Add(event)
	Chat:sendSystemMsg("发生事件:Block is created")
	Chat:sendSystemMsg("参数blockid为:"..event.blockid)
	Chat:sendSystemMsg("参数x为:"..event.x)
	Chat:sendSystemMsg("参数y为:"..event.y)
	Chat:sendSystemMsg("参数z为:"..event.z)
end
--注册监听器,Block is created时执行Block_Add函数
--第一个参数是监听的事件,第二个参数Block_Add即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Block.Add]=],Block_Add)
--写个函数,随便命名,当Block is destoryed时会执行此函数
local function Block_DestroyBy(event)
	Chat:sendSystemMsg("发生事件:Block is destoryed")
	Chat:sendSystemMsg("参数eventobjid(opt)为:"..event.eventobjid(opt))
	Chat:sendSystemMsg("参数blockid为:"..event.blockid)
	Chat:sendSystemMsg("参数x为:"..event.x)
	Chat:sendSystemMsg("参数y为:"..event.y)
	Chat:sendSystemMsg("参数z为:"..event.z)
end
--注册监听器,Block is destoryed时执行Block_DestroyBy函数
--第一个参数是监听的事件,第二个参数Block_DestroyBy即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Block.DestroyBy]=],Block_DestroyBy)
--写个函数,随便命名,当Start mining block时会执行此函数
local function Block_Dig_Begin(event)
	Chat:sendSystemMsg("发生事件:Start mining block")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数blockid为:"..event.blockid)
	Chat:sendSystemMsg("参数x为:"..event.x)
	Chat:sendSystemMsg("参数y为:"..event.y)
	Chat:sendSystemMsg("参数z为:"..event.z)
end
--注册监听器,Start mining block时执行Block_Dig_Begin函数
--第一个参数是监听的事件,第二个参数Block_Dig_Begin即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Block.Dig.Begin]=],Block_Dig_Begin)

# Item Event (Item)

Name Description Params
DropItem.AreaIn Drop item enters area {eventobjid, areaid, itemid(opt), itemnum(opt)}
DropItem.AreaOut Drop item leaves area {eventobjid, areaid, itemid(opt), itemnum(opt)}
Item.Disappear Item disappear {eventobjid, toobjid, itemid, itemnum}
Item.Pickup Item is picked up {eventobjid, toobjid, itemid, itemnum}
Missile.AreaIn Projectile enters area {eventobjid, areaid, itemid(opt), itemnum(opt)}
Missile.AreaOut Projectile leaves area {eventobjid, areaid, itemid(opt), itemnum(opt)}
Missile.Create Projectile is created {eventobjid, toobjid, itemid, x, y, z}1.2+
  • Item Event相关示例:
--写个函数,随便命名,当Drop item enters area时会执行此函数
local function DropItem_AreaIn(event)
	Chat:sendSystemMsg("发生事件:Drop item enters area")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数areaid为:"..event.areaid)
	Chat:sendSystemMsg("参数itemid(opt)为:"..event.itemid(opt))
	Chat:sendSystemMsg("参数itemnum(opt)为:"..event.itemnum(opt))
end
--注册监听器,Drop item enters area时执行DropItem_AreaIn函数
--第一个参数是监听的事件,第二个参数DropItem_AreaIn即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[DropItem.AreaIn]=],DropItem_AreaIn)
--写个函数,随便命名,当Drop item leaves area时会执行此函数
local function DropItem_AreaOut(event)
	Chat:sendSystemMsg("发生事件:Drop item leaves area")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数areaid为:"..event.areaid)
	Chat:sendSystemMsg("参数itemid(opt)为:"..event.itemid(opt))
	Chat:sendSystemMsg("参数itemnum(opt)为:"..event.itemnum(opt))
end
--注册监听器,Drop item leaves area时执行DropItem_AreaOut函数
--第一个参数是监听的事件,第二个参数DropItem_AreaOut即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[DropItem.AreaOut]=],DropItem_AreaOut)
--写个函数,随便命名,当Item disappear时会执行此函数
local function Item_Disappear(event)
	Chat:sendSystemMsg("发生事件:Item disappear")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数toobjid为:"..event.toobjid)
	Chat:sendSystemMsg("参数itemid为:"..event.itemid)
	Chat:sendSystemMsg("参数itemnum为:"..event.itemnum)
end
--注册监听器,Item disappear时执行Item_Disappear函数
--第一个参数是监听的事件,第二个参数Item_Disappear即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Item.Disappear]=],Item_Disappear)

# Particle Event (Particle)

Name Description Params
Particle.Mob.OnCreate Special effects have been created on any creatures {eventobjid, effectid}1.2+
Particle.Player.OnCreate Special effects have been created on any players {eventobjid, effectid}1.2+
Particle.Pos.OnCreate Special effects have been created on any location {x, y, z, effectid}1.2+
Particle.Projectile.OnCreate Special effects have been created for any projectile {eventobjid, effectid}1.2+
  • Particle Event相关示例:
--写个函数,随便命名,当Special effects have been created on any creatures时会执行此函数
local function Particle_Mob_OnCreate(event)
	Chat:sendSystemMsg("发生事件:Special effects have been created on any creatures")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数effectid为:"..event.effectid)
end
--注册监听器,Special effects have been created on any creatures时执行Particle_Mob_OnCreate函数
--第一个参数是监听的事件,第二个参数Particle_Mob_OnCreate即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Particle.Mob.OnCreate]=],Particle_Mob_OnCreate)
--写个函数,随便命名,当Special effects have been created on any players时会执行此函数
local function Particle_Player_OnCreate(event)
	Chat:sendSystemMsg("发生事件:Special effects have been created on any players")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数effectid为:"..event.effectid)
end
--注册监听器,Special effects have been created on any players时执行Particle_Player_OnCreate函数
--第一个参数是监听的事件,第二个参数Particle_Player_OnCreate即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Particle.Player.OnCreate]=],Particle_Player_OnCreate)
--写个函数,随便命名,当Special effects have been created on any location时会执行此函数
local function Particle_Pos_OnCreate(event)
	Chat:sendSystemMsg("发生事件:Special effects have been created on any location")
	Chat:sendSystemMsg("参数x为:"..event.x)
	Chat:sendSystemMsg("参数y为:"..event.y)
	Chat:sendSystemMsg("参数z为:"..event.z)
	Chat:sendSystemMsg("参数effectid为:"..event.effectid)
end
--注册监听器,Special effects have been created on any location时执行Particle_Pos_OnCreate函数
--第一个参数是监听的事件,第二个参数Particle_Pos_OnCreate即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Particle.Pos.OnCreate]=],Particle_Pos_OnCreate)
--写个函数,随便命名,当Special effects have been created for any projectile时会执行此函数
local function Particle_Projectile_OnCreate(event)
	Chat:sendSystemMsg("发生事件:Special effects have been created for any projectile")
	Chat:sendSystemMsg("参数eventobjid为:"..event.eventobjid)
	Chat:sendSystemMsg("参数effectid为:"..event.effectid)
end
--注册监听器,Special effects have been created for any projectile时执行Particle_Projectile_OnCreate函数
--第一个参数是监听的事件,第二个参数Particle_Projectile_OnCreate即事件发生时执行的函数
ScriptSupportEvent:registerEvent([=[Particle.Projectile.OnCreate]=],Particle_Projectile_OnCreate)
Last Update: 6/11/2020, 9:30:46 PM