Attack names link to spells, etc:
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
massive_energy_elemental.xml
XML:
<attack name="massive energy elemental electrify" interval="2000" chance="20">
<attribute key="areaEffect" value="yellowspark" />
</attack>
Links to: (through monster attack name -> spell instant name)
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
spells.xml
XML:
<instant name="massive energy elemental electrify" words="###4" aggressive="1" blockwalls="1" needtarget="0" needlearn="1" script="monster/massive_energy_elemental_electrify.lua" />
Which links to Lua file:
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
massive_energy_elemental_electrify.lua
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLOCKHIT)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
function onCastSpell(creature, variant)
for _, target in ipairs(combat:getTargets(creature, variant)) do
creature:addDamageCondition(target, CONDITION_ENERGY, DAMAGELIST_VARYING_PERIOD, 25, {10, 12}, 10)
end
return true
end
Where you can modify
onCastSpell
to only cast the spell if a global variable is set, which you can configure by toggling a lever in-game.
In the same fashion, you can create the spell in revscriptsys, and link to it using the attacks table, etc:
Lua:
monster.attacks = {
{name = "melee", attack = 130, skill = 70, effect = CONST_ME_DRAWBLOOD, interval = 2*1000},
{name = "massive energy elemental electrify", chance = 20, interval = 2*1000, effect = CONST_ME_YELLOW_RINGS}
}