Buggedout

AzerothCore HardcoreMode Lua FIXED

Aug 3rd, 2022
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.02 KB | None | 0 0
  1. --AzerothCore HardcoreMode script fixed and modified from https://github.com/HellionOP/Lua-HardcoreMode/blob/main/hardcoreMode.lua
  2. --Credit to Revision - tkn963  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. function OnFirstTalk(event, player, unit)
  22.     player:GossipMenuAddItem(0, "Looking for a challenge??? Click here to try hardcore mode!", 0, 1)
  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:GossipMenuAddItem(0, "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!!!", 0, 2)
  30.         player:GossipMenuAddItem(0, "NO TAKE ME BACK!", 0, 3)
  31.         player:GossipSendMenu(2, unit)
  32.     elseif (intid == 2) then
  33.         print('intid 2')
  34.         player:AddItem(hardCoreItem)
  35.     end
  36. end
  37.  
  38. --if player chooses to do hardcore they receive the token
  39. function OnHardCore(event, player, unit, sender, initid, code)
  40.     if (intid == 2) then
  41.         player:GiveItem(hardCoreItem)
  42.         print('triggered give')
  43.     --else gossip ends
  44.     else
  45.         player:GossipComplete()
  46.         print('triggered')
  47.     end
  48. end
  49.  
  50.  
  51. RegisterCreatureGossipEvent(hcNPC, 1 , OnFirstTalk)
  52. RegisterCreatureGossipEvent(hcNPC, 2, OnSelect)
  53. RegisterCreatureGossipEvent(hcNPC, 2, OnHardCore)
  54. RegisterPlayerEvent( 8, PlayerDeath)
Advertisement
Add Comment
Please, Sign In to add comment