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

set storagevalue upon rune use

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
How would I go about setting a storage value like

doPlayerSetStorageValue(cid, 16000, +1)

upon the use of a single charge of a rune? Like shooting one shot of a light magic missile would increase the storage value by 1.
 
LUA:
doCreatureSetStorage(cid, 16000, math.max(getCreatureStorage(cid, 16000), 0) + 1)
 
So, how do you put it in a spell script. My LMM looks like this

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, -10, 5, 5, 0.6, 1, -10, -20)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
		doCreatureSetStorage(cid, 16000, math.max(getCreatureStorage(cid, 16000), 0) + 1)
end
and the rune will not fire at all.
 
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, -10, 5, 5, 0.6, 1, -10, -20)
 
function onCastSpell(cid, var)
	local ret = doCombat(cid, combat, var)
	if (ret ~= false) then
		doCreatureSetStorage(cid, 16000, math.max(getCreatureStorage(cid, 16000), 0) + 1)
	end
	
	return ret
end
 
Back
Top