• 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 0.X Poison arrow poisoning 0.5~2.0 * skill

fyalhed

Member
Joined
Nov 18, 2017
Messages
129
Reaction score
17
What do i doing wrong?

I'm trying to make poison from poison arrow, do the poison based on skills
poison = skills * 0.5~2.0

Code:
-- Poison
local combat2 = {}
local poison = {}
function DoPoison(cid)
    combat2 = createCombatObject()
    poison = createConditionObject(CONDITION_POISON)
    setConditionParam(poison, CONDITION_PARAM_DELAYED, 15)
    -- 10 ???
    -- after 2 seconds start the poison
    -- poison = skill / 2 ~ skill * 2
    local skill = getPlayerSkillLevel(cid, SKILL_DISTANCE)
    local from_half_to_double = (math.random(5, 20)) / 10
    print("[0.5-2.0]: " .. from_half_to_double)
    addDamageCondition(poison, 10, 2000, -(skill * from_half_to_double) )
    setCombatCondition(combat2, poison)
end

function onUseWeapon(cid, var)
    autoRechargeAmmo(cid)
    DoPoison(cid)
    doCombat(cid, combat2, var) -- applies the poison
    return doCombat(cid, combat, var) -- applies the damage
end


error on console
Code:
[10:43:30.184] [Error - Weapon Interface] 
[10:43:30.184] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua:onUseWeapon
[10:43:30.184] Description: 
[10:43:30.184] (luaCreateCombatObject) This function can only be used while loading the script.
[0.5-2.0]: 1.7

[10:43:30.184] [Error - Weapon Interface] 
[10:43:30.184] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua:onUseWeapon
[10:43:30.184] Description: 
[10:43:30.184] (luaSetCombatCondition) Combat not found

[10:43:30.184] [Error - Weapon Interface] 
[10:43:30.185] data/weapons/scripts/distance_weapons/arrows/poison_arrow.lua:onUseWeapon
[10:43:30.185] Description: 
[10:43:30.185] (luaDoCombat) Combat not found

how should i do this?
 
OP
fyalhed

fyalhed

Member
Joined
Nov 18, 2017
Messages
129
Reaction score
17
this scripts looks like mine

