Updated custom scripts

This commit is contained in:
Dinkledork
2023-02-10 05:31:57 -07:00
committed by GitHub
parent c515b9a7eb
commit 4e7172544f
14 changed files with 403 additions and 7 deletions

9
Alleria1.lua Normal file
View File

@@ -0,0 +1,9 @@
local npcid = 400019
function OnSpawn(event, creature)
creature:SetWalk(true)
creature:MoveWaypoint()
creature:SetReactState(0)
end
RegisterCreatureEvent(npcid, 5, OnSpawn)

71
Alleria2.lua Normal file
View File

@@ -0,0 +1,71 @@
local Alleria = {};
local function CastRapidShot(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 71251, true)
end
local function CastShoot(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 39079, true)
end
local function CastMultiShot(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 59713, false)
end
local function CastExplosiveShot(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 60053, false)
end
local function CastBlackArrow(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 63672, false)
end
local function CastDisengage(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 781, false)
end
local function CastFD(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 23604, false)
end
local function CastRoot(eventId, delay, calls, creature)
local victim = creature:GetVictim()
creature:CastSpell(victim, 50762, false)
end
local function ForceDespawn(eventId, delay, calls, creature)
creature:DespawnOrUnsummon(1)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastFD, 1, 1)
creature:RegisterEvent(CastRoot, 10300, 1)
creature:RegisterEvent(CastDisengage, 10400, 1)
creature:RegisterEvent(CastRapidShot, 7100, 0)
creature:RegisterEvent(CastMultiShot, 6100, 0)
creature:RegisterEvent(CastExplosiveShot, 6600, 0)
creature:RegisterEvent(CastBlackArrow, 15300, 0)
creature:RegisterEvent(CastShoot, 499, 0)
creature:RegisterEvent(ForceDespawn, 90000, 1)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400021, 1, OnEnterCombat)
RegisterCreatureEvent(400021, 2, OnLeaveCombat)
RegisterCreatureEvent(400021, 4, OnDied)

41
AllianceMage.lua Normal file
View File

