soul4soul
Intermediate OT User
code:
im not sure whats wrong anymore i tried a lot of different things and i was testing the variables they all have the correct set values. i even tried using tonumber to make sure levelforumla is a number
error:
Code:
--[[
** Weapons with Levels V3.0 by Soul4Soul**
]]--
function onKill(cid, target)
local playerWeapon = getPlayerWeapon(cid, TRUE)
if(playerWeapon.itemid == 0) then
return true
end
local add = 2
local currentExtraAttack = getItemAttribute(playerWeapon.uid, "extraattack")
if currentExtraAttack == nil then
currentExtraAttack = 0
end
local levelforumla = math.ceil(currentExtraAttack+2+math.sqrt(currentExtraAttack))
if(playerWeapon.actionid ~= 0) then
if((playerWeapon.actionid-1000) >= levelformula) then
doItemSetAttribute(playerWeapon.uid, "extraattack", currentExtraAttack + add)
ddoSendAnimatedText(getCreaturePosition(cid), "Congratulations! Your weapon received +" ..add.. " attack points and now have total extra damage of +" .. getItemAttribute(playerWeapon.uid, "extraattack") .. " points!", TEXTCOLOR_WHITE)
doItemSetAttribute(playerWeapon.uid, "description", "")
else
doItemSetAttribute(playerWeapon.uid, "aid", playerWeapon.actionid + 1)
doItemSetAttribute(playerWeapon.uid, "description", "["..(playerWeapon.actionid-1000).."/"..levelformula.." ]")
end
else
doItemSetAttribute(playerWeapon.uid, "aid", 1001)
doItemSetAttribute(playerWeapon.uid, "description", "[1/"..levelformula.." ]")
end
return true
end
error:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/weaponadvance.luanKill
Description:
data/creaturescripts/scripts/weaponadvance.lua:29: attempt to concatenate global
'levelformula' (a nil value)
stack traceback:
data/creaturescripts/scripts/weaponadvance.lua:29: in function <data/cre
aturescripts/scripts/weaponadvance.lua:5>
[Error - CreatureScript Interface]
data/creaturescripts/scripts/weaponadvance.luanKill
Description:
data/creaturescripts/scripts/weaponadvance.lua:19: attempt to compare nil with n
umber
stack traceback:
data/creaturescripts/scripts/weaponadvance.lua:19: in function <data/cre
aturescripts/scripts/weaponadvance.lua:5>
Last edited: