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

Solved Help with arrow script

Kubus93

New Member
Joined
Oct 14, 2014
Messages
29
Reaction score
1
Hi
How can I to set script that arrows deal damage to a certain limit?
I mean that damage will increase with the level and skills but do not have to damage one another too much difference, for example: at 100 level 600-750hp and not as now from 7-1400hp. In short, so it was not such a large difference between the maximum and minimum injury. I think I described it well.

c arrow.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SHIVERARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 7, 0, 1, 0)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 1000, -200)
setCombatCondition(combat, condition)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 3, 1000, -125)
setCombatCondition(combat, condition)

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

weapons.xml
Code:
<distance id="2352" level="8" range="8" enabled="1" exhaustion="0" hitchance="100" ammo="removecount" script="crystal.lua">
        <vocation id="3"/>
        <vocation id="7" showInDescription="0"/>
    </distance>

items.xml
Code:
</item>
            <item id="2352" article="a" name="crystal arrow" plural="crystal arrow">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ammo"/>
        <attribute key="hitChance" value="100" />
        <attribute key="attack" value="105" />
        <attribute key="weaponType" value="ammunition"/>
        <attribute key="ammoType" value="arrow"/>
        <attribute key="shootType" value="arrow"/>
    </item>
 
Last edited:
You can make a calculation with this (use it instead of setCombatFormula(combat, COMBAT_FORMULA_SKILL, 7, 0, 1, 0)).
Code:
function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 0.01 * (attack * skill + (level/5))
     local max = 0.08 * (attack * skill + (level/5))
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

You can make the difference between min and max less or if you want level to have less influence you can do you example level/10.
 
Last edited:
I paste this and arrow stop working, mean hit but without any dmg.
I make it right? if not where i can paste this and what delete?

Code:
local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SHIVERARROW)
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 0.05 * (attack * skill + (level/5))
     local min = 0.08 * (attack * skill + (level/5))
     return -min, -max
end


local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 1000, -200)
setCombatCondition(combat, condition)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 3, 1000, -125)
setCombatCondition(combat, condition)

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

Btw, when writing the part I posted, I forgot to change min to max when I copied the local min line, edited.
So you have to change that aswell.
 
Still not working, what i do wrong?
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SHIVERARROW)
function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 0.01 * (attack * skill + (level/5))
     local min = 0.08 * (attack * skill + (level/5))
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 1000, -200)
setCombatCondition(combat, condition)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 3, 1000, -125)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
And in console is Lua script Error:[weapon interface]
 
Its work! thanks so much! :)

And i have one more question..when lvl and skills grow up, dmg too?: for clear;p
 
Last edited:
You can make the influence of level higher with for example level/3.
Or if you want to make the influence of skill more, you can do something like this.
Code:
local min = 0.01 * (attack * (skill * 1.5) + (level/5))
 
The attack should then the player grows leve, because on the formula that comes with the code that Limos wrote, the attack depeneds also on Level of the character:

local max = 0.08 * (attack * skill + (level/5))
 
Its still the same even when i add 1000lvl and i change a few times level/2, level/100 level,50 still the same. Its must be something other
 
/ is like :, so it makes it less, level/2 will be a higher number than level/100.
If someone is level 100, with level/2 the extra damage will be 50 (x 0.01-0.08), with level/100 the extra damage will be 1 (x 0.01-0.08).
If you want level to have a big effect on the damage, you can also do level * 2, which is like x (100 x 2).
 
I try very diffrent combination and still nothing . U have any idea?
But when here
"local min = 0.06 * (attack * (skill * 1.5) + (level*2))
local max = 0.08" i paste more number for example 1.0 and 1.5 dmg is more but no growe with lvl or


EDIT. Maybe i should past this "setCombatFormula(combat, COMBAT_FORMULA_SKILL, 7, 0, 1, 0)" and try change this numbers..so anyone knows for what responsible is each numbers?
 
Last edited:
What is your level and skill and what is the average damage?
If the damage is really high, then this amount of extra damage from level and skill will barely be visible.
 
First i try on 8 lvl 10 skill dmg = 10-13
next 100lvl 10 skill dmg= 10-13
100lvl 100skill -still I change min and max for 10.0 ,11.0 the same but dmg 1000-1400
 
Can you post the script how it looks now with the changes? Did you save the script and restarted the server after you made the changes?
 
Of course I save and restart
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SHIVERARROW)
function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 0.06 * (attack * (skill * 1.5) + (level*2))
     local max = 0.08 * (attack * (skill * 1.5) + (level*2))
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 1000, -200)
setCombatCondition(combat, condition)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 3, 1000, -125)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
 
How much extra damage should skill and level give? I forgot to mention that the total damage is x 0.08, so the level and skill amount is not added to the damage in that amount.
 
Back
Top