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

Healing Basin

mikkelseen

Klockan 7
Joined
Oct 10, 2010
Messages
26
Reaction score
2
Location
HARDCORE GAMING ;OOOOOO
Heylo! I would like to have an script, that when you right click on an item, for example the small basin, ID 1378. You get full HP and Mana, is that possible?

Thanks.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if item.itemid == 1378 then 
        doPlayerSendTextMessage(cid,21,"You gained full HP and MP!") 
        getCreatureMaxHealth(cid)
        getCreatureMaxMana(cid)
end 
    return TRUE 
end
 
Last edited:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if item.itemid == 1378 then 
        doPlayerSendTextMessage(cid,21,"You gained full HP and MP!") 
        getCreatureMaxHealth(cid)
        getCreatureMaxMana(cid)
end 
    return TRUE 
end


You are just getting the values, the only thing will happen in-game, is the message, wish will be displayed to te player. Let me try it

Create a lua file named healing basin.lua, then, put that code on it:
Lua:
function onUse(cid, item, frompos, item2, topos)

local msg = "You restored all your healthpoints and manapoints."
local hp = getCreatureMaxHealth(cid)
local mana = getCreatureMaxMana(cid)
local ppos = getCreaturePosition(cid)

       doCreatureAddHealth(cid, hp)
	 doCreatureAddMana(cid, mana)

  doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, msg)
   doSendMagicEffect(ppos, 12)
   doSendMagicEffect(frompos, 1)
	
end

And put that in actions.xml
PHP:
<action itemid="1378" event="script" value="healing basin.lua"/>

PS: It can be enchanced
Hope it works :)
 
Last edited:
There, enhanced.

healingbasin.lua:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local hp = getCreatureMaxHealth(cid)
	local mana = getCreatureMaxMana(cid)
	local position = getCreaturePosition(cid)
	local value = math.random(1, 255)
		doCreatureAddHealth(cid, hp)
		doCreatureAddMana(cid, mana)
		doSendMagicEffect(position, CONST_ME_HEARTS)
		doSendMagicEffect(frompos, CONST_ME_LOSEENERGY)
		doSendAnimatedText(cid, HP/MP MAX!, value)

	return true
end

In actions.xml:
Code:
<action actionid="1378" event="script" value="healingbasin.lua"/>

It's better if you use actionid instead of itemid here.
 
Last edited:
Back
Top