• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Solved monster not executing spells

johnsamir

Banned User
Joined
Oct 13, 2009
Messages
555
Solutions
5
Reaction score
97
Location
Nowhere
hello
I'm using tfs 1.5 - 7.72
I adapted monster from othire to be useable in this distribution they do work, but certain monster are not excuting spells example orc berserker and gigant spider
I adapted monster spells too
this is the giant spider.xml file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="giant spider" nameDescription="a giant spider" race="venom" experience="900" speed="240" manacost="0">
    <health now="1300" max="1300"/>
    <look type="38" corpse="2857"/>
    <targetchange interval="1000" chance="10"/>
    <targetstrategy nearest="70" weakest="20" mostdamage="0" random="10"/>
    <flags>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag summonable="0"/>
        <flag convinceable="0"/>
        <flag illusionable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="80"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" skill="80" attack="65"/>
        <attack name="poisonfield" chance="17" range="7" radius="1" target="1">
            <attribute key="shootEffect" value="poison"/>
        </attack>
    </attacks>
    <defenses armor="30" defense="40">
        <defense name="haste_giantspider" chance="6"/>
    </defenses>
    <summons maxSummons="2">
        <summon name="poison spider" chance="10" max="2"/>
    </summons>
    <elements>
        <element firePercent="100"/>
        <element earthPercent="100"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity invisible="1"/>
    </immunities>
    <voices interval="1000" chance="5">
    </voices>
    <loot>
        <item id="2148" chance="33300" countmax="55"/><!-- 55 33.3% gold coin -->
        <item id="2148" chance="99900" countmax="11"/><!-- 11 99.9% gold coin -->
        <item id="2148" chance="66600" countmax="33"/><!-- 33 66.6% gold coin -->
        <item id="2463" chance="10000"/><!-- 10% plate armor -->
        <item id="2478" chance="8000"/><!-- 8% brass legs -->
        <item id="2457" chance="5000"/><!-- 5% steel helmet -->
        <item id="2477" chance="300"/><!-- 0.3% knight legs -->
        <item id="2476" chance="300"/><!-- 0.3% knight armor -->
        <item id="2171" chance="100"/><!-- 0.1% platinum amulet -->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
                <item id="2169" chance="700"/><!-- 0.7% time ring -->
            </inside>
        </item>
    </loot>
</monster>
this the spell that is registered in spells.xml
Code:
<instant name="haste_giantspider"  words="###11"  aggressive="0" blockwalls="1" needtarget="1" needlearn="1" script="monster/haste_giantspider.lua"/>
this is how spell used to look
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20*1000)
setConditionFormula(condition, 0, 120, 0, 140)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
how it looks now
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20*1000)
setConditionFormula(condition, 0, 120, 0, 140)
addCombatCondition(combat, condition)

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
I'm not reveiving errors in console, spells are not being exected. can somebody tell me what might be wrong?
 
Solution
by default the defenses have an interval of 2000 milliseconds (2 seconds.), and you have a chance of 6 in 100. It would be very rare to see this spell executed, have you tried a higher chance?

maybe: <defense name="haste_giantspider" chance="100"/>

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Support Team
Joined
Mar 16, 2017
Messages
1,185
Solutions
128
Reaction score
1,459
Location
London
GitHub
MillhioreBT
Twitch
millhiore_bt
by default the defenses have an interval of 2000 milliseconds (2 seconds.), and you have a chance of 6 in 100. It would be very rare to see this spell executed, have you tried a higher chance?

maybe: <defense name="haste_giantspider" chance="100"/>
 
Solution
OP
OP
J

johnsamir

Banned User
Joined
Oct 13, 2009
Messages
555
Solutions
5
Reaction score
97
Location
Nowhere
by default the defenses have an interval of 2000 milliseconds (2 seconds.), and you have a chance of 6 in 100. It would be very rare to see this spell executed, have you tried a higher chance?

maybe: <defense name="haste_giantspider" chance="100"/>
changed to 600 and it work now, thanks for point me out the error! 6000 work supper , going to change the values in others files too, then. @Sarah Wesker to not open another thread would you mind point me out which spell is wrong?, im getting this from a monster
Lua:
Cant load spell. data/monster/bosses/mahrdis.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Mahrdis" nameDescription="Mahrdis" race="undead" experience="3050" speed="300" manacost="0">
    <health now="3900" max="3900"/>
    <look type="90" corpse="3016"/>
    <targetchange interval="1000" chance="3"/>
    <targetstrategy nearest="80" weakest="10" mostdamage="10" random="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="80"/>
        <flag runonhealth="0"/>
    </flags>
    <!-- <script> -->
        <!-- <event name="Hotaboss"/> -->
    <!-- </script> -->
    <attacks>
        <attack name="melee" min="-100" max="-400" poison="65"/>
        <attack name="physical" interval="1600" chance="7" range="1" min="-60" max="-600"/>
            <attribute key="areaEffect" value="redshimmer"/>  
        <attack name="fire" chance="7" range="7" min="-60" max="-600">
            <attribute key="shootEffect" value="fire"/>
            <attribute key="areaEffect" value="firearea"/>
        </attack>
        <attack name="paralyze_mahrdis" chance="13" range="7"/>
        <attack name="fire" chance="34" radius="3" target="0" min="-80" max="-800">
            <attribute key="areaEffect" value="explosionarea"/>
        </attack>
        <attack name="firefield" chance="12" radius="4" target="0">
            <attribute key="areaEffect" value="yellowspark"/>
        </attack>
        <attack name="firecondition" chance="13" length="8" spread="3" min="-50" max="-500">
            <attribute key="areaEffect" value="explosion"/>
        </attack>
    </attacks>
    <defenses armor="20" defense="30">
        <defense name="healing" chance="20" min="20" max="800">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <summons maxSummons="4">
        <summon name="fire elemental" chance="30"/>
    </summons>
    <elements>
        <element firePercent="100"/>
        <element earthPercent="100"/>
    </elements>
    <immunities>
        <immunity lifedrain="1"/>
        <immunity paralyze="1"/>
        <immunity outfit="1"/>
        <immunity drunk="1"/>
        <immunity invisible="1"/>
    </immunities>
    <voices interval="5000" chance="10">
        <voice sentence="Ashes to ashes!"/>
        <voice sentence="Fire, Fire!"/>
        <voice sentence="The eternal flame demands its due!"/>
        <voice sentence="Burnnnnnnnnn!"/>
        <voice sentence="May my flames engulf you!"/>
    </voices>
    <loot>
        <item id="2353" chance="100000"/><!-- 100% burning heart-->
        <item id="2148" chance="70000" countmax="80"/><!-- 80 70% gold -->
        <item id="2148" chance="50000" countmax="85"/><!-- 85 50% gold -->
        <item id="2148" chance="35000" countmax="95"/><!-- 95 35% gold -->
        <item id="2147" chance1="10000" countmax="3"/><!-- 3 10% small ruby -->
        <item id="2156" chance="1000"/><!-- 1% red gem -->
        <item id="2141" chance="100"/><!-- 0.1% holy falcon-->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
                <item id="2432" chance="200"/><!-- 0.2% fire axe -->
                <item id="2539" chance="100"/><!-- 0.1% phoenix shield -->
                <item id="2168" chance="5000"/><!-- 5% life ring -->
            </inside>
        </item>  
    </loot>
</monster>
it's not explosion nor explosionarea
 
Last edited:
Top