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

New weapon damage condition.

chucky91

Advanced OT User
Joined
Apr 8, 2010
Messages
282
Solutions
9
Reaction score
153
I made a new weapon damage condition on my server TFS 1.2, im already implementing it for crying knight, which is difficult to cause damage.
as my server is customized, i created these conditions in src. and i made this video how the work turned out.
it just gave me work to make these arrows. :p

 
Sorry to be an ass but ...
I made a new weapon damage condition on my server TFS 1.2, im already implementing it for crying knight, which is difficult to cause damage.
Did you make crossbow conditions for knights?
as my server is customized, i created these conditions in src
Have you heard about onHealthChange?
You shouldn't script your weapons in the source files.
Lua:
buffedWeapons = {
    ["mega hiper wand"] = {condition = CONDITION_POISON, ticks = 10}
}

function Player:getBuff()
    local weapon = self:getWeapon(CONST_SLOT_LEFT) or
        self:getWeapon(CONST_SLOT_RIGHT)

    if not weapon or not weapon:isItem() then
        return
    end
 
    return buffedWeapons[weapon:getName()]
end

function onHealthChange(target, attacker, damage)
    if not attacker:getPlayer() then
        return damage
    end
 
    local buff = attacker:getBuff()
    if not buff then
        return damage
    end

    if target:getHealth() - (damage.primary + damage.secondary) <= 0 then
        target:addCondition(Condition(buff.condition, buff.ticks))
    end
 
    return damage
end
Without a single recompilation and in O(1), there you go.
You are not going to be pro jest because you modified your binary, your uninformed change will likely cause your server to crash - for stuff like that, use Lua
 
Last edited:
Sorry to be an ass but ...

Did you make crossbow conditions for knights?

Have you heard about onHealthChange?
You shouldn't script your weapons in the source files.
Lua:
buffedWeapons = {
    ["mega hiper gowno"] = {condition = CONDITION_POISON, ticks = 10}
}

function Player:getBuff()
    local weapon = self:getWeapon(CONST_SLOT_LEFT) or
        self:getWeapon(CONST_SLOT_RIGHT)

    if not weapon or not weapon:isItem() then
        return
    end
 
    return buffedWeapons[weapon:getName()]
end

function onHealthChange(target, attacker, damage)
    if not attacker:getPlayer() then
        return damage
    end
 
    local buff = attacker:getBuff()
    if not buff then
        return damage
    end

    if target:getHealth() - (damage.primary + damage.secondary) <= 0 then
        target:addCondition(Condition(buff.condition, buff.ticks))
    end
 
    return damage
end
Without a single recompilation and in O(1), there you go.
You are not going to be pro jest because you modified your binary, your uninformed change will likely cause your server to crash - for stuff like that, use Lua
I did not make a crossbow for the knight, i just showed how the paladin weapons turned out, which is more work than the closeAttack.
I dont really like working with lua, although my server not have weapons.xml, yes the system i created is a single compilation, just edit items.srv and choose the weapon you want. ex: Fire Axe. in the attributes i put "SpecialWeapon=1, Effect=16, Type=FireDamage, Count=10" ready that's all my weapon is with fire effect when hitting the creature.


finally, i improved a variation according to the skill and attack of the items. it was cool and easy to add, being able to assign even the running server. without crashing, i also did a lot of testing and error handling. we are not born knowing, everything has a beginning and an end. practicing and learn to program.​
 
Last edited:
Back
Top