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

Full health

kilirt

New Member
Joined
May 11, 2009
Messages
223
Reaction score
2
hello i need a script when i do a action id or unique id on my potion when we clic on this potion this regenerate full hp or mana

i need this script for full hp and an other for full mana :thumbup:
 
health
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid) ) -- health
	doSendMagicEffect(fromPosition,12)
	
	return true
end


mana
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doPlayerAddMana(cid,getPlayerMaxMana(cid) - getPlayerMana(cid) )   -- mana 
	doSendMagicEffect(fromPosition,12)
	
	return true
end
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doPlayerAddMana(cid,getPlayerMaxMana(cid) - getPlayerMana(cid) )  
	doSendAnimatedText(fromPosition,+..."getPlayerMana(cid)..",TEXCOLOR_ORANGE)
	return true
end

try this
 
sorry for time: [17/12/2010 14:05:57] [Error - LuaScriptInterface::loadFile] data/actions/scripts/1.lua:3: unexpected symbol near '+'
[17/12/2010 14:05:57] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/1.lua)
[17/12/2010 14:05:57] data/actions/scripts/1.lua:3: unexpected symbol near '+'
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local xd = getPlayerMaxMana(cid) - getPlayerMana(cid)
	doPlayerAddMana(cid, xd)
	doSendAnimatedText(getThingPos(cid), '+' .. xd, 143)
	return true
end
 
Alternative >:-)...

health.lua:
LUA:
local config = {
	removeOnUse = "yes",
	newEffect = "no",
	text = "Health",
	color = 180
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.newEffect = getBooleanFromString(config.newEffect)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local health = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
	doCreatureAddHealth(cid, health)
	if(not config.newEffect) then
		doSendAnimatedText(getThingPos(cid), "+" .. health, color)
	else
		doSendAnimatedText(getThingPos(cid), text, color)
		return true
	end

	if(config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end

	return true
end

mana.lua:
LUA:
local config = {
	removeOnUse = "yes",
	newEffect = "no",
	text = "Mana",
	color = 5
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.newEffect = getBooleanFromString(config.newEffect)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local mana = getCreatureMaxMana(cid) - getCreatureMana(cid)
	doCreatureAddMana(cid, mana)
	if(not config.newEffect) then
		doSendAnimatedText(getThingPos(cid), "+" .. mana, color)
	else
		doSendAnimatedText(getThingPos(cid), text, color)
		return true
	end

	if(config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end

	return true
end
 
Last edited:
Alternative >:-)...

health.lua:
LUA:
local config = {
	removeOnUse = "yes",
	newEffect = "no",
	text = "Health"
	color = 180
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.newEffect = getBooleanFromString(config.newEffect)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local health = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
	doCreatureAddHealth(cid, health)
	if(not config.newEffect) then
		doSendAnimatedText(getThingPos(cid), "+" .. health, color)
	else
		doSendAnimatedText(getThingPos(cid), text, color)
		return true
	end

	if(config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end

	return true
end

mana.lua:
LUA:
local config = {
	removeOnUse = "yes",
	newEffect = "no",
	text = "Mana"
	color = 5
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.newEffect = getBooleanFromString(config.newEffect)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local mana = getCreatureMaxMana(cid) - getCreatureMana(cid)
	doCreatureAddMana(cid, mana)
	if(not config.newEffect) then
		doSendAnimatedText(getThingPos(cid), "+" .. mana, color)
	else
		doSendAnimatedText(getThingPos(cid), text, color)
		return true
	end

	if(config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end

	return true
end

[18/12/2010 15:56:02] [Error - LuaScriptInterface::loadFile] data/actions/scripts/1.lua:5: '}' expected (to close '{' at line 1) near 'color'
[18/12/2010 15:56:02] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/1.lua)
[18/12/2010 15:56:02] data/actions/scripts/1.lua:5: '}' expected (to close '{' at line 1) near 'color'


LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local xd = getPlayerMaxMana(cid) - getPlayerMana(cid)
	doPlayerAddMana(cid, xd)
	doSendAnimatedText(getThingPos(cid), '+' .. xd, 143)
	return true
end

no work and make new error:

[18/12/2010 15:57:21] [Error - CreatureScript Interface]
[18/12/2010 15:57:21] data/creaturescripts/scripts/skullcheck.lua:onThink
[18/12/2010 15:57:21] Description:
[18/12/2010 15:57:21] (luaSetConditionParam) This function can only be used while loading the script.
[18/12/2010 15:57:21] Reloaded actions.
 
Code:
local config = {
	removeOnUse = "yes",
	newEffect = "no",
	text = "Mana"
	color = 5
}

Missing ',' after 'text = "Mana" '.

Code:
[18/12/2010 15:57:21] data/creaturescripts/scripts/skullcheck.luanThink

You add it to skullcheck? Omgflol... You're newbie or stiupid...
 
Code:
local config = {
	removeOnUse = "yes",
	newEffect = "no",
	text = "Mana"
	color = 5
}

Missing ',' after 'text = "Mana" '.

Code:
[18/12/2010 15:57:21] data/creaturescripts/scripts/skullcheck.luanThink

You add it to skullcheck? Omgflol... You're newbie or stiupid...


work is good thx rep ++
 
LOL You rep him 'cause he found a missing ',' in my script...
Damn...then I just lived one of my college teacher sayings: "If there's only ONE comma or 'end' missing, then your whole script will be doomed. DOOMED! And you will fail now and in your finals!...next class don't forget to BUY Visual Studio because I don't wanna see any pirates around here." Meh...I cracked it anyways and no, I'm not asking for rep.
 
Last edited:

No, no...I wasn't asking for rep. I just find it quite strange? and funny that you only added a missing comma in my script and you gained rep.

Also, Kilirt you already repped me in your other thread, so even if you rep me here I won't get rep :)
 
Back
Top