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

[TFS 1.3] (Weapons) Bleeding: ignore race(undead etc) or ignore monsters.

Lay

TFS 1.2
Joined
Dec 7, 2012
Messages
67
Solutions
9
Reaction score
29
Hey, ye its me again.
I made something like this:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_BLEEDING)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:addDamage(3, 2000, -5)
condition:addDamage(4, 2000, -3)
condition:addDamage(10, 2000, -1)

local secondCombat = Combat()
secondCombat:setCondition(condition)

local ignoreMonsters = { 
    'Test'
}

function onUseWeapon(player, var)
    local bleedHit = combat:execute(player, var)
    if not bleedHit or ignored then
        return false
    end

    local targetNum = var:getNumber()
    if targetNum ~= 0 then
        if math.random(100) <= 10 then
            bleedHit = secondCombat:execute(player, var)
        end
    end
    return bleedHit
end

and tried add this:
Lua:
isInArray(ignoreMonsters, target:getName())
but got problems with 'target' or just script didnt work at all

rly dont know how to make ignore function for undead/ or monsters name, this look stupid when demon skeleton(etc) bleeding =/

In weapons.xml i must add all id's like this?:
XML:
<!-- Bleeding -->
    <melee id="2400" script="bleeding.lua" />
    <melee id="26578" script="bleeding.lua" />

or its easier way? (id, id, id) {}? in script? = D
I am a layman in these matters.

Thanks for help again.
 
Solution
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_BLEEDING)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:addDamage(10, 2000, -1)

function onUseWeapon(player, var)
    local target = Creature(var:getNumber())


            if target:isMonster() then
                if MonsterType(target:getName()):getRace() == 3 then
                return combat:execute(player, var)
                end
            end
         
            if math.random(1, 100) <= 10 then...
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_BLEEDING)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:addDamage(10, 2000, -1)

function onUseWeapon(player, var)
    local target = Creature(var:getNumber())


            if target:isMonster() then
                if MonsterType(target:getName()):getRace() == 3 then
                return combat:execute(player, var)
                end
            end
         
            if math.random(1, 100) <= 10 then
                target:addCondition(condition)
            end
     
return combat:execute(player, var)
end

Try this. If target is monster and target has race of "undead"(3), it ends up with returning normal hit.
If target doesn't pass these conditions it makes it to adding bleeding and then returns.
 
Solution
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_BLEEDING)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:addDamage(10, 2000, -1)

function onUseWeapon(player, var)
    local target = Creature(var:getNumber())


            if target:isMonster() then
                if MonsterType(target:getName()):getRace() == 3 then
                return combat:execute(player, var)
                end
            end
         
            if math.random(1, 100) <= 10 then
                target:addCondition(condition)
            end
     
return combat:execute(player, var)
end

Try this. If target is monster and target has race of "undead"(3), it ends up with returning normal hit.
If target doesn't pass these conditions it makes it to adding bleeding and then returns.

Where I can find list of Races id?
 
monsters.cpp
C++:
        if (tmpStrValue == "venom" || tmpInt == 1) {
            mType->info.race = RACE_VENOM;
        } else if (tmpStrValue == "blood" || tmpInt == 2) {
            mType->info.race = RACE_BLOOD;
        } else if (tmpStrValue == "undead" || tmpInt == 3) {
            mType->info.race = RACE_UNDEAD;
        } else if (tmpStrValue == "fire" || tmpInt == 4) {
            mType->info.race = RACE_FIRE;
        } else if (tmpStrValue == "energy" || tmpInt == 5) {
            mType->info.race = RACE_ENERGY;
        } else {

Lua:
                if MonsterType(target:getName()):getRace() > 2 then
then only venom and blood race bleeding.
 
Last edited:
Back
Top