Buggedout

AzerothCore Hardore Mode with popup confirm

Aug 3rd, 2022
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. --Modified and improved HardcoreMode for AzerothCore LUA based on https://github.com/HellionOP/Lua-HardcoreMode/blob/main/hardcoreMode.lua
  2. --Credit to FOE from  Azerothcore Discord
  3.  
  4. --Item that designates that character is a hardcore character.
  5. local hardCoreItem = 90000
  6. --NPC id
  7. local hcNPC = 90000
  8. --This is how long the character is locked for - default is 32 years.
  9. local banTimer = 999999999
  10.  
  11. --on death function - checks if player has token and bans character if it does.
  12. local function PlayerDeath(event, killer, killed)
  13.     if(killed:HasItem(hardCoreItem, 1)) then
  14.         print(killed:GetName() .. " was killed by " .. killer:GetName())
  15.         SendWorldMessage(killed:GetName() .. " was killed by " .. killer:GetName())
  16.         Ban(1, killed:GetName(), banTimer)
  17.     end
  18. end
  19.  
  20. --First Gossip Screen for NPC
  21. local function OnFirstTalk(event, player, unit)
  22.     player:GossipMenuAddItem(0, "Looking for a challenge??? Click here to try hardcore mode!", 0, 1, false, "Just making sure that you want to turn on hardcore mode?? This will lock the character after death and you will no longer be able to play the character!!!")
  23.     player:GossipSendMenu(1, unit)
  24. end
  25.  
  26. --Selection for NPC gossip
  27. local function OnSelect(event, player, unit, sender, intid, code)
  28.     if (intid == 1) then
  29.         player:AddItem(hardCoreItem, 1)
  30.     end
  31. end
  32.  
  33. RegisterCreatureGossipEvent(hcNPC, 1, OnFirstTalk)
  34. RegisterCreatureGossipEvent(hcNPC, 2, OnSelect)
  35. RegisterPlayerEvent(8, PlayerDeath)
Advertisement
Add Comment
Please, Sign In to add comment