Is there a way to make my own combat formula using only LUA? something like this:
I don't know if i can get the weapon attack from var parameter
data\weapons\scripts\weapon_name.lua
I don't know the functions to get each value that i need and i don't found a documentation of every function with its parameters. This is what i tried:
Edit:
My Server
I don't know if i can get the weapon attack from var parameter
data\weapons\scripts\weapon_name.lua
Lua:
function onUseWeapon(cid, var)
local player
local target
local damage = player.weapon.attack + player.level * 2 - target.armor
target.hp -= damage
return true
end
I don't know the functions to get each value that i need and i don't found a documentation of every function with its parameters. This is what i tried:
Lua:
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local weapon_attack = 7 -- How to get this value?
local target_armor = 2 -- How to get this value?
local minDamage = weapon_attack + getPlayerLevel(cid) * 2 - target_armor
local maxDamage = minDamage * 1.2
if math.random(100) <= 30 then
minDamage = minDamage * 3.5
maxDamage = maxDamage * 3.5
doCreatureSay(target, "Critical Strike!", TALKTYPE_MONSTER)
end
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -minDamage, -maxDamage, CONST_ME_NONE)
return true
end
Edit:
My Server
Last edited: