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

Click on fountain and gain mana and health?

kokosal

New Member
Joined
Feb 21, 2010
Messages
115
Reaction score
0
Can somebody please tell me how I can make so you click on a fountain and then you gain mana and health?

Btw, Ive searched the forum and all I found was a thing that only gave you mana and not health.
 
This:
Lua:
function onUse(cid, item, frompos, item2, topos)
	local formulas = {
	hMin = 100,
	hMax = 200,
	mMin = 100,
	mMax = 200
	}	
	local basins = {
		limit = 600
	}
	if os.time(t) > getPlayerStorageValue(cid, 30025) then
		doCreatureAddHealth(cid, math.random(formulas.hMin, formulas.hMax)
		doCreatureAddMana(cid, math.random(formulas.mMin, formulas.mMax)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, 30025, (os.time(t) + basins.limit))
	else
		doPlayerSendCancel(cid, 'You may drink from basins only once per 10 minutes!')
	end
	return TRUE
end
basins = seconds to use again..
hMin, hMax.... they are health min and health max that will add
mMin, mMax..... they are mana min and mana max that will add

hope i helped ;)
 
With reg:

healingfontain.lua:

Lua:
 local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 60 * 60 * 60)
setConditionParam(condition, CONDITION_PARAM_MANAGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_MANATICKS, 3000)
setCombatCondition(combat, condition)

-- Exhaustion Settings
local useExhaust = true
local storageValue = 103546
local exhaustTime = 1 * 60 -- 1 minute

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1360 or item.itemid == 1361 or item.itemid == 1363 or item.itemid == 1364 or item.itemid == 1365 or item.itemid == 1366 or item.itemid == 1367 or item.itemid == 1370 or item.itemid == 1371 or item.itemid == 1372 or item.itemid == 1373 or item.itemid == 1374 or item.itemid == 1375 or item.itemid == 1376 or item.itemid == 1377 or item.itemid == 1378 then
		if (useExhaust and isExhausted(cid, storageValue, exhaustTime) == FALSE) then
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) / 100 * 3) -- add health in percent
			doCreatureAddMana(cid, getCreatureMaxMana(cid) / 100 * 5) -- add mana in percent
			doSendAnimatedText(getCreaturePosition(cid), "Aaaah...", math.random(01,255))
			doSendMagicEffect(getCreaturePosition(cid), 14)
			setExhaust(cid, storageValue)
			doAddCondition(cid, condition)
		else
			doPlayerSendCancel(cid, "You not thirsty anymore. You will be thirsty after 1 min.")
		end
	end
end

action.xml:

XML:
 	<action actionid="46050" event="script" value="healingfontain.lua"/>

paste this at the buttom of the file.../data/lib/050-functions.lua:

Lua:
function setExhaust(cid, storage)
	setPlayerStorageValue(cid, storage, os.time())
end
 
function isExhausted(cid, storage, exhaust)
	local exhaustTime = getPlayerStorageValue(cid, storage)
	if exhaustTime == -1 then
		return FALSE
	end
	local isExhausted = os.time() - exhaustTime < exhaust
	return isExhausted and TRUE or FALSE
end

Pic:
 
Last edited:
Let him learn by himself. Let him figure out by himself.
He requested the script. Not to request the script with lua explainations.. Like this local heals the player. Blablabla
 
Back
Top