重叠事件的LUA貌似没有写过,战斗类活动最常用,给大家一个简单的例子。
--NPC重叠事件函数(NPC索引, 玩家索引)
function Overlap(meindex, toindex)
--创建战斗接口(接触索引,被接触索引, 战斗怪物数组)
battleindex = battle.CreateVsEnemy(toindex, meindex, enemytable)
end
--创建NPC函数
function Create(name, metamo, floorid, x, y, dir)
index = npc.CreateNpc(name, metamo, floorid, x, y, dir)
if char.check(index) == 1 then
--让NPC拥有重叠事件。
char.setFunctionPointer(index, "重叠事件", "Overlap", "")
end
end
function data()
--这里定义下怪物数组(数组内有10个怪物ID可以设定,-1表示不出现)
enemytable = {1610, 1609, 1611, 1612, -1, -1, -1, -1, -1, -1}
end
function main()
data()
Create("神奇石器", 100000, 2000, 50, 50, 6)
end
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。