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

Lua [TFS 1.X] Poison Arrow, % Chance of poison instead of poison per hit

Athenuz

Owlz!
Joined
Oct 1, 2015
Messages
234
Reaction score
27
Location
México
Hello,

As the tittle says, i'd like to change the poison arrow script, to make the arrow poison the target only by certain chance, like 10% chance to poison the target instead of poison the target each hit...

Here's the TFS 1.x "poison_arrow.lua" from data>weapons>scripts

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_POISON)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:addDamage(4, 4000, -3)
condition:addDamage(9, 4000, -2)
condition:addDamage(20, 4000, -1)
combat:setCondition(condition)

function onUseWeapon(player, variant)
    return combat:execute(player, variant)
end

Can please someone help me with this quick edition?
Thanks
 
It is something like that?
https://otland.net/threads/poison-arrow-onuseweapon.239758/
the script is 10 rounds based on target's percent health

Not exactly, what i mean with this script is:

Instead of set the "poisoned" status to the target each hit the arrow does, make only a percentage of chance, each hit the arrow does haves a 10% of chance to set the status instead of giving the poison status to the player again each hit
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_POISON)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:addDamage(4, 4000, -3)
condition:addDamage(9, 4000, -2)
condition:addDamage(20, 4000, -1)
local i = math.random(1, 10)
if i == 5 then
combat:setCondition(condition
end

function onUseWeapon(player, variant)
    return combat:execute(player, variant)
end
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_POISON)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:addDamage(4, 4000, -3)
condition:addDamage(9, 4000, -2)
condition:addDamage(20, 4000, -1)

function onUseWeapon(player, variant)
    combat:execute(player, variant)
    if math.random(100) < 10 then
        local target = Creature(variant:getNumber())
        if target then
            target:addCondition(condition)
        end
    end
    return true
end
 
Last edited:
local randomN = math.random(1, 100)

doTargetCombatHealth(creature:getId(), attacker:getId(), POISON, minDam, maxDam, 9)
if randomN <= 10 then
bindCondition()
end
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)

local condition = Condition(CONDITION_POISON)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:addDamage(4, 4000, -3)
condition:addDamage(9, 4000, -2)
condition:addDamage(20, 4000, -1)

function onUseWeapon(player, variant)
    combat:execute(player, variant)
    if math.random(100) < 10 then
        local target = Creature(variant:getNumber())
        if target then
            target:addCondition(condition)
        end
    end
    return true
end

Works perfectly, easy to change % chance, thanks :)
 
Back
Top