• 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 Edit poison arrow poison

dudie

Member
Joined
May 23, 2016
Messages
128
Reaction score
12
I wanted edit poison from poison arrow damage to:

YOURSKILL / 2

For example skills 80... poison = 40

How to make it?

I tried:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)

local poison_value = getPlayerSkill(cid, SKILL_DISTANCE) / 2 * -1

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 15)
addDamageCondition(condition, 10, 2000, poison_value)
setCombatCondition(combat, condition)

function onGetFormulaValues(cid, level, skill, attack, factor)
   min = (1 * (attack) * (skill)) * -1
   max = (2 * (attack) * (skill)) * -1
   return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
   return doCombat(cid, combat, var)
end

But i recive this errors:
Code:
[4:0:32.723] [Error - Weapon Interface]
[4:0:32.723] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua
[4:0:32.723] Description:
[4:0:32.723] (luaGetPlayerSkillLevel) Player not found

[4:0:32.723] [Error - Weapon Interface]
[4:0:32.723] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua
[4:0:32.724] Description:
[4:0:32.724] ...ons/scripts/distance_weapons/arrows/poison_arrow.lua:6: attempt to perform arithmetic on a boolean value
[4:0:32.724] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua)
 
i believe thats because cid are outside of event in poison_value.

But is no possible put it
Code:
local poison_value = getPlayerSkill(cid, SKILL_DISTANCE) / 2 * -1

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 15)
addDamageCondition(condition, 10, 2000, poison_value)
setCombatCondition(combat, condition)

Inside event....

What i supposed to do now?
 
This can not be used outside an interface or function in a script.
Code:
getPlayerSkill(cid, SKILL_DISTANCE)
Because one of its arguments requires cid, and combat or condition requires the data to be loaded well in advance of the script executing.

What i supposed to do now?
Be creative. ;)
 
This can not be used outside an interface or function in a script.
Code:
getPlayerSkill(cid, SKILL_DISTANCE)
Because one of its arguments requires cid, and combat or condition requires the data to be loaded well in advance of the script executing.


Be creative. ;)

Idk how, thats why i posted here...

I tried put in, dont work, tried put out, dont work
Now idk what to do
 
Try this:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)

function onGetFormulaValues(cid, level, skill, attack, factor)
   min = (1 * (attack) * (skill)) * -1
   max = (2 * (attack) * (skill)) * -1
   return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

-- Poison
local combat2 = {}
local poison = {}

for i=0,300 do
    combat2[i] = createCombatObject()

    poison[i] = createConditionObject(CONDITION_POISON)
    poison[i]:setParameter(CONDITION_PARAM_DELAYED, 15)
    addDamageCondition(poison[i], 10, 2000, -(i * 0.5))
    setCombatCondition(combat2[i], poison[i])
end

function onUseWeapon(cid, var)
    local dist = cid:getSkillLevel(SKILL_DISTANCE)
    combat2[dist]:execute(cid,var) -- applies the poison
   
    return combat:execute(cid,var) -- applies the damage
end
 
Try this:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)

function onGetFormulaValues(cid, level, skill, attack, factor)
   min = (1 * (attack) * (skill)) * -1
   max = (2 * (attack) * (skill)) * -1
   return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

-- Poison
local combat2 = {}
local poison = {}

for i=0,300 do
    combat2[i] = createCombatObject()

    poison[i] = createConditionObject(CONDITION_POISON)
    poison[i]:setParameter(CONDITION_PARAM_DELAYED, 15)
    addDamageCondition(poison[i], 10, 2000, -(i * 0.5))
    setCombatCondition(combat2[i], poison[i])
end

function onUseWeapon(cid, var)
    local dist = cid:getSkillLevel(SKILL_DISTANCE)
    combat2[dist]:execute(cid,var) -- applies the poison
  
    return combat:execute(cid,var) -- applies the damage
end


Printed on console when i start
Code:
[21:45:41.904] [Error - Weapon Interface]
[21:45:41.904] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua
[21:45:41.904] Description:
[21:45:41.904] ...ons/scripts/distance_weapons/arrows/poison_arrow.lua:22: attempt to index field '?' (a number value)
[21:45:41.904] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua)
 
