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

IDEA! Make potion with own mana value - Spell + Item

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello there dear OtLand'ers i have a request. Maybe someone could help me :(

Im requesting spell for making potion with own mana value

Using this spell you could make mana potions with your mana value what you putted in.
Ex. You write: create mana potion "350
After this you creating potion with 350 mana inside (you lose the 350 mana for creating potion of course)
the "350" is the mana value that potion will have. After drink you will receive 350 mana :)

In short:
I need a spell script which allows me to creating own mana potion with own mana value
ex. create mana potion "350 - this will create potion with 350 mana inside it.

Anyone could do that for me?
I'll be glad if someone can help me :)
Thanks in advance.
 
I mean you can create potion with custom value of mana that you entered after " .
ex. create mana potion "350 - that will create potion what contains 350 mana
create mana potion "1 - that will create potion what contains 1 mana
etc..
 
Just use the spell to create an item with an item attribute x and then in the mana potion script, check if it has attribute x and if it does, heal mana(attributex) Pretty simple to make really.
 
I would need your functions list for that server if you really want me to make it for you. It would be best to try to do it yourself and post here when you are confused, but if you give me a functions list I will make it for you.
 
Code:
<talkaction words="create manapotion" filter="word-spaced" event="script" value="ownpotions.lua"/>
Code:
local potions = {
     [{1, 100}] = 7620,
     [{100, 500}] = 7589,
     [{500, 100000}] = 7590
}

function onSay(cid, words, param)
     if param == "" then
         return doPlayerSendCancel(cid, "Missing amount.")
     end
     local amount = tonumber(param)
     if amount and amount > 0 and amount < 100000 then
         for a, p in pairs(potions) do
             if amount >= a[1] and amount < a[2] then
                 if getPlayerMana(cid) >= amount then
                     doPlayerAddMana(cid, -amount, false)
                     local item = doPlayerAddItem(cid, p, 1)
                     doItemSetAttribute(item, "aid", amount + 100)
                     doItemSetAttribute(item, "description", "It contains "..amount.." mana.")
                     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
                 else
                     doPlayerSendCancel(cid, "You don't have enough mana.")
                 end
             end
         end
     else
         doPlayerSendCancel(cid, "Invalid amount.")
     end
     return true
end

Add in potions.lua under where it checks for exhaustion.
Code:
if item.actionid > 100 then
     doPlayerAddMana(itemEx.uid, item.actionid - 100)
     doAddCondition(cid, exhaust)
     doRemoveItem(item.uid, 1)
     return true
end

TDPIGpiKZ.png

If you are using client 8.54 you can use normal potions, if you use client 8.6 change the potions to not stackable potions and add an extra action script for it.
 
Last edited:
Code:
<talkaction words="create manapotion" filter="word-spaced" event="script" value="ownpotions.lua"/>
Code:
local potions = {
     [{1, 100}] = 7620,
     [{100, 500}] = 7589,
     [{500, 100000}] = 7590
}

function onSay(cid, words, param)
     if param == "" then
         return doPlayerSendCancel(cid, "Missing amount.")
     end
     local amount = tonumber(param)
     if amount and amount > 0 and amount < 100000 then
         for a, p in pairs(potions) do
             if amount >= a[1] and amount < a[2] then
                 if getPlayerMana(cid) >= amount then
                     doPlayerAddMana(cid, -amount, false)
                     local item = doPlayerAddItem(cid, p, 1)
                     doItemSetAttribute(item, "aid", amount + 100)
                     doItemSetAttribute(item, "description", "It contains "..amount.." mana.")
                     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
                 else
                     doPlayerSendCancel(cid, "You don't have enough mana.")
                 end
             end
         end
     else
         doPlayerSendCancel(cid, "Invalid amount.")
     end
     return true
end

Add in potions.lua under where it checks for exhaustion.
Code:
if item.actionid > 100 then
     doPlayerAddMana(itemEx.uid, item.actionid - 100)
     doAddCondition(cid, exhaust)
     doRemoveItem(item.uid, 1)
     return true
end

If you are using client 8.54 you can use normal potions, if you use client 8.6 change the potions to not stackable potions and add an extra action script for it.

Thanks Limo! :D It works like a charm! :D
I have a one more i think little for you request about small C++ edit.

I want to do a little edit with Follow system.
If creature name is == "X" (a monster thing) then if you try to follow this creature it returns back - YOU CANT FOLLOW and you cant follow this target.

You know any idea where I can edit it?
Thats my last small request and Im finishing the spam about requests :D :D
 
You are asking in the wrong place, not very likely to get help on this thread for that problem, try creating a new thread in the support section with correct tags in the title, also don't forget to post your server version.
 
Back
Top