mirror of
https://github.com/araxiaonline/RandomScriptsforAzerothCore.git
synced 2026-06-13 02:22:19 -04:00
Add files via upload
This commit is contained in:
@@ -18,7 +18,7 @@ creature:RemoveEvents()
|
||||
end
|
||||
|
||||
function BlisteringZombie.OnDeath(event, creature, killer)
|
||||
creature:DespawnOrUnsummon(5000)
|
||||
creature:DespawnOrUnsummon(10000)
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
|
||||
14
Dumbassery.lua
Normal file
14
Dumbassery.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
--I was being dumb. Don't ask.
|
||||
|
||||
local CREATURE_ID = 1069
|
||||
local ITEM_ID = 65006
|
||||
local ITEM_COUNT = 1
|
||||
local REQUIRED_QUEST_ID = 30015
|
||||
|
||||
local function OnCreatureKill(event, player, creature)
|
||||
if creature:GetEntry() == CREATURE_ID and player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
player:AddItem(ITEM_ID, ITEM_COUNT)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(7, OnCreatureKill)
|
||||
@@ -2,14 +2,16 @@ local NPC_ENTRY1 = 400080
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -55,16 +57,19 @@ RegisterCreatureEvent(NPC_ENTRY1, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY2 = 400082
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -109,21 +114,23 @@ RegisterCreatureEvent(NPC_ENTRY2, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY3 = 400083
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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()
|
||||
@@ -163,16 +170,19 @@ RegisterCreatureEvent(NPC_ENTRY3, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY4 = 400084
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -217,16 +227,19 @@ RegisterCreatureEvent(NPC_ENTRY4, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY5 = 400085
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -271,16 +284,19 @@ RegisterCreatureEvent(NPC_ENTRY5, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY6 = 400086
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -325,16 +341,19 @@ RegisterCreatureEvent(NPC_ENTRY6, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY7 = 400087
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -379,16 +398,19 @@ RegisterCreatureEvent(NPC_ENTRY7, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY8 = 400088
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -433,16 +455,19 @@ RegisterCreatureEvent(NPC_ENTRY8, 3, OnDeath)
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
local NPC_ENTRY9 = 400089
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -485,12 +510,19 @@ RegisterCreatureEvent(NPC_ENTRY9, 5, OnSpawn)
|
||||
RegisterCreatureEvent(NPC_ENTRY9, 3, OnDeath)
|
||||
|
||||
local NPC_ENTRY10 = 849
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
player:SendBroadcastMessage("You must be on a certain quest to interact with this person.")
|
||||
if questStatus == 4 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
|
||||
@@ -520,16 +552,19 @@ RegisterCreatureGossipEvent(NPC_ENTRY10, 2, OnGossipSelect)
|
||||
|
||||
|
||||
local NPC_ENTRY11 = 848
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
if player:HasQuestFailed(REQUIRED_QUEST_ID) then
|
||||
if questStatus == 4 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
|
||||
@@ -557,3 +592,73 @@ end
|
||||
|
||||
RegisterCreatureGossipEvent(NPC_ENTRY11, 1, OnGossipHello)
|
||||
RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
|
||||
|
||||
------------------
|
||||
|
||||
local NPC_ENTRY11 = 381
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
local GAME_EVENT_ID = 17
|
||||
|
||||
local function ShowGossipMenu(player, creature)
|
||||
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
|
||||
player:GossipSendMenu(1, creature)
|
||||
end
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
if IsGameEventActive(GAME_EVENT_ID) then
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if questStatus == 4 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
|
||||
|
||||
ShowGossipMenu(player, creature)
|
||||
end
|
||||
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 1 second (1000 milliseconds)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnGameEventStart(event, gameEventId)
|
||||
if gameEventId == GAME_EVENT_ID then
|
||||
local creatures = GetWorld():GetCreaturesByEntry(NPC_ENTRY11)
|
||||
for _, creature in ipairs(creatures) do
|
||||
creature:SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function OnGameEventStop(event, gameEventId)
|
||||
if gameEventId == GAME_EVENT_ID then
|
||||
local creatures = GetWorld():GetCreaturesByEntry(NPC_ENTRY11)
|
||||
for _, creature in ipairs(creatures) do
|
||||
creature:RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCreatureGossipEvent(NPC_ENTRY11, 1, OnGossipHello)
|
||||
RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
|
||||
RegisterServerEvent(34, OnGameEventStart)
|
||||
RegisterServerEvent(35, OnGameEventStop)
|
||||
|
||||
@@ -4,13 +4,15 @@ local CREATURE_ID = 400096
|
||||
-- Quest and sound IDs for the quests that should trigger the sounds
|
||||
local QUEST_ACCEPT = {
|
||||
[30015] = 20439,
|
||||
[30016] = 20441
|
||||
[30016] = 20441,
|
||||
[30017] = 20443
|
||||
}
|
||||
|
||||
local QUEST_COMPLETE = {
|
||||
[30014] = 20438,
|
||||
[30015] = 20440,
|
||||
[30016] = 20442
|
||||
[30016] = 20442,
|
||||
[30017] = 20444
|
||||
}
|
||||
|
||||
-- Register the event for quest accept
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
--XP = (Char Level * 5) + 580, where Char Level = Mob Level, for mobs in Northrend
|
||||
--XP = (Char Level * 5) + 1878, where Char Level = Mob Level, for mobs in Cataclysm
|
||||
|
||||
local ENABLED = true --change to true or false depending on whether or not you want the script enabled.
|
||||
local ENABLED = false --change to true or false depending on whether or not you want the script enabled.
|
||||
local XP_MODIFIER = 0.05 --change me to be whatever you want
|
||||
local BASE_XP = 15
|
||||
|
||||
|
||||
65
RandomScourgeAttack.lua
Normal file
65
RandomScourgeAttack.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local GAME_EVENT_ID = 17 -- Set the game event ID
|
||||
local MAX_NPC_SPAWN = 3 -- Set the maximum number of NPCs to spawn simultaneously. Extremely high numbers will hurt performance
|
||||
local ATTACK_CHANCE = 15 -- Set the likelihood of an attack here, in percent
|
||||
local DAZE_SPELL_ID = 100201 -- Set the spell ID for daze
|
||||
|
||||
local creatureEntries = {
|
||||
16423,
|
||||
16422,
|
||||
400011
|
||||
} -- Add NPC entries above (CHANGE THESE OR IT WON'T WORK! I'M USING CUSTOM IDs)
|
||||
|
||||
local npcdialogue = {
|
||||
"Grrrr...",
|
||||
"Rrrrr...",
|
||||
"Grraaargh...",
|
||||
"Raaargh...",
|
||||
"Hssss..."
|
||||
} -- Add dialogue above
|
||||
|
||||
local function IsGameEventActive(eventId)
|
||||
local activeEvents = GetActiveGameEvents()
|
||||
for _, event in ipairs(activeEvents) do
|
||||
if event == eventId then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function SpawnAttacker(event, player)
|
||||
if IsGameEventActive(GAME_EVENT_ID) then
|
||||
local chance = math.random(100)
|
||||
|
||||
if chance <= ATTACK_CHANCE then
|
||||
local mapId = player:GetMapId()
|
||||
local x, y, z, o = player:GetLocation()
|
||||
local level = player:GetLevel()
|
||||
local health = player:GetHealth() * 1.65
|
||||
local npcCount = math.random(1, MAX_NPC_SPAWN)
|
||||
|
||||
-- Check if the player is mounted and not flying
|
||||
if player:IsMounted() and not player:IsFlying() then
|
||||
player:Dismount()
|
||||
player:CastSpell(player, DAZE_SPELL_ID, true)
|
||||
player:SendBroadcastMessage("You have been knocked off your mount!")
|
||||
end
|
||||
|
||||
for i = 1, npcCount do
|
||||
local selectedCreature = creatureEntries[math.random(#creatureEntries)]
|
||||
local randomX = x + math.random(-18, 18)
|
||||
local randomY = y + math.random(-18, 18)
|
||||
local spawnedCreature = player:SpawnCreature(selectedCreature, randomX, randomY, z, o, 7, 130000)
|
||||
spawnedCreature:SetLevel(level)
|
||||
spawnedCreature:SetMaxHealth(health)
|
||||
spawnedCreature:SetHealth(health)
|
||||
spawnedCreature:AttackStart(player)
|
||||
|
||||
local selectedDialogue = npcdialogue[math.random(#npcdialogue)]
|
||||
spawnedCreature:SendUnitYell(selectedDialogue, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(27, SpawnAttacker)
|
||||
61
RedridgeEmote.lua
Normal file
61
RedridgeEmote.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
local GAME_EVENT_ID = 17 -- Set the game event ID
|
||||
local npcIds = {777, 790, 415, 956, 3356, 341, 793, 343, 342, 812, 1671, 10037, 859, 382, 1070, 931, 932, 903, 935, 68, 12480, 12481} -- Add your NPC entries here
|
||||
local secondNpcIds = {3088} -- Add your second set of NPC entries here
|
||||
local EMOTE_ID = 333 -- Set the emote ID
|
||||
local SECOND_EMOTE_ID = 214 -- Set the second emote ID
|
||||
|
||||
local function IsGameEventActive(eventId)
|
||||
local activeEvents = GetActiveGameEvents()
|
||||
for _, event in ipairs(activeEvents) do
|
||||
if event == eventId then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function ApplyEmoteToNpcs(players, npcIds, emoteId)
|
||||
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
|
||||
|
||||
for _, npc in ipairs(npcs) do
|
||||
npc:EmoteState(emoteId)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function SetNpcsEmoteState(event, gameEventId)
|
||||
if gameEventId == GAME_EVENT_ID then
|
||||
local players = GetPlayersInWorld() -- Get all players in the world
|
||||
ApplyEmoteToNpcs(players, npcIds, EMOTE_ID)
|
||||
ApplyEmoteToNpcs(players, secondNpcIds, SECOND_EMOTE_ID)
|
||||
end
|
||||
end
|
||||
|
||||
local function ResetNpcsEmoteState(event, gameEventId)
|
||||
if gameEventId == GAME_EVENT_ID then
|
||||
local players = GetPlayersInWorld() -- Get all players in the world
|
||||
ApplyEmoteToNpcs(players, npcIds, 0) -- Reset emote state for the first set of NPCs
|
||||
ApplyEmoteToNpcs(players, secondNpcIds, 0) -- Reset emote state for the second set of NPCs
|
||||
end
|
||||
end
|
||||
|
||||
local PLAYER_EVENT_ON_MAP_CHANGE = 27
|
||||
|
||||
local function OnPlayerMapChange(event, player, newMap, newZone)
|
||||
if IsGameEventActive(GAME_EVENT_ID) then
|
||||
ApplyEmoteToNpcs({player}, npcIds, EMOTE_ID)
|
||||
ApplyEmoteToNpcs({player}, secondNpcIds, SECOND_EMOTE_ID)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(PLAYER_EVENT_ON_MAP_CHANGE, OnPlayerMapChange)
|
||||
|
||||
-- The rest of the script remains the same
|
||||
|
||||
|
||||
|
||||
RegisterServerEvent(34, SetNpcsEmoteState)
|
||||
RegisterServerEvent(35, ResetNpcsEmoteState)
|
||||
74
RedridgeRetreat.lua
Normal file
74
RedridgeRetreat.lua
Normal file
@@ -0,0 +1,74 @@
|
||||
local GAME_EVENT_ID = 17 -- Set the game event ID
|
||||
local npcIds = {3085, 841, 348, 8965, 1678, 8962, 8963, 5608, 5607, 847, 791, 381, 3361, 789, 5620, 3089, 9982, 6727, 6166, 379, 346, 1680} -- Add your NPC entries here
|
||||
local targetLocations = {
|
||||
{x = -9195.19, y = -2157.19, z = 57.186},
|
||||
{x = -9201.69, y = -2147.54, z = 71.211},
|
||||
{x = -9231.74, y = -2148.622, z = 71.211}
|
||||
} -- Set the target locations
|
||||
|
||||
local function IsGameEventActive(eventId)
|
||||
local activeEvents = GetActiveGameEvents()
|
||||
for _, event in ipairs(activeEvents) do
|
||||
if event == eventId then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function MoveNpcsToLocation(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
|
||||
local targetLocation = targetLocations[math.random(#targetLocations)] -- Choose a random target location
|
||||
local randomX = targetLocation.x + math.random(-2, 2)
|
||||
local randomY = targetLocation.y + math.random(-2, 2)
|
||||
npc:MoveTo(0, randomX, randomY, targetLocation.z, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function DespawnNpcs(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()
|
||||
npc:MoveWaypoint()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local PLAYER_EVENT_ON_MAP_CHANGE = 27
|
||||
|
||||
local function MoveNpcsToLocationForPlayer(player)
|
||||
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
|
||||
local targetLocation = targetLocations[math.random(#targetLocations)] -- Choose a random target location
|
||||
local randomX = targetLocation.x + math.random(-2, 2)
|
||||
local randomY = targetLocation.y + math.random(-2, 2)
|
||||
npc:MoveTo(0, randomX, randomY, targetLocation.z, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function OnPlayerMapChange(event, player, newMap, newZone)
|
||||
if IsGameEventActive(GAME_EVENT_ID) then
|
||||
MoveNpcsToLocationForPlayer(player)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(PLAYER_EVENT_ON_MAP_CHANGE, OnPlayerMapChange)
|
||||
RegisterServerEvent(34, MoveNpcsToLocation)
|
||||
RegisterServerEvent(35, DespawnNpcs)
|
||||
59
Riddle.lua
Normal file
59
Riddle.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
local QUEST_ID = 30017
|
||||
local GOSSIP_ITEM_REQUEST = "Lorekeeper Talandria sent me, she needs the Crusader's Tome to cleanse the skull of an undead warlord."
|
||||
local GOSSIP_ITEM_RIDDLE = "Alive without breath, as cold as death. Endlessly roaming, the skies I'm combing. What am I?"
|
||||
local GOSSIP_ITEM_ANSWER1 = "Is it a Death Knight?"
|
||||
local GOSSIP_ITEM_ANSWER2 = "Is it a Frost Wyrm?"
|
||||
local GOSSIP_ITEM_ANSWER3 = "Is it a Banshee?"
|
||||
|
||||
local NPC_ID = 400098
|
||||
local ITEM_ID = 65007
|
||||
local SPELL_ID = 29522
|
||||
|
||||
local function OnGossipSelect(event, player, creature, sender, intid, code)
|
||||
if (intid == 1) then
|
||||
player:GossipClearMenu()
|
||||
player:GossipMenuAddItem(0, GOSSIP_ITEM_RIDDLE, 1, 2)
|
||||
player:GossipSendMenu(1, creature)
|
||||
creature:SendUnitSay("She did, did she? Very well then. Answer me this riddle correctly and I will give you the tome.", 0)
|
||||
creature:PlayDistanceSound(20445)
|
||||
elseif (intid == 2) then
|
||||
player:GossipClearMenu()
|
||||
player:GossipMenuAddItem(0, GOSSIP_ITEM_ANSWER1, 1, 3)
|
||||
player:GossipMenuAddItem(0, GOSSIP_ITEM_ANSWER2, 1, 4)
|
||||
player:GossipMenuAddItem(0, GOSSIP_ITEM_ANSWER3, 1, 5)
|
||||
player:GossipSendMenu(1, creature)
|
||||
elseif (intid == 3) then
|
||||
creature:SetFaction(85)
|
||||
creature:CastSpell(player, SPELL_ID, true)
|
||||
creature:SendUnitYell("Incorrect!", 0)
|
||||
creature:PlayDistanceSound(20447)
|
||||
creature:DespawnOrUnsummon(5000)
|
||||
player:GossipComplete()
|
||||
elseif (intid == 4) then
|
||||
player:AddItem(ITEM_ID, 1)
|
||||
creature:SendUnitSay("You are correct! Here is your tome.", 0)
|
||||
creature:PlayDistanceSound(20448)
|
||||
creature:DespawnOrUnsummon(5000)
|
||||
player:GossipComplete()
|
||||
elseif (intid == 5) then
|
||||
creature:SetFaction(85)
|
||||
creature:CastSpell(player, SPELL_ID, true)
|
||||
creature:SendUnitYell("Incorrect!", 0)
|
||||
creature:PlayDistanceSound(20447)
|
||||
creature:DespawnOrUnsummon(5000)
|
||||
player:GossipComplete()
|
||||
end
|
||||
end
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
if player:HasQuest(QUEST_ID) then
|
||||
player:GossipClearMenu()
|
||||
player:GossipMenuAddItem(0, GOSSIP_ITEM_REQUEST, 1, 1)
|
||||
player:GossipSendMenu(1, creature)
|
||||
else
|
||||
player:SendBroadcastMessage("This man seems to be unresponsive.")
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCreatureGossipEvent(NPC_ID, 1, OnGossipHello)
|
||||
RegisterCreatureGossipEvent(NPC_ID, 2, OnGossipSelect)
|
||||
@@ -3,49 +3,53 @@ local LOG_ITEM_ID = 60116
|
||||
local BARRIERS_BUILT_QUEST_ID = 30012
|
||||
|
||||
function OnCreatureSpawn(event, creature)
|
||||
creature:SetReactState(0)
|
||||
creature:SetReactState(0)
|
||||
end
|
||||
|
||||
function OnGossipHello(event, player, creature)
|
||||
if player:IsMounted() then
|
||||
player:SendBroadcastMessage("You must dismount first!")
|
||||
return
|
||||
end
|
||||
if player:IsMounted() then
|
||||
player:SendBroadcastMessage("You must dismount first!")
|
||||
return
|
||||
end
|
||||
|
||||
if not player:HasItem(1311) then
|
||||
player:SendBroadcastMessage("You need the Wood Cutter Axe in order to chop down this tree.")
|
||||
return
|
||||
end
|
||||
if not player:HasItem(1311) then
|
||||
player:SendBroadcastMessage("You need the Wood Cutter Axe in order to chop down this tree!")
|
||||
return
|
||||
end
|
||||
|
||||
if not player:HasQuest(BARRIERS_BUILT_QUEST_ID) then
|
||||
player:SendBroadcastMessage("You must have the 'Barriers Built' quest before you can chop down this tree.")
|
||||
return
|
||||
end
|
||||
if not player:HasQuest(BARRIERS_BUILT_QUEST_ID) then
|
||||
player:SendBroadcastMessage("You must have the 'Final Fortification' quest before you can chop down this tree!")
|
||||
return
|
||||
end
|
||||
|
||||
creature:SetReactState(0)
|
||||
player:GossipMenuAddItem(8, "Cut down this tree", 1, GOSSIP_OPTION_CUT_TREE)
|
||||
player:GossipSendMenu(8, creature)
|
||||
if player:HasItem(LOG_ITEM_ID, 20) then
|
||||
player:SendBroadcastMessage("You have the maximum amount of logs already!")
|
||||
return
|
||||
end
|
||||
|
||||
creature:SetReactState(0)
|
||||
player:GossipMenuAddItem(8, "Cut down this tree", 1, GOSSIP_OPTION_CUT_TREE)
|
||||
player:GossipSendMenu(8, creature)
|
||||
end
|
||||
|
||||
function OnGossipSelect(event, player, creature, sender, intid)
|
||||
if intid == GOSSIP_OPTION_CUT_TREE then
|
||||
player:CastSpell(creature, 62990, false)
|
||||
player:Kill(creature)
|
||||
player:KilledMonsterCredit(400091)
|
||||
player:GossipComplete()
|
||||
end
|
||||
if intid == GOSSIP_OPTION_CUT_TREE then
|
||||
player:CastSpell(creature, 62990, false)
|
||||
player:Kill(creature)
|
||||
player:KilledMonsterCredit(400091)
|
||||
player:GossipComplete()
|
||||
end
|
||||
end
|
||||
|
||||
function OnCreatureDeath(event, creature, killer)
|
||||
creature:DespawnOrUnsummon(12000)
|
||||
creature:RemoveEvents()
|
||||
creature:DespawnOrUnsummon(12000)
|
||||
creature:RemoveEvents()
|
||||
|
||||
-- Give the player 1-3 logs upon death
|
||||
if killer ~= nil and killer:IsPlayer() then
|
||||
local logs = math.random(1, 3)
|
||||
killer:AddItem(LOG_ITEM_ID, logs)
|
||||
end
|
||||
-- Give the player 1-3 logs upon death
|
||||
if killer ~= nil and killer:IsPlayer() then
|
||||
local logs = math.random(1, 3)
|
||||
killer:AddItem(LOG_ITEM_ID, logs)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(400091, 5, OnCreatureSpawn)
|
||||
|
||||
46
quest_30018_spawn_bunnies.lua
Normal file
46
quest_30018_spawn_bunnies.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local CREATURE_EVENT_ON_QUEST_ACCEPT = 31
|
||||
local QUEST_ID = 30018
|
||||
local CREATURE_SPAWNER = 400096
|
||||
local BUNNY_ENTRY = 400099
|
||||
local UNDEAD_BUNNY_ENTRY = 400100
|
||||
local UNDEAD_WARLORD = 400101
|
||||
local SPAWN_TYPE = 3
|
||||
local DESPAWN_TIMER = 600000 -- 10 minutes in milliseconds
|
||||
local CAST_SPELL_ID = 37679
|
||||
|
||||
local function DespawnCreatures(spawner)
|
||||
local spawnedCreatures = spawner:GetCreaturesInRange(100, {BUNNY_ENTRY, UNDEAD_BUNNY_ENTRY})
|
||||
for _, spawnedCreature in ipairs(spawnedCreatures) do
|
||||
spawnedCreature:DespawnOrUnsummon(100) -- Despawn with a 100 ms delay
|
||||
end
|
||||
end
|
||||
|
||||
local function OnQuestAccept(event, player, creature, quest)
|
||||
if quest:GetId() == QUEST_ID then
|
||||
creature:SetReactState(0) -- Set react state to passive
|
||||
creature:CastSpell(creature, CAST_SPELL_ID, true) -- Cast the specified spell on self
|
||||
local x, y, z = creature:GetLocation()
|
||||
for i = 1, 5 do
|
||||
local randomX = x + math.random(-5, 5)
|
||||
local randomY = y + math.random(-5, 5)
|
||||
creature:SpawnCreature(BUNNY_ENTRY, randomX, randomY, z, SPAWN_TYPE, DESPAWN_TIMER)
|
||||
end
|
||||
local undeadX = x + math.random(-5, 5)
|
||||
local undeadY = y + math.random(-5, 5)
|
||||
creature:SpawnCreature(UNDEAD_BUNNY_ENTRY, undeadX, undeadY, z, SPAWN_TYPE, DESPAWN_TIMER)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnCreatureDeath(event, creature, killer)
|
||||
if creature:GetEntry() == UNDEAD_WARLORD then
|
||||
local spawner = creature:GetNearestCreature(100, CREATURE_SPAWNER)
|
||||
if spawner then
|
||||
DespawnCreatures(spawner)
|
||||
spawner:SetReactState(1) -- Set react state back to aggressive
|
||||
spawner:StopSpellCast(CAST_SPELL_ID)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(CREATURE_SPAWNER, CREATURE_EVENT_ON_QUEST_ACCEPT, OnQuestAccept)
|
||||
RegisterCreatureEvent(UNDEAD_WARLORD, 4, OnCreatureDeath) -- 4 is the event for creature death
|
||||
15
quest_30018_trash_bunnies.lua
Normal file
15
quest_30018_trash_bunnies.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local INVISIBLE_BUNNY_ENTRY = 400099
|
||||
local SPELL_TO_CAST = 10001
|
||||
|
||||
local InvisibleBunny = {}
|
||||
|
||||
function InvisibleBunny.OnSpawn(event, creature)
|
||||
creature:RegisterEvent(InvisibleBunny.CastSpellRandomly, math.random(5000, 12000), 0)
|
||||
end
|
||||
|
||||
function InvisibleBunny.CastSpellRandomly(event, delay, calls, creature)
|
||||
creature:CastSpell(creature, SPELL_TO_CAST, true)
|
||||
creature:RegisterEvent(InvisibleBunny.CastSpellRandomly, math.random(5000, 12000), 0)
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(INVISIBLE_BUNNY_ENTRY, 5, InvisibleBunny.OnSpawn)
|
||||
15
quest_30018_undead_bunny.lua
Normal file
15
quest_30018_undead_bunny.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local UNDEAD_BUNNY_ENTRY = 400100
|
||||
local SPELL_TO_CAST = 10000
|
||||
local CAST_DELAY = 90000 -- 90 seconds in milliseconds
|
||||
|
||||
local UndeadBunny = {}
|
||||
|
||||
function UndeadBunny.OnSpawn(event, creature)
|
||||
creature:RegisterEvent(UndeadBunny.CastSpellAfterDelay, CAST_DELAY, 1)
|
||||
end
|
||||
|
||||
function UndeadBunny.CastSpellAfterDelay(event, delay, calls, creature)
|
||||
creature:CastSpell(creature, SPELL_TO_CAST, true)
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(UNDEAD_BUNNY_ENTRY, 5, UndeadBunny.OnSpawn)
|
||||
Reference in New Issue
Block a user