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

[Spell] Spell Damage affected by variable stats? +Repping

Guitar Freak

_LüA_n☺b_
Joined
Dec 27, 2008
Messages
831
Reaction score
13
Location
Caracas, Venezuela
Hello, Ive been inactive these past months due to lack of time but when I get the chance I try not to lose practice on this and now I have a problem that I just cant seem to be able to solve.

This is the spell script for a normal spell:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, x, x, x, x)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

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

Now, in constant.lua we got this:
Lua:
COMBAT_FORMULA_UNDEFINED = 0
COMBAT_FORMULA_LEVELMAGIC = 1
COMBAT_FORMULA_SKILL = 2
COMBAT_FORMULA_DAMAGE = 3

In my case, none of these work.

Lets say I have an extra stat on all my players lets call it "whatever stat" and it is defined by a Storage Value.

So I want to know how can I make it so the spell hits based on THAT stat and not the common level/maglvl/skill/etc.

If you still dont understand, this is pretty much it ideally:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid, var)
doCreatureAddHealth(TARGET, -(getPlayerStorageValue(cid, whatever_stat_storage) * whatever_formula))
	return doCombat(cid, combat, var)
end

(this is ofc an example and it doesnt work this way)

So thats pretty much it, I have tried many things and I just cant understand how to do that TARGET part on a spell..

(It doesnt even have to be a spell if you know how to do it somehow else simulating it)

Ill be +repping helpful answers.
Thanks in advance.
 
Example of sudden death by storages;
Code:
local combat =  createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(cid, level, maglevel)
	local min = -getPlayerStorageValue(cid, 1337) * value
	local max = -getPlayerStorageValue(cid, 1337) * value
	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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