@@ -0,0 +1,41 @@
local mageNPC = 400027
local conjuredCinnamonRolls = 22895
local arcaneIntellect = 10157
local function OnGossipHello(event, player, creature)
player:GossipMenuAddItem(9, "|TInterface\\Icons\\inv_misc_food_73cinnamonroll:50:50:-43:0|tTake some Conjured Cinnamon Rolls", 0, 1, false, "", 0)
player:GossipMenuAddItem(9, "|TInterface\\Icons\\Spell_Holy_Magicalsentry:50:50:-43:0|tCast Arcane Intellect", 0, 2, false, "", 0)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code, menuid)
if intid == 1 then
player:AddItem(conjuredCinnamonRolls, 5)
player:SendBroadcastMessage("Enjoy the sweet taste of magic! Here are 5 Conjured Cinnamon Rolls.")
elseif intid == 2 then
player:CastSpell(player, arcaneIntellect, true)
player:SendBroadcastMessage("You feel your mind become more focused as Arcane Intellect takes hold.")
end
player:GossipComplete()
end
local function YellDialogue(event, creature)
-- List of unit say options
local unitSayOptions = {
"Greetings, adventurer! Would you like some refreshment?",
"Welcome traveler! Are you in need of some sustenance?",
"Let me offer you some conjured treats and a bit of intellectual enhancement.",
"You look like you could use a boost. How about some Conjured Cinnamon Rolls and Arcane Intellect?",
"Good day! I have some delectable Conjured Cinnamon Rolls and the power of Arcane Intellect for you.",
"Step right up! I have some of the finest Conjured Cinnamon Rolls and a touch of Arcane Intellect for you."
}
-- Choose a random unit say option
local randomOption = unitSayOptions[math.random(#unitSayOptions)]
creature:SendUnitSay(randomOption, 0)
end
RegisterCreatureGossipEvent(mageNPC, 1, OnGossipHello)
RegisterCreatureGossipEvent(mageNPC, 2, OnGossipSelect)
-- triggers the yell function on spawn
RegisterCreatureEvent(mageNPC, 5, function(event, creature) YellDialogue(event, creature) end)

21
AllianceMage2.lua Normal file
View File

@@ -0,0 +1,21 @@
local AMage = {};
local function CastFireball(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 38692, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastFireball, 3600, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400027, 1, OnEnterCombat)
RegisterCreatureEvent(400027, 2, OnLeaveCombat)
RegisterCreatureEvent(400027, 4, OnDied)

48
AlliancePriest.lua Normal file
View File

@@ -0,0 +1,48 @@
local lightwellNPC = 400026
local lightwellSpell = 27870
local fortitudeSpell = 10938
local divineSpiritSpell = 27841
local function OnSpawn(event, creature)
creature:CastSpell(creature, lightwellSpell, true)
end
local function OnGossipHello(event, player, creature)
player:GossipMenuAddItem(9, "|TInterface\\Icons\\Spell_Holy_SummonLightwell:50:50:-43:0|tCast Lightwell", 0, 1, false, "", 0)
player:GossipMenuAddItem(9, "|TInterface\\Icons\\Spell_Holy_WordFortitude:50:50:-43:0|tCast Power Word: Fortitude", 0, 2, false, "", 0)
player:GossipMenuAddItem(9, "|TInterface\\Icons\\Spell_Holy_DivineSpirit:50:50:-43:0|tCast Divine Spirit", 0, 3, false, "", 0)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code, menuid)
if intid == 1 then
player:CastSpell(player, lightwellSpell, true)
elseif intid == 2 then
player:CastSpell(player, fortitudeSpell, true)
elseif intid == 3 then
player:CastSpell(player, divineSpiritSpell, true)
end
player:GossipComplete()
end
local function YellDialogue(event, creature)
-- List of unit say options
local unitSayOptions = {
"May the light guide your paths.",
"Blessings upon you, traveler.",
"The light is always with you. Come, let me grant you a blessing.",
"May the light guide you on your journey.",
"The power of the light is yours for the asking.",
"Let me bring the light to your path."
}
-- Choose a random unit say option
local randomOption = unitSayOptions[math.random(#unitSayOptions)]
creature:SendUnitSay(randomOption, 0)
end
RegisterCreatureEvent(lightwellNPC, 5, OnSpawn)
RegisterCreatureGossipEvent(lightwellNPC, 1, OnGossipHello)
RegisterCreatureGossipEvent(lightwellNPC, 2, OnGossipSelect)
-- triggers the yell function on spawn
RegisterCreatureEvent(lightwellNPC, 5, function(event, creature) YellDialogue(event, creature) end)

31
AlliancePriest2.lua Normal file
View File

@@ -0,0 +1,31 @@
local APriest = {};
local function CastSmite(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 48122, true)
end
local function CastHolyFire(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 48134, true)
end
local function CastSWP(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 27605, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastSmite, 2600, 0)
creature:RegisterEvent(CastHolyFire, 5000, 0)
creature:RegisterEvent(CastSWP, 15000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400026, 1, OnEnterCombat)
RegisterCreatureEvent(400026, 2, OnLeaveCombat)
RegisterCreatureEvent(400026, 4, OnDied)

21
BlisteringZombie.lua Normal file
View File

@@ -0,0 +1,21 @@
local BlisteringZombie = {};
local function CastSpit(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 25262, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastSpit, 5000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400029, 1, OnEnterCombat)
RegisterCreatureEvent(400029, 2, OnLeaveCombat)
RegisterCreatureEvent(400029, 4, OnDied)

View File

@@ -1,3 +1,5 @@
--Made by Dinkledork. This script defines a table of 26 battle cries for a creature with ID 400014. When the creature spawns, it will randomly select one of the 26 dialogues and use it in a yell.
local SwHorse = {}; --ID from creature_template local SwHorse = {}; --ID from creature_template
local dialogues = { local dialogues = {
@@ -30,9 +32,9 @@ local dialogues = {
} }
local function OnSpawn(event, creature) local function OnSpawn(event, creature)
local randomDialogue = dialogues[math.random(26)] local randomDialogue = dialogues[math.random(26)] -- Selects a random dialogue from the "dialogues" table
creature:SendUnitYell(randomDialogue,0) creature:SendUnitYell(randomDialogue,0) -- Makes the creature yell the selected dialogue
end end
RegisterCreatureEvent(400014, 5, OnSpawn) RegisterCreatureEvent(400014, 5, OnSpawn) -- Registers the "OnSpawn" function as a spawn event for the creature with ID 400014

17
SWDefenders.lua Normal file
View File

@@ -0,0 +1,17 @@
local NPC_ENTRY_ID_1 = 400022
local NPC_ENTRY_ID_2 = 400023
local NPC_ENTRY_ID_3 = 400024
local NPC_ENTRY_ID_4 = 400025
function OnSpawn(event, creature)
local npcEntry = creature:GetEntry()
if npcEntry == NPC_ENTRY_ID_1 or npcEntry == NPC_ENTRY_ID_2 or npcEntry == NPC_ENTRY_ID_3 or npcEntry == NPC_ENTRY_ID_4 then
creature:SetWalk(false) -- Set movement type to run
creature:MoveWaypoint()
end
end
RegisterCreatureEvent(NPC_ENTRY_ID_1, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY_ID_2, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY_ID_3, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY_ID_4, 5, OnSpawn)

53
SWVillager.lua Normal file
View File

@@ -0,0 +1,53 @@
--Credits to Dinkledork.
--I created this script to be used in a quest to calm down some frantic stormwind citizens.
local npcid = 400028
local gossipText = "Get the Stormwind Citizen to calm down..."
local itemId = 3713 -- Soothing spices as a test, required to interact with the npc. Can set to a given quest item.
local spellId = 7001
-- This function is called when the player first interacts with the NPC
local function OnGossipHello(event, player, creature)
-- Check if the player has the necessary item
if (player:HasItem(itemId)) then
-- Add the option to the gossip menu
player:GossipMenuAddItem(0, gossipText, 0, 1)
-- Send the gossip menu to the player
player:GossipSendMenu(1, creature)
else
-- Send an error message to the player if they don't have the necessary item
player:SendBroadcastMessage("You do not have the necessary item to calm the citizen.")
end
end
-- This function is called when the player selects an option from the gossip menu
local function OnGossipSelect(event, player, creature, sender, intid, code)
-- Check if the selected option is the one we added in OnGossipHello
if (intid == 1) then
-- Remove the item from the player's inventory
player:RemoveItem(itemId, 1)
-- Remove all auras from the NPC. Important since they have a fear aura.
creature:RemoveAllAuras()
-- Give credit to the player for killing the NPC. Important for quest credit. The NPC literally dies.
player:KilledMonsterCredit(npcid)
-- Cast the spell on the NPC for visual effect.
creature:CastSpell(creature, spellId, true)
-- Choose a random dialogue for the NPC to say after interacting
local randomDialogue = math.random(1, 3)
if randomDialogue == 1 then
creature:SendUnitSay("Oh, thank you for helping me come to my senses...I should be going now...", 0)
elseif randomDialogue == 2 then
creature:SendUnitSay("Thank you so much! I feel much better now...", 0)
else
creature:SendUnitSay("I can finally think clearly again, thank you!", 0)
end
-- Close the gossip menu
player:GossipComplete()
-- Despawn the NPC after a 5 second delay
creature:DespawnOrUnsummon(5000)
end
end
-- Register the gossip events for the NPC
RegisterCreatureGossipEvent(npcid, 1, OnGossipHello)
RegisterCreatureGossipEvent(npcid, 2, OnGossipSelect)

View File

@@ -3,8 +3,8 @@ local BLESSING_SPELL_ID = 100003 -- replace with the first spell ID
local SOULSTONE_SPELL_ID = 20707 -- replace with the second spell ID local SOULSTONE_SPELL_ID = 20707 -- replace with the second spell ID
local function OnGossipHello(event, player, creature) local function OnGossipHello(event, player, creature)
player:GossipMenuAddItem(9, "Receive the King's blessing", 0, 1, false, "", 0) player:GossipMenuAddItem(9, "|TInterface\\Icons\\Spell_Holy_ReviveChampion:50:50:-43:0|tReceive the King's blessing", 0, 1, false, "", 0)
player:GossipMenuAddItem(9, "Receive a Soulstone", 0, 2, false, "", 0) player:GossipMenuAddItem(9, "|TInterface\\Icons\\inv_misc_orb_04:50:50:-43:0|tReceive a Soulstone", 0, 2, false, "", 0)
player:GossipSendMenu(1, creature) player:GossipSendMenu(1, creature)
end end

View File

@@ -14,7 +14,8 @@ local npcIds1 = {
400011, 400011,
400015, 400015,
400016, 400016,
300018 300018,
400029
} }
-- Table to store NPC IDs for group 2 -- Table to store NPC IDs for group 2
@@ -24,7 +25,10 @@ local npcIds2 = {
68, 68,
1976, 1976,
466, 466,
400018 400018,
400019,
400026,
400027
} }
-- Boolean to enable or disable modifying health and level -- Boolean to enable or disable modifying health and level

31
Turalyon1.lua Normal file
View File

@@ -0,0 +1,31 @@
local npcid = 400018
local spellid1 = 100138
local spellid2 = 69930
local spellid3 = 52386
local yelltext = {
"Defenders, forward! We end this beast here and now!",
"We fight for Home, for Family...I only hope we are not too late.",
"",
"Alleria...perfect timing as always.",
}
local waypointIndex = 0
function OnReachWp(event, creature, waypoint)
if waypointIndex >= #yelltext then
return
end
creature:CastSpell(creature, spellid1, true)
creature:CastSpell(creature, spellid2, true)
creature:CastSpell(creature, spellid3, true)
creature:SendUnitSay(yelltext[waypointIndex + 1], 0)
waypointIndex = waypointIndex + 1
end
function OnSpawn(event, creature)
waypointIndex = 0
creature:MoveWaypoint()
creature:SetReactState(0)
end
RegisterCreatureEvent(npcid, 5, OnSpawn)
RegisterCreatureEvent(npcid, 6, OnReachWp)

47
Turalyon2.lua Normal file
View File

@@ -0,0 +1,47 @@
local Turalyon = {};
local function CastCharge(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 22911, true)
end
local function CastCrusaderStrike(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 66003, true)
end
local function CastDivineStorm(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 53385, true)
end
local function CastConsecration(eventId, delay, calls, creature)
creature:CastSpell(creature, 69930, true)
end
local function CastChallengingShout(eventId, delay, calls, creature)
creature:CastSpell(creature, 1161, true)
end
local function ForceDespawn(eventId, delay, calls, creature)
creature:DespawnOrUnsummon(1)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastCharge, 250, 1)
creature:RegisterEvent(CastCrusaderStrike, 5000, 0)
creature:RegisterEvent(CastDivineStorm, 10000, 0)
creature:RegisterEvent(CastConsecration, 15000, 0)
creature:RegisterEvent(CastChallengingShout, 6500, 0)
creature:RegisterEvent(ForceDespawn, 90000, 1)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400020, 1, OnEnterCombat)
RegisterCreatureEvent(400020, 2, OnLeaveCombat)
RegisterCreatureEvent(400020, 4, OnDied)