学着写LUA脚本(一)

local npcid = 1 --这里改成你想要的NPC id

function WarpNPC_OnGossipTalk(pUnit, event, player, pMisc) --初始菜单
pUnit:GossipCreateMenu(100, player, 0) --创建一个菜单
pUnit:GossipMenuAddItem(5, "Buff Menu", 9,0) --Buff子菜单
pUnit:GossipMenuAddItem(5, "传送菜单", 10,0) --传送子菜单
pUnit:GossipSendMenu(player) --菜单传送给玩家(显示菜单)
end

function Help_OnGossip_select(pUnit, event, player, id, intid, code)
if (intid == 10) then --选择了传送子菜单
pUnit:GossipCreateMenu(100, player, 0) --创建一个菜单
pUnit:GossipMenuAddItem(player, 5, "Shattrath", 24, 0) --沙塔斯
pUnit:GossipMenuAddItem(player, 0, "Horde cities部落主城", 12, 0) --部落主城
pUnit:GossipMenuAddItem(player, 0, "Alliance cities联盟主城", 13, 0) --联盟主城
pUnit:GossipSendMenu(player) --显示菜单
end

if(intid == 12) then
pUnit:GossipCreateMenu(100, player)
pUnit:GossipMenuAddItem(player, 5, "Orgrimmar", 16, 0) --奥格瑞玛
pUnit:GossipMenuAddItem(player, 5, "Undercity", 17, 0) --幽暗城
pUnit:GossipMenuAddItem(player, 5, "Thunder Bluff", 18, 0) --雷霆崖
pUnit:GossipMenuAddItem(player, 5, "Silvermoon City", 19, 0) --银月城
pUnit:GossipSendMenu(player) --显示菜单
end

if(intid == 13) then
pUnit:GossipCreateMenu(100, player)
pUnit:GossipMenuAddItem(player, 5, "Stormwind", 20, 0) --暴风城
pUnit:GossipMenuAddItem(player, 5, "Ironforge", 21, 0) --铁炉堡
pUnit:GossipMenuAddItem(player, 5, "Darnassus", 22, 0) --达纳苏斯
pUnit:GossipMenuAddItem(player, 5, "The Exodar", 23, 0) --埃索达
pUnit:GossipSendMenu(player)
end

if(intid == 24) then
player:Teleport(530, -1887.510010, 5359.379883, -12.427300) --沙塔斯坐标
end

if(intid == 16) then
player:Teleport(1, 1371.068970, -4370.801758, 26.052483) --奥格瑞玛坐标
end

if(intid == 17) then
player:Teleport(0, 2050.203125, 285.650604, 56.994549) --幽暗城坐标
end

if(intid == 18) then
player:Teleport(1, -1304.569946, 205.285004, 68.681396) --雷霆崖坐标
end

if(intid == 19) then
player:Teleport(530, 9400.486328, -7278.376953, 14.206780) --银月城坐标
end

if(intid == 20) then
player:Teleport(0, -9100.480469, 406.950745, 92.594185) --暴风城坐标
end

if(intid == 21) then
player:Teleport(0, -5028.265137, -825.976563, 495.301575) --铁炉堡坐标
end

if(intid == 22) then
player:Teleport(1, 9985.907227, 1971.155640, 1326.815674) --达纳苏斯坐标
end

if(intid == 23) then
player:Teleport(530, -4072.202393, -12014.337891, -1.277277) --埃索达坐标
end

if (intid == 9) then
pUnit:GossipCreateMenu(100, player, 0) --创建菜单
pUnit:GossipMenuAddItem(5, "Buffs", 1, 0) --buff
pUnit:GossipMenuAddItem(9, "Remove Resurrection Sickness", 2, 0)--去除虚弱复活
pUnit:GossipSendMenu(player) --显示菜单
end

function WarpNPC_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
if (intid == 1) then
pUnit:GossipCreateMenu(99, player, 0) --创建菜单
pUnit:GossipMenuAddItem(3, "Agility敏捷", 3, 0) --敏捷
pUnit:GossipMenuAddItem(3, "Intellect智力", 4, 0) --智力
pUnit:GossipMenuAddItem(3, "quotrotection护甲", 5, 0) --护甲
pUnit:GossipMenuAddItem(3, "Spirit精神", 6, 0) --精神
pUnit:GossipMenuAddItem(3, "Stamina耐力", 7, 0) --耐力
pUnit:GossipMenuAddItem(3, "Strength力量", 8, 0) --力量
pUnit:GossipSendMenu(player) --显示菜单
end

if (intid == 2) then --移除虚弱复活
pUnit:CastSpellOnTarget(15007) 
player:UnlearnSpell(15007)
unit:SendChatMessage(12, 0, "You have been cleansed of Resurrection Sickness!")
pUnit:GossipComplete(player)
end

if (intid == 3) then --敏捷buff
pUnit:CastSpellOnTarget(33077, player)
unit:SendChatMessage(12, 0, "You have been granted the speed of a cat!")
pUnit:GossipComplete(player)
end

if (intid == 4) then --智力buff
pUnit:CastSpellOnTarget(33078, player)
unit:SendChatMessage(12, 0, "You have been granted the gift of Intelligence!")
pUnit:GossipComplete(player)
end

if (intid == 5) then --护甲buff
pUnit:CastSpellOnTarget(33079, player)
unit:SendChatMessage(12, 0, "You have been granted Protection!")
pUnit:GossipComplete(player)
end

if (intid == 6) then --精神buff
pUnit:CastSpellOnTarget(33080, player)
unit:SendChatMessage(12, 0, "You have been granted the gift of great Spirit!")
pUnit:GossipComplete(player)
end

if (intid == 7) then --耐力buff
pUnit:CastSpellOnTarget(33081, player)
unit:SendChatMessage(12, 0, "You have been granted the Stamina of a bear!")
pUnit:GossipComplete(player)
end

if (intid == 8) then
pUnit:CastSpellOnTarget(33082, player) --力量buff
unit:SendChatMessage(12, 0, "You have been granted the Strength of a tiger!")
pUnit:GossipComplete(player)
end


intid = 0
end

RegisterUnitGossipEvent(55556, 1, "WarpNPC_OnGossipTalk") --注册函数
RegisterUnitGossipEvent(55556, 2, "WarpNPC_OnGossipSelect")
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值