• 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!

Monsters go through energy and fire fileds. Tfs 1.2

Lada Calena

New Member
Joined
Oct 30, 2017
Messages
4
Reaction score
0
For example code:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Hydra" nameDescription="a hydra" race="blood" experience="2100" speed="250" manacost="0">
    <health now="2350" max="2350" />
    <look type="121" corpse="6048" />
    <targetchange interval="4000" chance="10" />
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="1" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="1" />
        <flag targetdistance="1" />
        <flag staticattack="90" />
        <flag runonhealth="300" />
    </flags>
    <attacks>
        <attack name="melee" interval="2000" min="0" max="-270" />
        <attack name="earth" interval="2000" chance="10" length="8" spread="3" min="-65" max="-320">
            <attribute key="areaEffect" value="carniphila" />
        </attack>
        <attack name="speed" interval="2000" chance="25" range="7" radius="4" target="1" speedchange="-300" duration="15000">
            <attribute key="shootEffect" value="poison" />
            <attribute key="areaEffect" value="greenbubble" />
        </attack>
        <attack name="ice" interval="2000" chance="10" length="8" spread="3" min="-100" max="-250">
            <attribute key="areaEffect" value="bluebubble" />
        </attack>
        <attack name="ice" interval="2000" chance="10" range="7" min="-70" max="-155">
            <attribute key="shootEffect" value="ice" />
            <attribute key="areaEffect" value="iceattack" />
        </attack>
    </attacks>
    <defenses armor="35" defense="35">
        <defense name="healing" interval="2000" chance="15" min="260" max="407">
            <attribute key="areaEffect" value="blueshimmer" />
        </defense>
    </defenses>
    <elements>
        <element icePercent="50" />
        <element holyPercent="30" />
        <element physicalPercent="-5" />
        <element energyPercent="-10" />
    </elements>
    <immunities>
        <immunity earth="1" />
        <immunity lifedrain="1" />
        <immunity paralyze="1" />
        <immunity invisible="1" />
    </immunities>
    <voices interval="2000" chance="7">
        <voice sentence="FCHHHHH" />
        <voice sentence="HISSSS" />
    </voices>
    <loot>
        <item id="2148" countmax="246" chance="88000" />    <!-- gold coin -->
        <item id="2671" countmax="4" chance="60000" />    <!-- ham -->
        <item id="2152" countmax="3" chance="48000" />    <!-- platinum coin -->
        <item id="11199" chance="10120" />                <!-- hydra head -->
        <item id="2146" chance="5000" />                    <!-- small sapphire -->
        <item id="8842" chance="4780" />                    <!-- cucumber -->
        <item id="2214" chance="1190" />                    <!-- ring of healing -->
        <item id="2476" chance="1000" />                    <!-- knight armor -->
        <item id="2197" subtype="5" chance="900" />                    <!-- stone skin amulet -->
        <item id="2475" chance="890" />                    <!-- warrior helmet -->
        <item id="2177" chance="540" />                    <!-- life crystal -->
        <item id="7589" chance="390" />                    <!-- strong mana potion -->
        <item id="2536" chance="250" />                    <!-- medusa shield -->
        <item id="2498" chance="200" />                    <!-- royal helmet -->
        <item id="2195" chance="120" />                    <!-- boots of haste -->
    </loot>
</monster>
I want to not go through energy and fire fileds.
 
Do they take damage when they go through these fields?
If so just create a movements script and apply it to the item id of the field, check for the monster by name and return false if the monster is about to step in the field.
 
