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

Mana/Hp shop(rep++)

Zuxus

Learning C++ and Lua
Joined
Jul 2, 2007
Messages
108
Reaction score
0
Location
Norway
I am looking for an npc that sells hp and mana. The one that buys mana or hp will increase his/hers maximum hp/mana permanently. Is this possible? If so can anyone make one?

Thanks in advance(rep++)
 
I am looking for an npc that sells hp and mana. The one that buys mana or hp will increase his/hers maximum hp/mana permanently. Is this possible? If so can anyone make one?

Thanks in advance(rep++)

What TFS are you using? And, do you know how to compile sources?

In TFS 0.2 you have to make new functions for that, so you need to modify the sources and compile it, I have the necesary codes made by goosio but I never got to test them because I wasnt able to compile, but Im sure they work.

Here is the thread if anyone is interested:
http://otland.net/f133/forgotten-server-0-2-22-new-function-addcreaturemaxhp-22101/#post228218

As for newer TFS versions like 0.3.2 (the one Im using now), Im not quite sure if the function is added already or if you have to make them too, Ive searched for it but no luck. Havent had too much time either.

We would need a pro's opinion and expertise in this matter, and Im nowhere near that :p

Im hoping for an answer aswell, since Ive wanted this feature for ages now.

Cheers~
 
As I wasn't aware of the matter, if it existed or not, I figured I could try it out. What I tried to do was to create healing puffs with it, but it seems it didn't work properly. Anyways, I'm heading to school any minute now so if anyone would like to investigate the matter even further, here's my script : )
PHP:
addEvent(healingPuffs, 5000, {cid = cid , health = 10 , id = 0})
PHP:
function healingPuffs(parameters)
    local cid = parameters.cid
    local health = parameters.health
    local id = parameters.id + 1
    
    if id < 10 then
        doSendAnimatedText(getCreaturePosition(cid), health, TEXTCOLOR_GREEN)
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + health)
        doSendMagicEffect(getCreaturePosition(cid), 12)
        addEvent(healingPuffs, 2000, {cid = cid , health = 10 * id , id = id})
    end
    return TRUE
end
 
setCreatureMaxHealth(cid, health)
setCreatureMaxMana(cid, mana)

I don't have time now for NPC, but here you have simple talkaction: (!buyhp + !buymana)

Code:
local config = {
	healthCost = 50000,
	healthAmount = 100,
	manaCost = 70000,
	manaAmount = 100
}

function onSay(cid, words, param)
	local fSet, fGet, fAdd = setCreatureMaxHealth, getCreatureMaxHealth, doCreatureAddHealth
	local cost, amount = config.healthCost, config.healthAmount
	local str = "health"

	if(words == "!buymana") then
		fSet, fGet, fAdd = setCreatureMaxMana, getCreatureMaxMana, doCreatureAddMana
		cost, amount = config.manaCost, config.healthAmount
		str = "mana"
	end

	if(doPlayerRemoveMoney(cid, cost) ~= TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you dont have enough money.")
		return TRUE
	end

	fSet(cid, fGet(cid) + amount)
	fAdd(cid, amount)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought " .. amount .. " " .. str .. " points.")
	return TRUE
end

talkactions.xml
Code:
<talkaction words="!buyhp" script="buy_hpmana.lua"/>
<talkaction words="!buymana" script="buy_hpmana.lua"/>
 
Last edited:
I noticed that by adding doCreatureAddHealth(cid, getCreatureMaxHealth(cid), TRUE) after the setCreatureMaxHealth() function, it will automatically update your healthbar instead of you having to logout and login.
 
Back
Top