• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Boolean value

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
Error:
Code:
[25/2/2014 23:19:51] [Error - Spell Interface] [25/2/2014 23:19:51] In a callback: data/spells/scripts/attack/domesticated plant.lua:onGetFormulaValues
[25/2/2014 23:19:51] (Unknown script file)
[25/2/2014 23:19:51] Description:
[25/2/2014 23:19:51] data/spells/scripts/attack/domesticated plant.lua:7: attempt to perform arithmetic on a boolean value

Script:
Code:
local combat = createCombatObject()setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)


function onGetFormulaValues(cid, level, skill, attack, factor)
  return -((attack/100*1)+(getPlayerSkillLevel(cid, 7)/100*10)+(level*1.1)), -((attack/100*1)+(getPlayerSkillLevel(cid, 7)/100*20)+(level*1.2))
end


setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onCastSpell(cid, var)
  local castHp = 2
    if getCreatureHealth(cid) > castHp then
      doCreatureAddHealth(cid, -castHp)
      addEvent(doCombat, 0, cid, combat, var)
    else
      doPlayerSendCancel(cid, "You must have at least ".. castHp .." hitpoints.")
    end
  return TRUE
end
 
Code:
local combat = createCombatObject()setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 123)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 5)


function onGetFormulaValues(cid, level, skill, attack, factor)


    local min = -((attack/100*1)+(getPlayerSkill(cid, 6)/100*10)+(level*1.1))
    local max = -((attack/100*1)+(getPlayerSkill(cid, 6)/100*20)+(level*1.2))
  
  return min, max
end


setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onCastSpell(cid, var)
  local castHp = 2
    if getCreatureHealth(cid) > castHp then
      doCreatureAddHealth(cid, -castHp)
      addEvent(doCombat, 0, cid, combat, var)
    else
      doPlayerSendCancel(cid, "You must have at least ".. castHp .." hitpoints.")
    end
  return TRUE
end

Firstly, I'm not a pro scripter, so expect i can be wrong.
So far I tested, the getPlayerSkill can't get higher skill than 6. For 6 it's working for me as above. I guess you wanted to take magic level as skill 7, to do that change
Code:
getPlayerSkill(cid, 6)
to :
Code:
getPlayerMagLevel(cid)
and it should be working.
 
Players have 7 skills: fist, club, sword, axe, dist, shield and fishing. However, they are numbered from 0 to 6, not 1 to 7.

You write getPlayerSkillLevel(cid, 7), Classic Tibia haven't skill with ID 7.
 
Back
Top