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

Manarune

8408323

Hoster
Joined
Mar 6, 2009
Messages
432
Reaction score
26
I've been trying to create a manarune script to my server, however I encounter some problems..

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
function onGetFormulaValues(cid, level, maglevel)
	local min = (getCreatureMaxMana(cid) / 100) * 4
	local max = (getCreatureMaxMana(cid) / 100) * 8
	return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
 
function onCastSpell(cid, var)	
	return doCombat(cid, combat, var)
end

When I change "getCreatureMaxMana" to "getCreatureMaxHealth" it turns into a healing rune, and then it works, I don't really understand why it doesn't work!
Anyone that can help me out?

Kind Regards,
8408323
 
Code:
Infinite Manarune.lua:onUse
Description:
LuaScriptInterface::luaSetCombatCallBack This function can only be used while loading the script.

I got this error now, do I really need to have a
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
to make it work? I've tried, but it still give the same error now..
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
function onGetFormulaValues(cid, level, maglevel)
	local min = (getPlayerMaxMana(cid) / 100) * 20
	local max = (getPlayerMaxMana(cid) / 100) * 30
	return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
 
function onCastSpell(cid, var)	
	return doCombat(cid, combat, var)

end
end

That's how it looks like now, i'm trying to create an action out of it. Sorry for being such a noob that didn't understand that..
 
Now you have a spell and an action together. If you want to make an action script, only use function onUse. Combats and conditions should go above the function, but with an action script, you can't use a combat, so you have to use doPlayerAddMana or doCreatureAddHealth.
Maybe this is usefull as example: http://otland.net/f81/manarune-heals-maxmana-160273/
 
Back
Top Bottom