jeanphilip
Well-Known Member
- Joined
- Oct 26, 2023
- Messages
- 254
- Reaction score
- 55
LUA:
double combo spell / wave beams }
-- Config
local MONSTER_NAMES = {"Dragon", "Dragon Lord", "Demon", "Hydra"} -- Replace with the names of the monsters you want to modify
local function onCreatureAppear(creature)
if isMonster(creature) then
local creatureName = getCreatureName(creature)
for _, name in ipairs(MONSTER_NAMES) do
if creatureName == name then
registerCreatureEvent(creature, "onCreatureAttack") -- Corrected event name
break
end
end
end
end
local function onCreatureAttack(creature, target, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if isMonster(creature) then
local creatureName = getCreatureName(creature)
for _, name in ipairs(MONSTER_NAMES) do
if creatureName == name then
-- Simulate a double spell combo by casting two different random spells from the creature's spell list
local spellList = getCreatureSpells(creature)
if spellList and #spellList > 1 then
local randomIndex1 = math.random(1, #spellList)
local randomIndex2 = randomIndex1
while randomIndex2 == randomIndex1 do
randomIndex2 = math.random(1, #spellList)
end
local randomSpell1 = spellList[randomIndex1]
local randomSpell2 = spellList[randomIndex2]
-- Cast the first spell immediately
doCreatureCastSpell(creature, randomSpell1)
-- Add a slight delay before casting the second spell
addEvent(doCreatureCastSpell, 300, creature, randomSpell2)
end
break
end
end
end
return true
end
for _, name in ipairs(MONSTER_NAMES) do
registerCreatureEvent(name, "onCreatureAppear")
end
Code:
-- Config
local MONSTER_NAMES = {"Dragon", "Dragon Lord", "Demon", "Hydra", "Hunter"} -- Replace with the names of the monsters you want to modify
local function onCreatureAppear(creature)
if isMonster(creature) then
local creatureName = getCreatureName(creature)
for _, name in ipairs(MONSTER_NAMES) do
if creatureName == name then
registerCreatureEvent(creature, "onCreatureAttack") -- Corrected event name
break
end
end
end
end
local function onCreatureAttack(creature, target, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if isMonster(creature) then
local creatureName = getCreatureName(creature)
for _, name in ipairs(MONSTER_NAMES) do
if creatureName == name then
-- Simulate a double spell combo by casting two different random spells from the creature's spell list
local spellList = getCreatureSpells(creature)
if spellList and #spellList > 1 then
local randomIndex1 = math.random(1, #spellList)
local randomIndex2 = randomIndex1
while randomIndex2 == randomIndex1 do
randomIndex2 = math.random(1, #spellList)
end
local randomSpell1 = spellList[randomIndex1]
local randomSpell2 = spellList[randomIndex2]
-- Cast the first spell immediately
doCreatureCastSpell(creature, randomSpell1)
-- Add a slight delay before casting the second spell
addEvent(doCreatureCastSpell, 100, creature, randomSpell2)
end
break
end
end
end
return true
end
for _, name in ipairs(MONSTER_NAMES) do
registerCreatureEvent(name, "onCreatureAppear")
end
for me monster seems behave way better. maight be not the real behavior altough
ForgottenOT - Sorcerersito 2025-12-23 23-08-53
This is "ForgottenOT - Sorcerersito 2025-12-23 23-08-53" by Felipe Rodriguez on Vimeo, the home for high quality videos and the people who love them.
vimeo.com
ForgottenOT - Sorcerersito 2025-12-23 23-07-09
This is "ForgottenOT - Sorcerersito 2025-12-23 23-07-09" by Felipe Rodriguez on Vimeo, the home for high quality videos and the people who love them.
vimeo.com
Vimeo
made this like two years ago
Attachments
-
doubleattack.lua1.6 KB · Views: 0 · VirusTotal
-
doublecombospell.lua1.9 KB · Views: 0 · VirusTotal
Last edited: