• 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 Mana Heal display.

kirrebati

New Member
Joined
Jan 27, 2011
Messages
114
Reaction score
1
Hi,
I'm using OTServ 8.60 r.6052 server and in the Config file I found this:
--Displays amount of health healed.
--Similar to the way damage is shown, except in green numbers (Example: +17) [default: "no"]
show_healing = true

As it says, it shows the amount of health healed when you use a health potion or a health rune.

To the point,
I was wondering if there was any kind of way to make it so it displays the amount of mana you heal when you use a mana potion or spirit potion.
I'm a real noob in this but I've tried to change some things like instead of --Displays the amount of Health healed, I replaced Health with Mana. And it didn't work (exactly what my expectation was). Lol yep I'm a noob but in need of help.

Thanks in advance,
kirrebati
 
the effect that makes you see the health gained is in sources, but you can easily do the same thing for mana potions in LUA

open your potions.lua
search for something that says doPlayerAddMana or doCreatureAddMana and add it there, in my case(your code might not be like the one I have):

Code:
	...
	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * potion.multiplier.mana))) then
		return false
	end
	doSendAnimatedText(getCreaturePosition(itemEx.uid), "+" .. mana, COLOR_PURPLE) --<<<<<<<<<
	...

now when I use a mana potion in myself or in another person, it'll show "+X"(X being ammount healed) in purple :)
 
I dont get it, where do I find potions.lua? I only have liquids folder (data>actions>scripts>liquids) with mana potions... and there doesnt say anything about AddMana only other stuff that is similar to that like DoCreatureSay and so on.
 
Ok this is normal mana potion. Btw I don't use MySQL haven't even learned that didn't even know what that was until 1 sec ago... I just downloaded a server and unzipped it and started open xml and lua files with notepad. Is that bad? Anyways here is the code for normal Mana Potion:

Code:
local MIN = 70
local MAX = 130
local EMPTY_POTION = 7636

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, MIN, 0, MAX, 0)

local exhaust = createConditionObject(CONDITION_EXHAUST_POTION)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('minactionexinterval'))

function onUse(cid, item, frompos, item2, topos)
	if(isPlayer(item2.uid) == false)then
		return false
	end

	if(hasCondition(cid, CONDITION_EXHAUST_POTION) ) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if not doCombat(cid, combat, numberToVariant(item2.uid)) then
		return false
	end

	doAddCondition(cid, exhaust)
	doCreatureSay(item2.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
	doPlayerAddItem(cid, EMPTY_POTION, 1)
	return true
end
 
Code:
local MIN = 70
local MAX = 130
local EMPTY_POTION = 7636
local EXHAUST_STORAGE = 7637
local EXHAUST_TIME = ([FONT=monospace]getConfigInfo('minactionexinterval') / 1000) --I think that minactionexinterval is set by milliseconds, so you have to change it to seconds[/FONT]


function onUse(cid, item, frompos, item2, topos)
	if(isPlayer(item2.uid) == false)then
		return false
	end


	if getPlayerStorageValue(cid, EXHAUST_STORAGE) >= os.time() then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end
	local heal = math.random(MIN, MAX)
	doPlayerAddMana(item2.uid, heal)
	doSendAnimatedText(getCreaturePosition(item2.uid), "+"..heal, COLOR)
	doCreatureSay(item2.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
	doPlayerAddItem(cid, EMPTY_POTION, 1)
	setPlayerStorageValue(cid, EXHAUST_STORAGE, os.time() + EXHAUST_TIME)
	return true
end

this should work
if you don't want to basically change your hole mana potion.lua, you have to source edit
 
It didn't work... instead of Purple color it was black color and it came some kind of error on my server cmd. Integer something... well nevermind, I give up. Thanks for your help.
 
Back
Top