Hi, I have such a script on manarune:
And he wants to make separate values for each vocation.
The problem is, I don't know why, but it prints the min and returns me nil
Lua:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target == nil or not target:isPlayer() then
return true
end
if player:getCondition(CONDITION_EXHAUST_HEAL) then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return true
end
local level = getPlayerLevel(target)
local magLevel = getPlayerMagLevel(target)
if getPlayerVocation(target) == 4 then
local min = (level * 1.5) + (magLevel * 2.5) - 0
local max = (level * 1.7) + (magLevel * 2.7)
else
local min = (level * 1.5) + (magLevel * 2.5) - 0
local max = (level * 1.7) + (magLevel * 2.7)
end
print(min)
local itemId = item:getId()
if itemId == 2272 then
if target == player then
doTargetCombatMana(0, target, min, max, CONST_ME_MAGIC_BLUE)
elseif not doTargetCombatMana(0, target, min / 2, max / 2, CONST_ME_MAGIC_BLUE) then
return false
end
player:addCondition(exhaust)
target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
item:remove(1)
end
return true
end
And he wants to make separate values for each vocation.
The problem is, I don't know why, but it prints the min and returns me nil