edit1 2009: This here was one of my first scripts that I created, with lots of help from other scriptwriters.
Funny to see it still working
Still compatible with at least TFS 0.2 Mystic Spirit.
Greetings
I would like to thank Nahruto <3<3<3 right ahead for making me the correct script setup, so I could easily make this possible. Thanks in advance!
WTF is this?
I will show you how to create scripts so you can refill empty vials, for an example, you drink a health potion, and if you a knight, you can sacrifice some of your health points, to refill that empty vial to a health potion again.
To refill a health potion you need to have xxx hp, since you need to sacrifice some of it.
You need to hold the potion in your hand to refill it.
To refill a mana potion you need to have xxx mana, since you need to sacrifice some of it.
You need to hold the potion in your hand to refill it.
To refill a Great Spirit Potion (that gives both hp and mana when drink)
You need to hold a hp potion in your hand, and a manapotion in your other hand.
FAQ:
It cost more hp to refill a potion than what it cost to use it.
It cost more mana to refill a potion than what it cost to use it.
kk, lets getting started:
Open data/spells/spells.xml
search for
You will find spells under the "instant" catogory, between and end and start tag add this:
Then search after
You will find spells under the "conjure" category, between and end and start tag add this:
Then save the spells.xml document.
enter data\spells\scripts\support and create hp.lua
Then create a lua file and call it shp.lua
Then create a lua file and call it ghp.lua
If you don't bother restarting your server, you don't have to, say /reload spells in game and it should be set. Now this should fully working.
Note that this is not the new 8.11 healing potion and spirit potion, but you will have no problems to copy and extend the potion script to fit for the last potion right? Its very configurable thanks to Nahruto.
If you want to fix the spirit potion, you can base on this script, I don't got time to fix it right ahead, but you can easily do this with changing some ids:
Special note:
The mana potions conjure script is made very easily in spells.xml, so it can be abused to magic level fast up without using so much mana, just use the script nahruto made for health potions, but make it take mana instead of hp.
You can easily go based on this script to make any kind of conjures, its very easy to modify, and it might be recommended to make these potions to fit with your potions, the mana cost should always be a little higher than the max amount of mana received when drinking the potion, same goes to health.
You might see the vocations, I made so only Druids could do the greatest mana potion, just to make them a bit more special in ots. You can easily change this to another vocation.
The credits goes to Nahruto. He did the lua scripts, I only changed the ID's and came with this idea.
Compatible:
Tested and works perfectly with the latest versions from TFS in the 0.2 series. I can not guarantee it will work with other distributions.
Any questions just ask, please come with comments and replys, I want to know if you like this or not
Funny to see it still working
Still compatible with at least TFS 0.2 Mystic Spirit.
Greetings
I would like to thank Nahruto <3<3<3 right ahead for making me the correct script setup, so I could easily make this possible. Thanks in advance!
WTF is this?
I will show you how to create scripts so you can refill empty vials, for an example, you drink a health potion, and if you a knight, you can sacrifice some of your health points, to refill that empty vial to a health potion again.
To refill a health potion you need to have xxx hp, since you need to sacrifice some of it.
You need to hold the potion in your hand to refill it.
To refill a mana potion you need to have xxx mana, since you need to sacrifice some of it.
You need to hold the potion in your hand to refill it.
To refill a Great Spirit Potion (that gives both hp and mana when drink)
You need to hold a hp potion in your hand, and a manapotion in your other hand.
FAQ:
It cost more hp to refill a potion than what it cost to use it.
It cost more mana to refill a potion than what it cost to use it.
kk, lets getting started:
Open data/spells/spells.xml
search for
Code:
<instant name=
PHP:
<instant name="Refill Health Potion" words="exevo hopa" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" script="support/hp.lua">
<vocation name="Paladin"/>
<vocation name="Knight"/>
<vocation name="Royal Paladin"/>
<vocation name="Elite Knight"/>
</instant>
<instant name="Refill great Health Potion" words="exevo gran hopa" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" script="support/ghp.lua">
<vocation name="Paladin"/>
<vocation name="Knight"/>
<vocation name="Royal Paladin"/>
<vocation name="Elite Knight"/>
</instant>
<instant name="Refill strong Health Potion" words="exevo mas hopa" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" script="support/shp.lua">
<vocation name="Knight"/>
<vocation name="Elite Knight"/>
</instant>
Then search after
Code:
<conjure name
You will find spells under the "conjure" category, between and end and start tag add this:
PHP:
<conjure name="Refill mana Potion" words="exevo manera" reagentId="7636" conjureId="7620" aggressive="0" conjureCount="1" maglv="0" mana="175" soul="0" prem="0" enabled="1" function="conjureRune">
<vocation name="Sorcerer"/>
<vocation name="Druid"/>
<vocation name="Paladin"/>
<vocation name="Master Sorcerer"/>
<vocation name="Elder Druid"/>
<vocation name="Royal Paladin"/>
</conjure>
<conjure name="Refill strong mana Potion" words="exevo gran manera" reagentId="7634" conjureId="7589" aggressive="0" conjureCount="1" maglv="0" mana="250" soul="0" prem="0" enabled="1" function="conjureRune">
<vocation name="Druid"/>
<vocation name="Paladin"/>
<vocation name="Elder Druid"/>
<vocation name="Royal Paladin"/>
</conjure>
<conjure name="Refill great mana Potion" words="exevo mas manera" reagentId="7635" conjureId="7590" aggressive="0" conjureCount="1" maglv="0" mana="425" soul="0" prem="0" enabled="1" function="conjureRune">
<vocation name="Druid"/>
<vocation name="Elder Druid"/>
</conjure>
Then save the spells.xml document.
enter data\spells\scripts\support and create hp.lua
PHP:
local req = 7636
local hp = 330
local new = 7618
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
function onCastSpell(cid, var)
local h1 = getPlayerSlotItem(cid, 5)
local h2 = getPlayerSlotItem(cid, 6)
if getCreatureHealth(cid) >= hp then
if h1.itemid == req then
doCreatureAddHealth(cid, -hp)
doTransformItem(h1.uid, new)
doCombat(cid, combat, var)
elseif h2.itemid == req then
doCreatureAddHealth(cid, -hp)
doTransformItem(h2.uid, new)
doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, "You need to put a empty potion in your hand")
end
else
doPlayerSendCancel(cid, "You need more HP than 330 to refill this potion.")
end
end
Then create a lua file and call it shp.lua
PHP:
local req = 7634
local hp = 800
local new = 7588
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
function onCastSpell(cid, var)
local h1 = getPlayerSlotItem(cid, 5)
local h2 = getPlayerSlotItem(cid, 6)
if getCreatureHealth(cid) >= hp then
if h1.itemid == req then
doCreatureAddHealth(cid, -hp)
doTransformItem(h1.uid, new)
doCombat(cid, combat, var)
elseif h2.itemid == req then
doCreatureAddHealth(cid, -hp)
doTransformItem(h2.uid, new)
doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, "You need to put a empty strong potion in your hand")
end
else
doPlayerSendCancel(cid, "You need more HP than 800 to refill this potion.")
end
end
Then create a lua file and call it ghp.lua
PHP:
local req = 7635
local hp = 1300
local new = 7591
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
function onCastSpell(cid, var)
local h1 = getPlayerSlotItem(cid, 5)
local h2 = getPlayerSlotItem(cid, 6)
if getCreatureHealth(cid) >= hp then
if h1.itemid == req then
doCreatureAddHealth(cid, -hp)
doTransformItem(h1.uid, new)
doCombat(cid, combat, var)
elseif h2.itemid == req then
doCreatureAddHealth(cid, -hp)
doTransformItem(h2.uid, new)
doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, "You need to put a empty great potion in your hand")
end
else
doPlayerSendCancel(cid, "You need more HP than 1300 to refill this potion.")
end
end
If you don't bother restarting your server, you don't have to, say /reload spells in game and it should be set. Now this should fully working.
Note that this is not the new 8.11 healing potion and spirit potion, but you will have no problems to copy and extend the potion script to fit for the last potion right? Its very configurable thanks to Nahruto.
If you want to fix the spirit potion, you can base on this script, I don't got time to fix it right ahead, but you can easily do this with changing some ids:
PHP:
local req1 = xxxx --id strong mana potion
local req2 = xxxx --id strong health potion
local hp = 50 -- set how much hp it cost to drink the potion -- to make it also require mana, add some mana cost in spells.xml to launch this spell.
local new = xxxx --id empty vial u get when drinking a strong potion
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
function onCastSpell(cid, var)
local h1 = getPlayerSlotItem(cid, 5)
local h2 = getPlayerSlotItem(cid, 6)
if getCreatureHealth(cid) >= hp then
if h1.itemid == req1 and h2.itemid == req2 then
doCreatureAddHealth(cid, -hp)
doRemoveItem(h1.uid)
doRemoveItem(h2.uid)
doPlayerAddItem(cid, new)
else
doPlayerSendCancel(cid, "NO ITEM")
end
else
doPlayerSendCancel(cid, "NO HP")
end
end
Special note:
The mana potions conjure script is made very easily in spells.xml, so it can be abused to magic level fast up without using so much mana, just use the script nahruto made for health potions, but make it take mana instead of hp.
You can easily go based on this script to make any kind of conjures, its very easy to modify, and it might be recommended to make these potions to fit with your potions, the mana cost should always be a little higher than the max amount of mana received when drinking the potion, same goes to health.
You might see the vocations, I made so only Druids could do the greatest mana potion, just to make them a bit more special in ots. You can easily change this to another vocation.
The credits goes to Nahruto. He did the lua scripts, I only changed the ID's and came with this idea.
Compatible:
Tested and works perfectly with the latest versions from TFS in the 0.2 series. I can not guarantee it will work with other distributions.
Any questions just ask, please come with comments and replys, I want to know if you like this or not
Last edited: