PDA

View Full Version : [LUA] Arena Fighting NPC



Avidgamer
12-03-10, 11:31 AM
It's just a script that teleports you to an arena, spawns a creature and allows you to fight it.
It can be used for quests, for PvP or whatever you think off.

Will be scripting NPC's for the fights shortly if anyone likes it.

I made this quickly, so their might be some errors and what not. Please report back with any errors you find and I'll do my best to fix them..

You'll need to edit a few bits, like the NPC ID, Teleport Coords etc.
-----------------
Download

Arena Fighting LUA (http://pastebin.com/72ivTVUx)


--[[
Custom Arena Fighting
Teleports to a set area and spawns a custom mob to fight.
]]

-- Variables
local NPC_ID = 2555

-- On Triggers
function ArenaFightingGossipOnTalk(Unit, Event, player)
Unit:GossipCreateMenu(100, player, 0)
Unit:GossipMenuAddItem(0, "I want to fight NPC_NAME (Level 80)", 1, 0)
Unit:GossipMenuAddItem(0, "I'd like to fight NPC_NAME! (Level 85)", 2, 0)
Unit:GossipMenuAddItem(0, "I'd like to attempt NPC_NAME! (Level 90)", 3, 0)
Unit:GossipMenuAddItem(0, "Please can I try NPC_NAME! (Level 95)", 4, 0)
Unit:GossipMenuAddItem(0, "Mabey next time.", 500, 0)
Unit:GossipSendMenu(player)
end

function ArenaFightingGossipOnSelect(Unit, Event, player, id, intid, code, pMisc)
if (intid == 1) then
player:SendBroadcastMessage("Your being teleported to the ring, get ready to fight!")
player:Teleport(ZoneID, X, Y, Z)
Unit:SpawnCreature(NPC_ID, X, Y, Z, O, Faction, Duration)
player:GossipComplete()
end
end

if (intid == 2) then
player:SendBroadcastMessage("Your being teleported to the ring, get ready to fight!")
player:Teleport(ZoneID, X, Y, Z)
Unit:SpawnCreature(NPC_ID, X, Y, Z, O, Faction, Duration)
player:GossipComplete()
end


if (intid == 3) then
player:SendBroadcastMessage("Your being teleported to the ring, get ready to fight!")
player:Teleport(ZoneID, X, Y, Z)
Unit:SpawnCreature(NPC_ID, X, Y, Z, O, Faction, Duration)
player:GossipComplete()
end


if (intid == 4) then
Unit:GossipCreateMenu(100, player, 0)
Unit:GossipMenuAddItem(0, "Mabey next time.", 500, 0)
Unit:GossipSendMenu(player)
end


RegisterUnitGossipEvent(2555, 1, "ArenaFightingGossipOnTalk")
RegisterUnitGossipEvent(2555, 2, "ArenaFightingGossipOnSelect")Please report errors in this thread.

Avidgamer
13-03-10, 10:51 AM
Update

Fixed a few errors.

Dr. Fallen
13-03-10, 11:22 AM
Thx for sharing mate, it seems good