From c91a76c2cce6f6fe6a71a00bce8d5c5b6d643712 Mon Sep 17 00:00:00 2001 From: Dinkledork <118951051+Day36512@users.noreply.github.com> Date: Mon, 27 Mar 2023 09:26:04 -0600 Subject: [PATCH] Add files via upload --- Faction_Shared/Blight.lua | 10 ++++++ Faction_Shared/BlisteringZombie.lua | 46 +++++++++++++++++----------- Faction_Shared/BlisteringZombie2.lua | 30 ++++++++++++++---- Faction_Shared/TreeChopping.lua | 2 ++ 4 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 Faction_Shared/Blight.lua diff --git a/Faction_Shared/Blight.lua b/Faction_Shared/Blight.lua new file mode 100644 index 0000000..0a8a954 --- /dev/null +++ b/Faction_Shared/Blight.lua @@ -0,0 +1,10 @@ +local NPC_CUSTOM = 400119 +local WANDER_RADIUS = 5 + +function CustomNPC_OnSpawn(event, creature) + creature:SetDefaultMovementType(1) + creature:SetWanderRadius(WANDER_RADIUS) + creature:MoveRandom(WANDER_RADIUS) +end + +RegisterCreatureEvent(NPC_CUSTOM, 5, CustomNPC_OnSpawn) diff --git a/Faction_Shared/BlisteringZombie.lua b/Faction_Shared/BlisteringZombie.lua index 32ebc5c..f3a0a44 100644 --- a/Faction_Shared/BlisteringZombie.lua +++ b/Faction_Shared/BlisteringZombie.lua @@ -1,44 +1,54 @@ local BlisteringZombie = {}; local function CastArmyOfTheDead(eventId, delay, calls, creature) -creature:CastSpell(creature, 42650, true) + creature:CastSpell(creature, 42650, true) end local function CastSpit(eventId, delay, calls, creature) -creature:CastSpell(creature:GetVictim(), 25262, true) + creature:CastSpell(creature:GetVictim(), 25262, true) end local function CastSpecialSpell(eventId, delay, calls, creature) - local victim = creature:GetVictim() - if not victim then - return - end - if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then - creature:CastSpell(victim, 5, true) - end + local victim = creature:GetVictim() + if not victim then + return + end + if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then + creature:CastSpell(victim, 5, true) + end end - local function OnEnterCombat(event, creature, target) -creature:RegisterEvent(CastArmyOfTheDead, 25000, 0) -creature:RegisterEvent(CastSpit, 5000, 0) -creature:RegisterEvent(CastSpecialSpell, 1000, 0) + creature:RegisterEvent(CastArmyOfTheDead, 25000, 0) + creature:RegisterEvent(CastSpit, 5000, 0) + creature:RegisterEvent(CastSpecialSpell, 1000, 0) end local function OnLeaveCombat(event, creature) -creature:RemoveEvents() + creature:RemoveEvents() end local function OnSpawn(event, creature) -creature:RegisterEvent(CastArmyOfTheDead, 1000, 1) + creature:RegisterEvent(CastArmyOfTheDead, 1000, 1) end local function OnDied(event, creature, killer) -creature:DespawnOrUnsummon(5000) -creature:RemoveEvents() + creature:DespawnOrUnsummon(5000) + creature:RemoveEvents() +end + +local function OnWaypointReached(event, creature) + if math.random(1, 100) <= 50 then -- 50% chance to spawn 400019 + local x, y, z, o = creature:GetLocation() + local xOffset = math.random(-10, 10) + local yOffset = math.random(-10, 10) + local nx, ny, nz = x + xOffset, y + yOffset, z + creature:SpawnCreature(400119, nx, ny, nz, o, 3, 200000) + end end RegisterCreatureEvent(400029, 1, OnEnterCombat) RegisterCreatureEvent(400029, 2, OnLeaveCombat) RegisterCreatureEvent(400029, 4, OnDied) -RegisterCreatureEvent(400029, 5, OnSpawn) \ No newline at end of file +RegisterCreatureEvent(400029, 5, OnSpawn) +RegisterCreatureEvent(400029, 6, OnWaypointReached) diff --git a/Faction_Shared/BlisteringZombie2.lua b/Faction_Shared/BlisteringZombie2.lua index a049487..eb81b90 100644 --- a/Faction_Shared/BlisteringZombie2.lua +++ b/Faction_Shared/BlisteringZombie2.lua @@ -1,20 +1,37 @@ local BlisteringZombie = {}; +local NPC_HUT_FIRE = 29692 +local FIRE_SPAWN_CHANCE = 20 +local FIRE_SPAWN_RADIUS = 35 +local FIRE_DESPAWN_TIME = 400000 + function BlisteringZombie.OnSpawn(event, creature) -creature:SetMaxHealth(8224) -creature:CastSpell(creature:GetVictim(), 17683, true) + creature:SetMaxHealth(8224) + creature:CastSpell(creature:GetVictim(), 17683, true) end function BlisteringZombie.OnCombat(event, creature, target) -creature:RegisterEvent(BlisteringZombie.Ability1, 8000, 0) + creature:RegisterEvent(BlisteringZombie.Ability1, 8000, 0) end function BlisteringZombie.Ability1(event, delay, calls, creature) -creature:CastSpell(creature:GetVictim(), 64153, true) + creature:CastSpell(creature:GetVictim(), 64153, true) end function BlisteringZombie.OnLeaveCombat(event, creature) -creature:RemoveEvents() + creature:RemoveEvents() +end + +function BlisteringZombie.OnWaypointReached(event, creature) + local chance = math.random(1, 100) + local areaId = creature:GetAreaId() + if chance <= FIRE_SPAWN_CHANCE and (areaId == 380 or areaId == 69) then + local x, y, z, o = creature:GetLocation() + local xOffset = math.random(-FIRE_SPAWN_RADIUS, FIRE_SPAWN_RADIUS) + local yOffset = math.random(-FIRE_SPAWN_RADIUS, FIRE_SPAWN_RADIUS) + local nx, ny, nz = x + xOffset, y + yOffset, z + creature:SpawnCreature(NPC_HUT_FIRE, nx, ny, nz, o, 3, FIRE_DESPAWN_TIME) + end end function BlisteringZombie.OnDeath(event, creature, killer) @@ -25,4 +42,5 @@ end RegisterCreatureEvent(400077, 1, BlisteringZombie.OnCombat) RegisterCreatureEvent(400077, 2, BlisteringZombie.OnLeaveCombat) RegisterCreatureEvent(400077, 4, BlisteringZombie.OnDeath) -RegisterCreatureEvent(400077, 5, BlisteringZombie.OnSpawn) \ No newline at end of file +RegisterCreatureEvent(400077, 5, BlisteringZombie.OnSpawn) +RegisterCreatureEvent(400077, 6, BlisteringZombie.OnWaypointReached) diff --git a/Faction_Shared/TreeChopping.lua b/Faction_Shared/TreeChopping.lua index 4c51e63..df3cd06 100644 --- a/Faction_Shared/TreeChopping.lua +++ b/Faction_Shared/TreeChopping.lua @@ -1,3 +1,4 @@ +local TREE_CREATURE_ID = 400091 local GOSSIP_OPTION_CUT_TREE = 1 local LOG_ITEM_ID = 60116 local BARRIERS_BUILT_QUEST_ID = 30012 @@ -8,6 +9,7 @@ function OnCreatureSpawn(event, creature) end function OnGossipHello(event, player, creature) + if creature == nil or creature:GetEntry() ~= TREE_CREATURE_ID then return end if player:IsMounted() then player:SendBroadcastMessage("You must dismount first!") return