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

Solved Problem with item adding % to max mana

Zielas92

New Member
Joined
Oct 24, 2010
Messages
17
Reaction score
0
Hello!
I have a problem with item adding % to max mana, next use after 15 minutes.
This is my script:
data/actions:

Code:
function onUse(cid, item)
if isPlayer(cid) then
local time = 900 -- time in seconds
local storage = 9393 -- Must be unused!
local manaPercent = 15 --- How many % MP add!  
local name = getPlayerName(cid)


if(not checkExhausted(cid, 132, time+2)) then
	return true
end

local condition1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPERCENT, 100 + manaPercent) 
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)


if (getPlayerStorageValue(cid, storage) <= os.time()) then
	doAddCondition(cid, condition1)
	doCreatureSay(cid, "Yeeeah!!!\nFeel the power!", 19)
	doSendMagicEffect(getCreaturePosition(cid), 133)
	doRemoveItem(item.uid, 0)


addEvent(function()  
if isPlayer(cid) then      
doPlayerSendTextMessage(cid, 23, "Bonus Ki is time out!")   
doRemoveCondition(cid, CONDITION_ATTRIBUTES)   
end 
return true 
end,  time*1000+40,  cid)

else
	doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.")
	end
	return TRUE

end
end

Errors in the console:

Code:
[13/04/2013 11:43:35] [Error - Action Interface] 
[13/04/2013 11:43:35] data/actions/scripts/bonuski.lua:onUse
[13/04/2013 11:43:35] Description: 
[13/04/2013 11:43:35] (luaCreateConditionObject) This function can only be used while loading the script.

[13/04/2013 11:43:35] [Error - Action Interface] 
[13/04/2013 11:43:35] data/actions/scripts/bonuski.lua:onUse
[13/04/2013 11:43:35] Description: 
[13/04/2013 11:43:35] (luaSetConditionParam) This function can only be used while loading the script.

[13/04/2013 11:43:35] [Error - Action Interface] 
[13/04/2013 11:43:35] data/actions/scripts/bonuski.lua:onUse
[13/04/2013 11:43:35] Description: 
[13/04/2013 11:43:35] (luaSetConditionParam) This function can only be used while loading the script.

[13/04/2013 11:43:35] [Error - Action Interface] 
[13/04/2013 11:43:35] data/actions/scripts/bonuski.lua:onUse
[13/04/2013 11:43:35] Description: 
[13/04/2013 11:43:35] (luaSetConditionParam) This function can only be used while loading the script.

[13/04/2013 11:43:35] [Error - Action Interface] 
[13/04/2013 11:43:35] data/actions/scripts/bonuski.lua:onUse
[13/04/2013 11:43:35] Description: 
[13/04/2013 11:43:35] (luaDoAddCondition) Condition not found

Please help. Thank You!

PS: Sorry for my English :$
 
Lua:
local manaPercent = 15 --- How many % MP add! 
local time = 900 -- time in seconds
local storage = 9393 -- 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_STAT_MAXMANAPERCENT, 100 + manaPercent) 
setConditionParam(addmana, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, addmana)

function remove(cid)
	doPlayerSendTextMessage(cid, 23, "Bonus Ki is time out!")
	doRemoveCondition(cid, CONDITION_ATTRIBUTES)
end

function onUse(cid, item)
	if exhaustion.get(cid, storage) == FALSE then
		doCombat(cid, combat, numberToVariant(cid))  
		doCreatureSay(cid, "Yeeeah!!!\nFeel the power!", 19)
		doSendMagicEffect(getCreaturePosition(cid), 133) -- I don't have any magic effect on 133 so I hope you have...
		--doRemoveItem(item.uid, 0)
		addEvent(remove,time*1000+40, cid)
		exhaustion.set(cid, storage, time)
	else
		doPlayerSendCancel(cid, "Sorry, you only can again use this item after " .. exhaustion.get(cid, storage) .. " seconds.")	
	end	
	return TRUE 
end

Tell me if worked for you :p
 
/Edit: It works perfectly, was needed change here:

Code:
setConditionParam(addmana, CONDITION_PARAM_STAT_MAXMANAPERCENT, 115)

100 + manaPercent
on "115" which gives 15 %. Thank You very much :)
 
Last edited:
Back
Top