• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua NPC That sells health and mana?

I don't have any idea how to make it with NPC... But with items is pretty easy, just use:

LUA:
setCreatureMaxHealth
setCreatureMaxMana
 
LUA:
local extraHealth = 100
local extraMana = 100

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 2156 then -- red gem	
		setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + extraHealth)
		doCreatureAddHealth(cid, extraHealth)
		doPlayerSendTextMessage(cid, 19, "You got " .. extraHealth .. " more health.")		
	elseif item.itemid == 2153 then -- violet gem	
		setCreatureMaxMana(cid, getCreatureMaxMana(cid) + extraMana)
		doPlayerAddMana(cid, extraMana)
		doPlayerSendTextMessage(cid, 19, "You got" .. extraMana .. " more mana.")		
	end
	return true
end
That should work I think, you can add it Storage or whatever you want :P


@EDIT:
we use the same functions for everything bro :D so it's the same in both.

Really? I'm gonna try that :O
 
Back
Top