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

Add HP (help)

dydocan

dydocan
Joined
Jul 2, 2010
Messages
95
Reaction score
0
Hi, everybody :)

Well I need help to adding hp to a player.

If a player right click on an item, the item should disappear and add 15000 hp to the player for "3 hours".

Anybody know how to do that? :P
 
Last edited:
Ok, so here is my interpretation of your script :

1. Player Clicks on Item.
2. Player Gets 15000 Health.
3. Item Disappears.
4. You Get 15000 Health Each Second For 3 Hours.

Am I right? If I am, this script is probably the most worthless one I have ever seen.
 
Try this.. Whipped it in a few seconds.. XD (haven't tested it)

In movements.xml..
XML:
<movevent type="Equip" itemid="xxx2" slot="ring" event="function" value="onEquipItem"/>
<movevent type="Equip" itemid="xxx1" slot="ring" event="script" value="hpscript.lua"/>
<movevent type="DeEquip" itemid="xxx2" slot="ring" event="script" value="hpscript.lua"/>

hpscript.lua
LUA:
     function onDeEquip(cid, item, slot)
        doCreatureAddHealth(cid, -15000)
        return true
end
 
     function onEquip(cid, item, slot)
        doCreatureAddHealth(cid, 15000)
        return true
end

And for the ring you choose in items.xml..

XML:
	<item id="xxx1" article="an" name="hp ring">
		<attribute key="weight" value="10"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="xxx2"/>
		<attribute key="stopduration" value="1"/>
		<attribute key="showduration" value="1"/>
	</item>

	<item id="xxx2" article="an" name="hp ring">
		<attribute key="weight" value="10"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="decayTo" value="0"/>
		<attribute key="transformDeEquipTo" value="xxx1"/>
		<attribute key="duration" value="10800"/>
		<attribute key="showduration" value="1"/>
	</item>
 
LUA:
function onUse(cid, item, frompos, item2, topos)
local condation = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condation, CONDITION_PARAM_TICKS, 10800000)
setConditionParam(condation, CONDITION_PARAM_STAT_MAXHEALTH, 15000)

	doAddCondition(cid, condation)
	doRemoveItem(item.uid, 1)
return true
end
 
@Spider:
Sry, had to do it :p.
Code:
local hours = 3

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, hours * 60 * 60 * 1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 15000)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if hasCondition(cid, CONDITION_ATTRIBUTES) then
		doPlayerSendCancel(cid, "You are already boosted.")
	else
		doAddCondition(cid, condition)
		doRemoveItem(item.uid, 1)
	end

	return true
end
 
@Spider:
Sry, had to do it :p.
Code:
local hours = 3

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, hours * 60 * 60 * 1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 15000)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if hasCondition(cid, CONDITION_ATTRIBUTES) then
		doPlayerSendCancel(cid, "You are already boosted.")
	else
		doAddCondition(cid, condition)
		doRemoveItem(item.uid, 1)
	end

	return true
end

Well anybody? I want an item who I can right-click on and then it will Increase MaxHp by 15000 for 3 hours anybody??

...
 
Back
Top