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

Script

AnarchGov

Member
Joined
Oct 3, 2011
Messages
263
Reaction score
6
I need a lua script/formula that will make a specific weapons attack go up with the characters level. Not skill..think you guys could help me out with that?

Rep ++ Thanks guys.
 
You mean a real, specific, weapon attack's stat to change according to their level? Or do you want to give a global attack bonus (to all weapons..), so pretty much giving +XX bonus for skills then.

I think you want the first, but confirm it please.
It's done by changing it's attack stat once you equip it, resetting it when you de-equip it, refresh at level up.
 
You mean a real, specific, weapon attack's stat to change according to their level? Or do you want to give a global attack bonus (to all weapons..), so pretty much giving +XX bonus for skills then.

I think you want the first, but confirm it please.
It's done by changing it's attack stat once you equip it, resetting it when you de-equip it, refresh at level up.

Yes i'm looking for the first. I need the weapon to attack harder with each level the character gains. not so much with skill. Heres why: Right now the level of the character does not effect the weapons attack at all. So if you are level 8 with distance skills 120+ you hit WAYYY to hard. See what im saying? Also, knowing the second thing you mentioned wouldn't hurt either even though its not what i was asking for per say. I feel like it will bring me where i have been trying to go. HELPP.
Rep++
 
Last edited:
So is it for ALL weapons or just a selective group? I guess the second option would work as well if it's for ALL weapons.

Not to be a pain but could you explain them both to me? If you dont have time though, i only absolutely need it for a selective group. I need it specifically for a crossbow, a wand,axe and a sword. I have the weapons all set up, but the problem is that there damage output completely relies on the characters SKILL. I need it to be based on the characters LEVEL if possible. Also, the server i am currently running is 8.54 if that helps.
 
Please keep in mind that wands/rods do not have a direct 'attack' value, instead they are behind handled via a separate script.
It's easiest to start with your wand, so it would help to post the script attached to the wand here. (Weapons folder)
 
This is the script i use now:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
setCombatFormula(combat, COMBAT_FORMULA_LEVEL MAGIC, -4.3, -5, -4.4, 0)
function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end

Also, i forgot to mention now that we are focused on wands and rods. I am trying to make an enchanted staff work as a wand, i have't suceeded yet but i think ill get it. If you could help me with that as well would be great. But thats for a different time. This script has the attack based completely on skill and not level.
 
Instead of that script you can also try something like this. You have to edit the numbers tho, it'll scale on your level.

Code:
function onUseWeapon(cid, var)
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
local level = getPlayerLevel(cid)
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0)
return doCombat(cid, combat, var)
end
 
Instead of that script you can also try something like this. You have to edit the numbers tho, it'll scale on your level.

Code:
function onUseWeapon(cid, var)
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
local level = getPlayerLevel(cid)
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0)
return doCombat(cid, combat, var)
end

This did make the attack go up a little bit with level, however the skill level is still making more of a difference in the attack. Any suggestions as to how to change the numbers around? Remember im a noob lol. I also noticed that the hits are very random. Some 1k some 150 lol.
 
Last edited:
It's simple to explain this bit:
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0)
Pretty much the two bits that influence it are:
-50-level
and
-100-(level*2)

The first bit is minimum damage, the second bit maximum.
-50-(level*2)
and
-150-(level*2)
will give you 50-150 basic damage, + 2 extra damage (applied on both minimum and maximum) per level.
 
It's simple to explain this bit:
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0)
Pretty much the two bits that influence it are:
-50-level
and
-100-(level*2)

The first bit is minimum damage, the second bit maximum.
-50-(level*2)
and
-150-(level*2)
will give you 50-150 basic damage, + 2 extra damage (applied on both minimum and maximum) per level.
Ok i get it now. Ok well i tried it on a wand and it said it can only use this function when loading script. No file destination found.Idk man. Any ideas?
 
Last edited:
[14/02/2012 14:48:28] [Error - Weapon Interface]
[14/02/2012 14:48:28] data/weapons/scripts/attackformula.lua:onUseWeapon
[14/02/2012 14:48:28] Description:
[14/02/2012 14:48:28] (luaSetCombatFormula) This function can only be used while loading the script.

[14/02/2012 14:48:28] [Error - Weapon Interface]
[14/02/2012 14:48:28] data/weapons/scripts/attackformula.lua:onUseWeapon
[14/02/2012 14:48:28] Description:
[14/02/2012 14:48:28] (luaDoCombat) Combat not found

Thats the exact errors.
 
Last edited:
[14/02/2012 14:48:28] [Error - Weapon Interface]
[14/02/2012 14:48:28] data/weapons/scripts/attackformula.lua:onUseWeapon
[14/02/2012 14:48:28] Description:
[14/02/2012 14:48:28] (luaSetCombatFormula) This function can only be used while loading the script.

[14/02/2012 14:48:28] [Error - Weapon Interface]

[14/02/2012 14:48:28] data/weapons/scripts/attackformula.lua:onUseWeapon
[14/02/2012 14:48:28] Description:
[14/02/2012 14:48:28] (luaDoCombat) Combat not found

Thats the exact errors.

The one you gave me. The last one. I copied and pasted it.
 
Back
Top