• 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 What's wrong with this script?

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION)

function onGetFormulaValuesOne(cid, level, maglevel) --One is healing
	local min = doCreatureAddHealth(cid, 1)
	local max = doCreatureAddHealth(cid, 2)
	return -min, -max
end

function onGetFormulaValuesTwo(cid, level, maglevel) --Two is damage
	local min = 1
	local max = 2
	return -min, -max
end
 
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValuesOne") --healing
 
 
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValuesTwo") --damage
 
	return doCombat(cid, combat, var)
end

It is in my weapons/scripts folder and does work, but only for damage. It is supposed to heal you 1-2 hp every time you attack, but it doesn't heal the monster or the player, how come?
 
You cannot add 2 callbacks of the same type.
Also, you would need to create an additional combat there.

How about just adding doCreatureAddHealth(cid, math.random(1, 2))?
 
Back
Top