MichaelCrow

DemoNPC

Apr 18th, 2012
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. npcid =
  2. questid =
  3.  
  4. function On_Gossip(pUnit, event, player)
  5.  pUnit:SendChatMessage(11, 0, "Would you like to spar?") -- NPC challenges you!
  6.  pUnit:GossipCreateMenu(100, player, 0)
  7.  pUnit:GossipMenuAddItem(0,"Sure, BRING IT!",1,0) -- OH HELL NAW
  8.  pUnit:GossipMenuAddItem(0,"OH, By the Light! Never!",2,0) -- fuck off, npc.
  9.  pUnit:GossipSendMenu(player)
  10.  end
  11.  
  12.  function FIGHTMODE (pUnit, event, player, id, intid, code)
  13.  if (intid == 1) then
  14.  player:StartQuest(questid)
  15.  pUnit:SetFaction(16) --OHSHI YOU DUNNIT NOW
  16.  pUnit:SendChatMessage(11,0,"CONSIDER IT BROUGHT!") -- ITS ON!
  17.  end
  18.  
  19.  if (intid == 2) then
  20.  player:GossipComplete() --coward's way out
  21.  end
  22.  
  23.  end
  24.  
  25.  function zzRespawn (pUnit, event, player)
  26. for k, v in pairs(Unit:GetPlayersInRange()) do
  27. if (v:GetDistance() <= 40) then -- players in 40 yards complete the quest
  28. player:MarkQuestObjectiveAsComplete(questid, 0)
  29.  pUnit:Despawn(500, 500) -- 500 delay for despawn, 500 for respawn
  30.  end
  31.  end
  32.  end
  33.  
  34.  RegisterUnitGossipEvent(npcid, 1, "On_Gossip")
  35.  RegisterUnitGossipEvent(npcid, 2, "FIGHTMODE")
  36.  RegisterUnitEvent(npcid, 4, "zzRespawn")
Advertisement
Add Comment
Please, Sign In to add comment