Crystals
Member
- Joined
- Sep 28, 2024
- Messages
- 58
- Reaction score
- 10
TFS 1.4.2:
Hi,
I'm trying to create a spell that causes an explosion when a monster dies. I've tried creating a spell in various ways but I haven't succeeded, maybe someone can help.
The last version I tested is this:
.xml:
spell:
Hi,
I'm trying to create a spell that causes an explosion when a monster dies. I've tried creating a spell in various ways but I haven't succeeded, maybe someone can help.
The last version I tested is this:
.xml:
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Erupto" nameDescription="an erupting orc" race="blood" experience="2500" speed="220" manacost="0">
<health now="100" max="100"/>
<look type="5" corpse="5966"/>
<targetchange interval="4000" chance="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="15"/>
<flag canwalkonenergy="0"/>
<flag canwalkonfire="1"/>
<flag canwalkonpoison="0"/>
</flags>
<attacks>
<attack name="melee" interval="2000" min="0" max="-35"/>
<spell name="Erupto Aura" interval="2000" chance="100" range="0" target="0" script="monster/Tower/erupto_aura.lua"/>
<spell name="erupto_death" trigger="onDeath" chance="100" range="0" target="0" script="monster/Tower/erupto_death.lua"/>
</attacks>
<defenses armor="10" defense="10"/>
<voices interval="5000" chance="10">
<voice sentence="Feel my wrath!"/>
<voice sentence="Burn in flames!"/>
</voices>
<loot>
<item id="2148" countmax="5" chance="100000"/>
</loot>
</monster>
spell:
Code:
print("[ERUPTO] Death spell script loaded!")
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setFormula(COMBAT_FORMULA_DAMAGE, 200, 0, 500, 0)
local area = createCombatArea({
{1, 1, 1},
{1, 2, 1},
{1, 1, 1}
})
combat:setArea(area)
function onCastSpell(creature, var)
local pos = creature:getPosition()
local params = {
type = 2,
value = pos.x,
value2 = pos.y,
value3 = pos.z
}
combat:execute(creature, params)
return true
end