diff --git a/AUndeadWarlord.lua b/AUndeadWarlord.lua index 668db3f..9501dc7 100644 --- a/AUndeadWarlord.lua +++ b/AUndeadWarlord.lua @@ -1,87 +1,95 @@ local UndeadWarlord = {}; local function CastShadowStrike(eventId, delay, calls, creature) - creature:CastSpell(creature:GetVictim(), 33914, true) +creature:CastSpell(creature:GetVictim(), 33914, true) end local function CastFear(eventId, delay, calls, creature) - creature:CastSpell(creature:GetVictim(), 5782, true) +creature:CastSpell(creature:GetVictim(), 5782, true) end local function CastSummonSkeleton(eventId, delay, calls, creature) - creature:CastSpell(creature, 59711, true) +creature:CastSpell(creature, 59711, true) end - local enterCombatDialogue = { - "Your end has come. I will feast on your bones.", - "You are no match for me!", - "Your death will be swift.", - "You dare challenge me?" +"Your life is forfeit to the Lich King!", +"The Scourge will devour your soul!", +"You dare challenge the might of the Scourge?", +"Your pitiful existence ends here!" } local leaveCombatDialogue = { - "Coward!", - "You won't escape next time!", - "I'll be back for more!", - "You are lucky to leave this place alive." +"Your cowardice prolongs the inevitable!", +"The Lich King's grasp reaches far, mortal!", +"We will meet again, and you will fall!", +"Your luck will run out soon enough." } local killTargetDialogue = { - "Another soul for the taking!", - "Your life is mine!", - "You were no match for me!", - "Your death was inevitable." +"Another soul for the taking!", +"Your life serves the Scourge now!", +"You never stood a chance against the Scourge!", +"Your death only strengthens our ranks." } local deathDialogue = { - "You... How?", - "I'll be back!", - "This is not the end!", - "I'll haunt your dreams!" +"You... How?", +"I'll be back!", +"This is not the end!", +"I'll haunt your dreams!" } function UndeadWarlord.OnEnterCombat(event, creature, target) - local randomDialogue = enterCombatDialogue[math.random(4)] - creature:SendUnitYell(randomDialogue, 0) - creature:RegisterEvent(CastShadowStrike, 5000, 0) - creature:RegisterEvent(CastFear, 7000, 0) - creature:RegisterEvent(CastSummonSkeleton, 15000, 0) +if math.random(100) <= 40 then +local randomDialogue = enterCombatDialogue[math.random(4)] +creature:SendUnitYell(randomDialogue, 0) +end +creature:RegisterEvent(CastShadowStrike, math.random(7000, 9000), 0) +creature:RegisterEvent(CastFear, math.random(9500, 13000), 0) +creature:RegisterEvent(CastSummonSkeleton, math.random(13500, 17000), 0) + end function UndeadWarlord.OnLeaveCombat(event, creature) - local randomDialogue = leaveCombatDialogue[math.random(4)] - creature:SendUnitYell(randomDialogue, 0) - creature:RemoveEvents() +if math.random(100) <= 40 then +local randomDialogue = leaveCombatDialogue[math.random(4)] +creature:SendUnitYell(randomDialogue, 0) +end +creature:RemoveEvents() end function UndeadWarlord.OnKilledTarget(event, creature, victim) - local randomDialogue = killTargetDialogue[math.random(4)] - creature:SendUnitYell(randomDialogue, 0) +local randomDialogue = killTargetDialogue[math.random(4)] +creature:SendUnitYell(randomDialogue, 0) end + function UndeadWarlord.OnDied(event, creature, killer) local randomDialogue = deathDialogue[math.random(4)] creature:SendUnitYell(randomDialogue, 0) + creature:CastSpell(creature, 100202, true) creature:RemoveEvents() end + function UndeadWarlord.OnSpawn(event, creature) - creature:SetMaxHealth(48420) - creature:CastSpell(creature:GetVictim(), 17683, true) - if creature == nil or not creature:IsInWorld() then return end - creature:SendUnitYell("Quickly servants! The Master expects swift results.", 0) - creature:CastSpell(creature, 59711, true) +creature:SetMaxHealth(48420) +creature:CastSpell(creature:GetVictim(), 17683, true) +if creature == nil or not creature:IsInWorld() then return end +creature:SendUnitYell("Quickly servants! The Master expects swift results.", 0) +creature:CastSpell(creature, 59711, true) creature:RegisterEvent(function (eventId, delay, calls, creature) - if creature == nil or not creature:IsInWorld() then return end - creature:CastSpell(creature, 59711, true) +if creature == nil or not creature:IsInWorld() then return end +creature:CastSpell(creature, 59711, true) end, 15000, 0) end - - RegisterCreatureEvent(300018, 1, UndeadWarlord.OnEnterCombat) RegisterCreatureEvent(300018, 2, UndeadWarlord.OnLeaveCombat) RegisterCreatureEvent(300018, 3, UndeadWarlord.OnKilledTarget) RegisterCreatureEvent(300018, 4, UndeadWarlord.OnDied) -RegisterCreatureEvent(300018, 5, UndeadWarlord.OnSpawn) \ No newline at end of file +RegisterCreatureEvent(300018, 5, UndeadWarlord.OnSpawn) + + + diff --git a/Barrier.lua b/Barrier.lua index 2818b91..3aa5415 100644 --- a/Barrier.lua +++ b/Barrier.lua @@ -11,7 +11,7 @@ player:SendBroadcastMessage("You need to place the barrier in a more strategic l spell:Cancel() else player:KilledMonsterCredit(killCreditNpcId) -player:SendBroadcastMessage("You have successfully placed the barrier and received kill credit for NPC " .. killCreditNpcId .. ".") +player:SendBroadcastMessage("You have successfully built a barrier!") end end end diff --git a/DarionTur.lua b/DarionTur.lua new file mode 100644 index 0000000..4fb33b3 --- /dev/null +++ b/DarionTur.lua @@ -0,0 +1,38 @@ +local CustomCreature = {} +local NPC_ID = 400081 +local MAX_HEALTH = 8432 -- Set the desired max health value + + +local ABILITY_1 = 16856 +local ABILITY_2 = 676 + +function CustomCreature.OnSpawn(event, creature) + creature:SetMaxHealth(MAX_HEALTH) + creature:SetHealth(MAX_HEALTH) +end + +function CustomCreature.OnCombat(event, creature, target) + creature:RegisterEvent(CustomCreature.Ability1, 7000, 0) + creature:RegisterEvent(CustomCreature.Ability2, 22000, 0) +end + +function CustomCreature.Ability1(event, delay, calls, creature) + creature:CastSpell(creature:GetVictim(), ABILITY_1, true) +end + +function CustomCreature.Ability2(event, delay, calls, creature) + creature:CastSpell(creature:GetVictim(), ABILITY_2, true) +end + +function CustomCreature.OnLeaveCombat(event, creature) + creature:RemoveEvents() +end + +function CustomCreature.OnDeath(event, creature, killer) + creature:RemoveEvents() +end + +RegisterCreatureEvent(NPC_ID, 5, CustomCreature.OnSpawn) +RegisterCreatureEvent(NPC_ID, 1, CustomCreature.OnCombat) +RegisterCreatureEvent(NPC_ID, 2, CustomCreature.OnLeaveCombat) +RegisterCreatureEvent(NPC_ID, 4, CustomCreature.OnDeath) diff --git a/DarionTur2.lua b/DarionTur2.lua new file mode 100644 index 0000000..357c8bd --- /dev/null +++ b/DarionTur2.lua @@ -0,0 +1,8 @@ +local NPC_ID_DAMION_TUR = 400079 +local SOUND_ID = 20436 + +local function OnDamionTurSpawn(event, creature) + creature:PlayDirectSound(SOUND_ID) +end + +RegisterCreatureEvent(NPC_ID_DAMION_TUR, 5, OnDamionTurSpawn) diff --git a/DespawnRespawnScourgeQuestGivers.lua b/DespawnRespawnScourgeQuestGivers.lua new file mode 100644 index 0000000..9cdca8d --- /dev/null +++ b/DespawnRespawnScourgeQuestGivers.lua @@ -0,0 +1,20 @@ +local GAME_EVENT_ID = 17 -- Set the game event ID +local npcIds = {344, 12480, 1284, 400064, 234} -- Add your NPC entries here + +local function DespawnAndRespawnNpcs(event, gameEventId) + if gameEventId == GAME_EVENT_ID then + local players = GetPlayersInWorld() -- Get all players in the world + for _, player in ipairs(players) do + for _, npcId in ipairs(npcIds) do + local npcs = player:GetCreaturesInRange(1000, npcId) -- Get creatures within a radius of 1000 units from the player + for _, npc in ipairs(npcs) do + npc:DespawnOrUnsummon() + npc:Respawn() + end + end + end + end +end + +RegisterServerEvent(34, DespawnAndRespawnNpcs) -- Game Event Start +RegisterServerEvent(35, DespawnAndRespawnNpcs) -- Game Event End diff --git a/LakeshireCitizenScript.lua b/LakeshireCitizenScript.lua index 741be40..f78f5b1 100644 --- a/LakeshireCitizenScript.lua +++ b/LakeshireCitizenScript.lua @@ -2,14 +2,19 @@ local NPC_ENTRY1 = 400080 local REQUIRED_QUEST_ID = 30011 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -52,14 +57,19 @@ RegisterCreatureEvent(NPC_ENTRY1, 3, OnDeath) local NPC_ENTRY2 = 400082 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -101,14 +111,19 @@ RegisterCreatureEvent(NPC_ENTRY2, 3, OnDeath) local NPC_ENTRY3 = 400083 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -150,14 +165,19 @@ RegisterCreatureEvent(NPC_ENTRY3, 3, OnDeath) local NPC_ENTRY4 = 400084 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -199,14 +219,19 @@ RegisterCreatureEvent(NPC_ENTRY4, 3, OnDeath) local NPC_ENTRY5 = 400085 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -248,14 +273,19 @@ RegisterCreatureEvent(NPC_ENTRY5, 3, OnDeath) local NPC_ENTRY6 = 400086 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -297,14 +327,19 @@ RegisterCreatureEvent(NPC_ENTRY6, 3, OnDeath) local NPC_ENTRY7 = 400087 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -346,14 +381,19 @@ RegisterCreatureEvent(NPC_ENTRY7, 3, OnDeath) local NPC_ENTRY8 = 400088 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -395,14 +435,19 @@ RegisterCreatureEvent(NPC_ENTRY8, 3, OnDeath) local NPC_ENTRY9 = 400089 local function OnGossipHello(event, player, creature) -if not player:HasQuest(REQUIRED_QUEST_ID) then -player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") -return -end -player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) -player:GossipSendMenu(1, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) end + local function OnGossipSelect(event, player, creature, sender, intid, code) if (intid == 1) then creature:MoveWaypoint() @@ -437,4 +482,78 @@ end RegisterCreatureGossipEvent(NPC_ENTRY9, 1, OnGossipHello) RegisterCreatureGossipEvent(NPC_ENTRY9, 2, OnGossipSelect) RegisterCreatureEvent(NPC_ENTRY9, 5, OnSpawn) -RegisterCreatureEvent(NPC_ENTRY9, 3, OnDeath) \ No newline at end of file +RegisterCreatureEvent(NPC_ENTRY9, 3, OnDeath) + +local NPC_ENTRY10 = 849 + +local function OnGossipHello(event, player, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) +end + +local function OnGossipSelect(event, player, creature, sender, intid, code) + if (intid == 1) then + player:GossipComplete() + player:KilledMonsterCredit(NPC_ENTRY1) + local random = math.random(0, 4) + if random == 0 then + creature:SendUnitSay("Mommmmy!!!!", 0) + elseif random == 1 then + creature:SendUnitSay("But I wanted to go play with Sally...", 0) + elseif random == 2 then + creature:SendUnitSay("Really? Stay indoors? How boring...", 0) + elseif random == 3 then + creature:SendUnitSay("Darn those yucky Scourge...", 0) + else + creature:SendUnitSay("Awww, no fun!", 0) + end + creature:DespawnOrUnsummon(1000) -- Despawn after 2 seconds (2000 milliseconds) + end +end + +RegisterCreatureGossipEvent(NPC_ENTRY10, 1, OnGossipHello) +RegisterCreatureGossipEvent(NPC_ENTRY10, 2, OnGossipSelect) + + +local NPC_ENTRY11 = 848 + +local function OnGossipHello(event, player, creature) + if not player:HasQuest(REQUIRED_QUEST_ID) then + if player:HasQuestFailed(REQUIRED_QUEST_ID) then + player:SendBroadcastMessage("Your time ran out, and you have failed this quest...") + else + player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") + end + return + end + player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1) + player:GossipSendMenu(1, creature) +end + + +local function OnGossipSelect(event, player, creature, sender, intid, code) + if (intid == 1) then + player:GossipComplete() + player:KilledMonsterCredit(NPC_ENTRY1) + local random = math.random(0, 4) + if random == 0 then + creature:SendUnitSay("Mommmmy!!!!", 0) + elseif random == 1 then + creature:SendUnitSay("But I wanted to go play with Sally...", 0) + elseif random == 2 then + creature:SendUnitSay("Really? Stay indoors? How boring...", 0) + elseif random == 3 then + creature:SendUnitSay("Darn those yucky Scourge...", 0) + else + creature:SendUnitSay("Awww, no fun!", 0) + end + creature:DespawnOrUnsummon(1000) -- Despawn after 2 seconds (2000 milliseconds) + end +end + +RegisterCreatureGossipEvent(NPC_ENTRY11, 1, OnGossipHello) +RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect) diff --git a/LakeshireLoremaster1.lua b/LakeshireLoremaster1.lua new file mode 100644 index 0000000..6c25e0e --- /dev/null +++ b/LakeshireLoremaster1.lua @@ -0,0 +1,30 @@ +-- Creature ID for the creature that gives the quests +local CREATURE_ID = 400096 + +-- Quest and sound IDs for the quests that should trigger the sounds +local QUEST_ACCEPT = { + [30015] = 20439, + [30016] = 20441 +} + +local QUEST_COMPLETE = { + [30014] = 20438, + [30015] = 20440, + [30016] = 20442 +} + +-- Register the event for quest accept +RegisterCreatureEvent(CREATURE_ID, 31, function(event, player, creature, quest) + local soundID = QUEST_ACCEPT[quest:GetId()] + if soundID then + player:PlayDistanceSound(soundID) + end +end) + +-- Register the event for quest reward +RegisterCreatureEvent(CREATURE_ID, 34, function(event, player, creature, quest) + local soundID = QUEST_COMPLETE[quest:GetId()] + if soundID then + creature:PlayDistanceSound(soundID) + end +end)