• 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!

Lua Increase mana cost with each cast

Albanon

New Member
Joined
Mar 5, 2011
Messages
93
Reaction score
1
I'd like to take a simple spell like energy strike



Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end


and make it so that if you do not wait 5 seconds before casting it again it will drain twice as much mana the second time you cast it, and then, twice as much mana again the third, and then the fourth, and fifith ect

but I am not sure how to go about doing something like that


so, lets say it costs 2 mana to cast the first time, you cast it....then you decide to spam it over and over - 2 becomes 4, 4 becomes 8, 8 becomes 16, 16 becomes 32, and it just keeps adding up - then after 5 seconds, it goes back down to 2 mana again
 
Im not sure what you mean
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

function onCastSpell(cid, var)
local cast = 0
local mana = doCreatureAddMana(cid, -20 )



if cast == 0 then
doCreatureAddMana(cid, -20 )
cast = cast + 1
return doCombat(cid, combat, var)

elseif cast == 1 then
cast = cast + 1
doCreatureAddMana(cid, -40 )
doBroadcastMessage(cast, type)
return doCombat(cid, combat, var)










end

This doesn't really work, im not sure of a better way to do it though, maybe with a loop?

but how would I Factor in time?

would you explain how I would use storages?
 
Last edited:
Back
Top