Nikkster
Programmer
Hello, in the following days I have recieved small lags when players are using the VIP manarune. I'm getting a couple of errors when someone is using it in the server starter (The logs).
[05/03/2009 11:13:15] Lua Script Error: [Spell Interface]
[05/03/2009 11:13:15] data/spells/scripts/custom/donated manarune.lua
nCastSpell
[05/03/2009 11:13:16] luaDoTargetCombatCondition(). Condition not found
05/03/2009 11:14:04] Lua Script Error: [Spell Interface]
[05/03/2009 11:14:05] data/spells/scripts/custom/donated manarune.lua
nCastSpell
[05/03/2009 11:14:05] luaDoTargetCombatCondition(). Condition not found
~~ Something like this. Here's my vip manarune script:
In items.xml
In: Data - Spells - Custom - donated manarune
[05/03/2009 11:13:15] Lua Script Error: [Spell Interface]
[05/03/2009 11:13:15] data/spells/scripts/custom/donated manarune.lua
[05/03/2009 11:13:16] luaDoTargetCombatCondition(). Condition not found
05/03/2009 11:14:04] Lua Script Error: [Spell Interface]
[05/03/2009 11:14:05] data/spells/scripts/custom/donated manarune.lua
[05/03/2009 11:14:05] luaDoTargetCombatCondition(). Condition not found
~~ Something like this. Here's my vip manarune script:
In items.xml
Code:
<item id="2299" article="a" name="VIP Manarune">
<attribute key="weight" value="120"/>
</item>
In: Data - Spells - Custom - donated manarune
Code:
-- >>CONFIG<< --
local MIN_MANA_GAIN = 500 -- How much is the lowest mana you can possibly gain (If your heal less than that amount of mana you will get that mana instead) ?
local MIN_MANA_RAND = 1500 -- The minimum amount of mana to be given (random)
local MAX_MANA_RAND = 3000 -- The maximum amount of mana to be given (random)
local ACCEPT_LUCK = true -- Should it be possible to get lucky and receive extra mana? true, false
local MAG_LEVEL_MULTI = 2 -- How many times should Magic Level be multiplied, to be added to the mana formula? 1 = same, 0 = nothing etc
local LEVEL_MULTI = 2 -- How many times should Level be multiplied, to be added to the mana formula? 1 = same, 0 = nothing etc
local MAGIC_EFFECT = CONST_ME_MAGIC_BLUE -- Magic effect that will be casted on the player each time it heals the mana.
local ANIMATION_COLOR = 41 -- What animation color will there be when you heal (Comes over player showing how much mana you healed) 1 - 255 (?)
local HEAL_TIMES = 3 -- How many times should you be healed when using the manarune once? Atleast 1
local FIRST_HEAL_DELAY = 0 -- How long time will it take before it heals FIRST time? In milliseconds
local HEAL_DELAY = 1000 -- How long time will it take before it heals one? In milliseconds
-- >>CONFIG<< --
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, HEAL_TIMES * HEAL_DELAY + FIRST_HEAL_DELAY)
function onCastSpell(cid, var)
doTargetCombatCondition(0, cid, exhaust, CONST_ME_NONE)
local function doHealMana(parameters)
local random = math.random(MIN_MANA_RAND, MAX_MANA_RAND)
if ACCEPT_LUCK == true then
local luck = math.random(1, 100)
if luck >= 90 then
random = random * 2
elseif luck == 50 then
random = random * 3
end
end
local formula = (getPlayerLevel(cid) * LEVEL_MULTI) + (getPlayerMagLevel(cid) * MAG_LEVEL_MULTI) + random
local manaGain = math.max(MIN_MANA_GAIN, formula)
doPlayerAddMana(cid, manaGain)
doSendAnimatedText(getPlayerPosition(cid), manaGain, ANIMATION_COLOR)
doSendMagicEffect(getPlayerPosition(cid), MAGIC_EFFECT)
doCombat(parameters.cid, parameters.combat, parameters.var)
end
local times = HEAL_TIMES
local parameters = {cid = cid, combat = combat, var = var}
while times > 0 do
if times == HEAL_TIMES then
addEvent(doHealMana, FIRST_HEAL_DELAY, parameters)
else
addEvent(doHealMana, HEAL_DELAY * times, parameters)
end
times = times - 1
end
end