Place this in movements/scripts as OnStepInField.lua
Lua:
local fields = {
        -- campfires
    [1423] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 20},
    [1424] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 20},
    [1425] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 20},

    -- Fields
    [1487] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 20},
    [1488] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 10},
    [1489] = { type = CONDITION_NONE}, -- do nothing
    [1490] = { type = CONDITION_POISON, ticks = 1000, count = 1, dmg = 5},
    [1491] = { type = CONDITION_ENERGY, ticks = 1000, count = 1, dmg = 20},
    [1492] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 20},
    [1493] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 20},
    [1494] = { type = CONDITION_NONE},
    [1495] = { type = CONDITION_ENERGY, ticks = 1000, count = 1, dmg = 20},
    [1496] = { type = CONDITION_POISON, ticks = 1000, count = 1, dmg = 20},
    [1497] = { type = CONDITION_NONE}, -- magic wall
    [1498] = { type = CONDITION_NONE}, -- magic wall
    [1499] = { type = CONDITION_NONE}, -- rush wood
    [1500] = { type = CONDITION_NONE}, -- no pvp, fire
    [1501] = { type = CONDITION_NONE}, -- no pvp, fire
    [1502] = { type = CONDITION_NONE}, -- no pvp, fire
    [1503] = { type = CONDITION_NONE}, -- no pvp, poison gas
    [1504] = { type = CONDITION_NONE}, -- no pvp, energy
    [1505] = { type = CONDITION_NONE}, -- smoke
    [1506] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 300}, -- searing fire
    [1507] = { type = CONDITION_FIRE, ticks = 1000, count = 1, dmg = 300}, -- searing fire
    [7359] = { type = CONDITION_NONE}, -- flame of life
 
}
local condition = {}
for i, v in pairs(fields) do
    if v.type ~= CONDITION_NONE then
        condition[i] = Condition(v.type)
        condition[i]:setParameter(CONDITION_PARAM_DELAYED, true)
        for x = 1, v.count do
            condition[i]:addDamage(v.count, v.ticks, -v.dmg)
        end
    end
end

local monsters = {
    [CONDITION_ENERGY] = {"hydra", "demon"},
    [CONDITION_FIRE] = {"hydra", "demon"},
}

function onStepIn(creature, item, position, fromPosition)
    if creature:isItem() then
        return true
    end
    local itemid = item:getId()
    if fields[itemid] then
        local field = fields[itemid].type
        if next(monsters[field]) and isInArray(monsters[field], creature:getName():lower()) then
            return false
        elseif field ~= CONDITION_NONE then
            creature:addCondition(condition[itemid])
        end
    end
    return true
end
Then open up movements.xml and replace the existing id's with this
HTML:
<!-- Campfires -->
    <movevent event="StepIn" itemid="1423" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1423" function="onAddField" />
    <movevent event="StepIn" itemid="1424" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1424" function="onAddField" />
    <movevent event="StepIn" itemid="1425" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1425" function="onAddField" />

<!-- Fields -->
    <movevent event="StepIn" itemid="1487" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1487" function="onAddField" />
    <movevent event="StepIn" itemid="1488" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1488" function="onAddField" />
    <movevent event="StepIn" itemid="1489" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1489" function="onAddField" />
    <movevent event="StepIn" itemid="1490" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1490" function="onAddField" />
    <movevent event="StepIn" itemid="1491" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1491" function="onAddField" />
    <movevent event="StepIn" itemid="1492" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1492" function="onAddField" />
    <movevent event="StepIn" itemid="1493" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1493" function="onAddField" />
    <movevent event="StepIn" itemid="1494" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1494" function="onAddField" />
    <movevent event="StepIn" itemid="1495" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1495" function="onAddField" />
    <movevent event="StepIn" itemid="1496" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1496" function="onAddField" />
    <movevent event="StepIn" itemid="1497" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1497" function="onAddField" />
    <movevent event="StepIn" itemid="1498" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1498" function="onAddField" />
    <movevent event="StepIn" itemid="1499" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1499" function="onAddField" />
    <movevent event="StepIn" itemid="1500" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1500" function="onAddField" />
    <movevent event="StepIn" itemid="1501" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1501" function="onAddField" />
    <movevent event="StepIn" itemid="1502" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1502" function="onAddField" />
    <movevent event="StepIn" itemid="1503" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1503" function="onAddField" />
    <movevent event="StepIn" itemid="1504" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1504" function="onAddField" />
    <movevent event="StepIn" itemid="1505" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1505" function="onAddField" />
    <movevent event="StepIn" itemid="1506" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1506" function="onAddField" />
    <movevent event="StepIn" itemid="1507" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="1507" function="onAddField" />
    <movevent event="StepIn" itemid="7359" script="OnStepInField.lua" />
    <movevent event="AddItem" itemid="7360" function="onAddField" />
 
Last edited:
Back
Top