Printed on console when i start
Code:
[21:45:41.904] [Error - Weapon Interface]
[21:45:41.904] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua
[21:45:41.904] Description:
[21:45:41.904] ...ons/scripts/distance_weapons/arrows/poison_arrow.lua:22: attempt to index field '?' (a number value)
[21:45:41.904] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua)

Fixed, sorry. There was a issue with ur first combat code.

Here you go:

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

-- Poison
local combat2 = {}
local poison = {}

for i=0,300 do
    combat2[i] = createCombatObject()

    poison[i] = createConditionObject(CONDITION_POISON)
    poison[i]:setParameter(CONDITION_PARAM_DELAYED, 15)
    addDamageCondition(poison[i], 10, 2000, -(i * 0.5))
    setCombatCondition(combat2[i], poison[i])
end

function onUseWeapon(cid, var)
    local dist = cid:getSkillLevel(SKILL_DISTANCE)
    combat2[dist]:execute(cid,var) -- applies the poison
   
    return combat:execute(cid,var) -- applies the damage
end
 
Fixed, sorry. There was a issue with ur first combat code.

Here you go:

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

-- Poison
local combat2 = {}
local poison = {}

for i=0,300 do
    combat2[i] = createCombatObject()

    poison[i] = createConditionObject(CONDITION_POISON)
    poison[i]:setParameter(CONDITION_PARAM_DELAYED, 15)
    addDamageCondition(poison[i], 10, 2000, -(i * 0.5))
    setCombatCondition(combat2[i], poison[i])
end

function onUseWeapon(cid, var)
    local dist = cid:getSkillLevel(SKILL_DISTANCE)
    combat2[dist]:execute(cid,var) -- applies the poison
  
    return combat:execute(cid,var) -- applies the damage
end

Code:
[2:11:47.958] [Error - Weapon Interface]
[2:11:47.958] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua
[2:11:47.958] Description:
[2:11:47.959] ...ons/scripts/distance_weapons/arrows/poison_arrow.lua:1: attempt to call global 'Combat' (a nil value)
[2:11:47.959] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua)
 
@dudie
Can you post an unedited version of 0.4 poison_arrow.lua?

Anyway, try this:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

-- Poison
local combat2 = {}
local poison = {}

for i=0,300 do
    combat2[i] = createCombatObject()

    poison[i] = createConditionObject(CONDITION_POISON)
    poison[i]:setParameter(CONDITION_PARAM_DELAYED, 15)
    addDamageCondition(poison[i], 10, 2000, -(i * 0.5))
    setCombatCondition(combat2[i], poison[i])
end

function onUseWeapon(cid, var)
    local dist = cid:getSkillLevel(SKILL_DISTANCE)
    doCombat(cid, combat2[dist], var) -- applies the poison

    return doCombat(cid, combat, var) -- applies the damage
end
 
Last edited:
@dudie
Can you post an unedited version of 0.4 poison_arrow.lua?

Anyway, try this:
Code:
local combat = createCombatObject()
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
combat:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

-- Poison
local combat2 = {}
local poison = {}

for i=0,300 do
    combat2[i] = createCombatObject()

    poison[i] = createConditionObject(CONDITION_POISON)
    poison[i]:setParameter(CONDITION_PARAM_DELAYED, 15)
    addDamageCondition(poison[i], 10, 2000, -(i * 0.5))
    setCombatCondition(combat2[i], poison[i])
end

function onUseWeapon(cid, var)
    local dist = cid:getSkillLevel(SKILL_DISTANCE)
    doCombat(cid, combat2[dist], var) -- applies the poison

    return doCombat(cid, combat, var) -- applies the damage
end



Code:
[7:20:36.396] [Error - Weapon Interface]
[7:20:36.396] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua
[7:20:36.396] Description:
[7:20:36.396] ...ons/scripts/distance_weapons/arrows/poison_arrow.lua:2: attempt to index local 'combat' (a number value)
[7:20:36.396] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua)

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 2000, -1)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
   return doCombat(cid, combat, var)
end
 
Back
Top