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

Lua Item losing power (need charge). Help please :>

Zielas92

New Member
Joined
Oct 24, 2010
Messages
17
Reaction score
0
Item losing power (need charge). Help please :>

Hi.
I mean items adding % to max mana and hp. I would like to after use losing power and one must charge them, on example at npc. Sorry for my english. ;d

This is my script for item adding % to max mana:

Code:
local vocations = {191, 179, 182, 203, 197, 206, 209, 212, 185, 200, 227, 239, 194, 188, 251, 264, 6, 12, 18, 24, 30, 36, 42, 48, 63, 74, 81, 171, 220, 232, 244, 257}
local manaPercent = 15 --- How many % MP add! 
local time = 900 -- time in seconds
local storage = 40061 -- Must be unused!
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local addmana = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(addmana, CONDITION_PARAM_BUFF, true)
setConditionParam(addmana, CONDITION_PARAM_SUBID, 1)
setConditionParam(addmana, CONDITION_PARAM_STAT_MAXMANAPERCENT, 100 + manaPercent) 
setConditionParam(addmana, CONDITION_PARAM_TICKS, time * 1000)
setCombatCondition(combat, addmana)
 
function remove(cid)
	if not isPlayer(cid) then
		return true
	end
	doPlayerSendTextMessage(cid, 23, "Bonus Ki is time out!")
end
 
function onUse(cid, item)
	if isInArray(vocations, getPlayerVocation(cid)) then 
		if exhaustion.get(cid, storage) == FALSE then
			doCombat(cid, combat, numberToVariant(cid))  
			doCreatureSay(cid, "Yeeeah, Bonus Ki!!!\nFeel the power!", 19)
			doSendMagicEffect(getCreaturePosition(cid), 133)
			addEvent(remove,time*1000, cid)
			exhaustion.set(cid, storage, time)
		else
			doPlayerSendCancel(cid, "Sorry, you only can again use this item after " .. exhaustion.get(cid, storage) .. " seconds.")	
		end	
	else
		doPlayerSendCancel(cid, "Sorry, you must be on last transform!")	
	end
	return TRUE 
end

I will be very grateful for help. Thanks ;p

- - - Updated - - -

~Refresh~

Help, this is important to me to this item it was necessary to charge at npc.
 
Last edited:
Back
Top