• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Item add extrahp or extramana (example donation)

Rufo

New Member
Joined
Jan 9, 2008
Messages
251
Reaction score
1
Well, this is my first time posting an action made by me, so here it is:



LUA:
function onUse(cid, item, frompos, item2, topos)

--100% By Rufo to Otland
--http://myrland.servegame.com
--Config
local lifeid = XXXX --- Itemid for adding HP
local manaid = XXXX -- Itemid for adding mana
local amountlife = 100 -- Amount of hp added
local amountmana = 100 -- Amount of mana added
local timeslife = 8 -- How many times should be used for hp
local timesmana = 8 -- How many times should be used for mana

--End config

   	if item.itemid == lifeid then
		vida = getCreatureMaxHealth(cid)+amountlife
   		queststatus = getPlayerStorageValue(cid,53131)
		questus = getPlayerStorageValue(cid,53131)+1
   		if queststatus < timeslife then
   			doCreatureSay(cid,"You have won some extra hp.", TALKTYPE_ORANGE_1)
                 setCreatureMaxHealth(cid,vida)
   			setPlayerStorageValue(cid,53131,questus)
		doRemoveItem(item.uid,1)
		
   		else
   			doPlayerSendTextMessage(cid,22,"You cant add yourself more hp.")
   		end





   	elseif item.itemid == manaid then
		vida = getCreatureMaxMana(cid)+amountmana
   		queststatus = getPlayerStorageValue(cid,53132)
		questus = getPlayerStorageValue(cid,53132)+1
   		if queststatus < timesmana then
   			doCreatureSay(cid,"You have won some extra mana.", TALKTYPE_ORANGE_1)
                 setCreatureMaxMana(cid,vida)
   			setPlayerStorageValue(cid,53132,questus)
		doRemoveItem(item.uid,1)
		
   		else
   			doPlayerSendTextMessage(cid,22,"You cannot add to yourself more mana.")
   		end

	

	end




   	return 1
   end


On actions.xml add:
Code:
	<!-- Add hp and mana -->
	<action itemid="XXXX" event="script" value="health.lua"/>
	<action itemid="XXXX" event="script" value="health.lua"/>

Replace XXXX for the items id you used on the script

This is for the item that adds mana and hp at the same time

LUA:
local itemid = XXXX --- Itemid for adding HP & MP
local healthamount = 100 -- The amount of health that should be added
local manamount = 100 -- The amount of mana that should be added
local times = 8 -- How many times can a player use this item

   	if item.itemid == itemid then
		HP = getCreatureMaxHealth(cid)+healthamount
		MP = getCreatureMaxMana(cid)+manamount
   		queststatus = getPlayerStorageValue(cid,53131)
		timesused = getPlayerStorageValue(cid,53131)+1
   		if queststatus < times then
   			doCreatureSay(cid,"You've increased your health and mana points.", TALKTYPE_ORANGE_1)
                 setCreatureMaxHealth(cid, HP)
	     setCreatureMaxMana(cid, MP)
   			setPlayerStorageValue(cid,53131,timesused)
		doRemoveItem(item.uid,1)
		
   		else
   			doPlayerSendTextMessage(cid,22,"You already used this item.")
   		end
	end

   	return 1
   end


Add on actions.xml

Code:
	<action itemid="xxxx" event="script" value="yourfilename.lua"/>

Credits to Rufo for the base script



Thanks
100% By Rufo
 
Last edited:
Thanks, how can i use de code tags? so it display its on LUA?
 
If you want to use a LUA tage just replace the [/CODE]
Code:
 with
LUA:
  ;>
 
I got two questions, look below lua code window :)

LUA:
local lifeid = XXXX --- Itemid for adding HP
local manaid = XXXX -- Itemid for adding mana

local timeslife = 8 -- How many times should be used for hp
local timesmana = 8 -- How many times should be used for mana

1. Can you use the same itemid for both adding HP and mana?
2. What do you mean with: How many times should be used for hp/mana?

Seems like a good script anyways, thanks for posting! =)
 
this is nice..
thanks for releasing it
i thought of doing something like this myself :>

@up
LUA:
if queststatus < timeslife then

How many times you can use the same item..
if u exceed that number you wont be able to use it again
 
This is for the item that adds mana and hp at the same time

LUA:
local itemid = XXXX --- Itemid for adding HP & MP
local healthamount = 100 -- The amount of health that should be added
local manamount = 100 -- The amount of mana that should be added
local times = 8 -- How many times can a player use this item

   	if item.itemid == itemid then
		HP = getCreatureMaxHealth(cid)+healthamount
		MP = getCreatureMaxMana(cid)+manamount
   		queststatus = getPlayerStorageValue(cid,53131)
		timesused = getPlayerStorageValue(cid,53131)+1
   		if queststatus < times then
   			doCreatureSay(cid,"You've increased your health and mana points.", TALKTYPE_ORANGE_1)
                 setCreatureMaxHealth(cid, HP)
	     setCreatureMaxMana(cid, MP)
   			setPlayerStorageValue(cid,53131,timesused)
		doRemoveItem(item.uid,1)
		
   		else
   			doPlayerSendTextMessage(cid,22,"You already used this item.")
   		end
	end

   	return 1
   end


Add on actions.xml

Code:
	<action itemid="xxxx" event="script" value="yourfilename.lua"/>

Credits to Rufo for the base script
 
Back
Top