idk what to do, but could help if anyone want to help me :(
 

Deatthraz

Advanced OT User
Joined
May 1, 2013
Messages
418
Solutions
22
Reaction score
180
Location
Mexico
Lua:
    combat2 = createCombatObject()
    poison = createConditionObject(CONDITION_POISON)

Those 2 cannot be executed inside the main function, just move them above doPoison func
 
OP
fyalhed

fyalhed

Member
Joined
Nov 18, 2017
Messages
129
Reaction score
17
Lua:
    combat2 = createCombatObject()
    poison = createConditionObject(CONDITION_POISON)

Those 2 cannot be executed inside the main function, just move them above doPoison func

Oh, ty...
It almost work now, but idk why this almost...


print on console: [0.5-2.0]: 1.8
poison: 108

it should be
108

ok,

but second print 0.5
and first poison got 108

third prints [0.5-2.0]: 0.9
but also poison starts with 108

why?
Post automatically merged:

Oh, ty...
It almost work now, but idk why this almost...


print on console: [0.5-2.0]: 1.8
poison: 108

it should be
108

ok,

but second print 0.5
and first poison got 108

third prints [0.5-2.0]: 0.9
but also poison starts with 108

why?

I did

Code:
-- Poison
local combat2 = createCombatObject()
local poison = createConditionObject(CONDITION_POISON)
function DoPoison(cid)
setConditionParam(poison, CONDITION_PARAM_DELAYED, 15)
-- 10 ???
-- after 2 seconds start the poison
-- poison = skill / 2 ~ skill * 2
local skill = getPlayerSkillLevel(cid, SKILL_DISTANCE)
local from_half_to_double = (math.random(5, 20)) / 10
print("[0.5-2.0]: " .. from_half_to_double)
addDamageCondition(poison, 10, 2000, -(skill * from_half_to_double) )
setCombatCondition(combat2, poison)
end

function onUseWeapon(cid, var)
autoRechargeAmmo(cid)
DoPoison(cid)
doCombat(cid, combat2, var) -- applies the poison
return doCombat(cid, combat, var) -- applies the damage
end
 
Last edited:

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
4,755
Solutions
263
Reaction score
2,837
Did you wait for the first 'poison' to finish ticking, before applying the 2nd poison?

If not, it's possible that the 'stronger' poison stayed on the character instead of applying the weaker one.

In either case, you can figure out what's going on by simply adding more prints. xD

Lua:
-- Poison
local combat2 = createCombatObject()
local poison = createConditionObject(CONDITION_POISON)

function DoPoison(cid)
	setConditionParam(poison, CONDITION_PARAM_DELAYED, 15)
	-- 10 ???
	-- after 2 seconds start the poison
	-- poison = skill / 2 ~ skill * 2
	local skill = getPlayerSkillLevel(cid, SKILL_DISTANCE)
	local from_half_to_double = (math.random(5, 20)) / 10
	local poisonDamage = skill * from_half_to_double
	print("Skill: " .. skill .. " | from_half_to_double: " .. from_half_to_double .. " | poisonDamage: " .. poisonDamage)
	addDamageCondition(poison, 10, 2000, -poisonDamage)
	setCombatCondition(combat2, poison)
end

function onUseWeapon(cid, var)
	autoRechargeAmmo(cid)
	DoPoison(cid)
	doCombat(cid, combat2, var) -- applies the poison
	return doCombat(cid, combat, var) -- applies the damage
end
 
OP
fyalhed

fyalhed

Member
Joined
Nov 18, 2017
Messages
129
Reaction score
17
Did you wait for the first 'poison' to finish ticking, before applying the 2nd poison?

If not, it's possible that the 'stronger' poison stayed on the character instead of applying the weaker one.

In either case, you can figure out what's going on by simply adding more prints. xD

Lua:
-- Poison
local combat2 = createCombatObject()
local poison = createConditionObject(CONDITION_POISON)

function DoPoison(cid)
    setConditionParam(poison, CONDITION_PARAM_DELAYED, 15)
    -- 10 ???
    -- after 2 seconds start the poison
    -- poison = skill / 2 ~ skill * 2
    local skill = getPlayerSkillLevel(cid, SKILL_DISTANCE)
    local from_half_to_double = (math.random(5, 20)) / 10
    local poisonDamage = skill * from_half_to_double
    print("Skill: " .. skill .. " | from_half_to_double: " .. from_half_to_double .. " | poisonDamage: " .. poisonDamage)
    addDamageCondition(poison, 10, 2000, -poisonDamage)
    setCombatCondition(combat2, poison)
end

function onUseWeapon(cid, var)
    autoRechargeAmmo(cid)
    DoPoison(cid)
    doCombat(cid, combat2, var) -- applies the poison
    return doCombat(cid, combat, var) -- applies the damage
end


i atk 3 times

2 times the training monk blocked the damage
Code:
Skill: 50 | from_half_to_double: 0.6 | poisonDamage: 30
Skill: 50 | from_half_to_double: 0.6 | poisonDamage: 30

the last (3) damage it hits, so starts the poison
Code:
Skill: 50 | from_half_to_double: 1.9 | poisonDamage: 95

but the poison hits 30 instead of 95
 
OP
fyalhed

fyalhed

Member
Joined
Nov 18, 2017
Messages
129
Reaction score
17
i hit 4 times, 3 puffs (0 dmg), but the last make a damage
Code:
Skill: 50 | from_half_to_double: 0.9 | poisonDamage: 45
Skill: 50 | from_half_to_double: 1.9 | poisonDamage: 95
Skill: 50 | from_half_to_double: 1 | poisonDamage: 50
Skill: 50 | from_half_to_double: 1.2 | poisonDamage: 60

the last damage did 45 of poison
and every other atk make 45 of poison
why?
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
4,755
Solutions
263
Reaction score
2,837
I think you need combat2 to actually deal damage.

and/or its delay of 15 seconds is confusing you into thinking its not working as intended.

tbh I'm not sure how the script doesn't error since 'combat' doesn't exist.. Only combat2 exists
 
OP
fyalhed

fyalhed

Member
Joined
Nov 18, 2017
Messages
129
Reaction score
17
I think you need combat2 to actually deal damage.
what are u mean?

i didn't create this, i take this base:
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
4,755
Solutions
263
Reaction score
2,837
what are u mean?

i didn't create this, i take this base:
I give up trying to use your code as a base. lmao

Try this
Lua:
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)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
    local poisonDamage = (getPlayerSkillLevel(cid, SKILL_DISTANCE) * ((math.random(5, 20)) / 10)) * -1
    addDamageCondition(condition, 10, 2000, poisonDamage)
    return doCombat(cid, combat, var)
end

-- edit

Sorry, forgot to separate everything for you
here
Lua:
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)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
    local skill = getPlayerSkillLevel(cid, SKILL_DISTANCE)
    local from_half_to_double = (math.random(5, 20)) / 10
    local poisonDamage = (skill * from_half_to_double) * -1
    print("Skill: " .. skill .. " | from_half_to_double: " .. from_half_to_double .. " | poisonDamage: " .. poisonDamage)
    addDamageCondition(condition, 10, 2000, poisonDamage)
    return doCombat(cid, combat, var)
end
 
Top