elnelson
Lunaria World Dev
Hello, otlanders
i have this script made by myself, but its messy and i need to optimize it.
i'd like to add a notification when the buff ends, also it has a minor bug when someone eat the first it says "you are exhausted".
it would be great if it could say +15 mana each time it restores.
this is my script:
i'd like to add a notification when the buff ends, also it has a minor bug when someone eat the first it says "you are exhausted".
it would be great if it could say +15 mana each time it restores.
this is my script:
LUA:
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 11)
setConditionParam(condition, CONDITION_PARAM_BUFF_SPELL, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 1 * 60 * 1000)
setConditionParam(condition, CONDITION_PARAM_MANAGAIN, 15)
setConditionParam(condition, CONDITION_PARAM_MANATICKS, 3000)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1 * 60 * 1000)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 4447798) == -1 then
doPlayerPopupFYI(cid, "[Tutorial]: Blueberries!\n\
Use it to add +15 mana regeneration each second\
You can get this farming.\
")
setPlayerStorageValue(cid, 4447798, 1)
end
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doCreatureSay(cid, "You cant eat so fast.",TALKTYPE_ORANGE_1)
else
local exhausted_seconds = 60
local exhausted_storagevalue = 1263
if (os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
doPlayerSendCancel(cid, "You are exhausted.")
if(not isSorcerer(cid) and not isDruid(cid)) then
local pos = getPlayerPosition(cid)
doAddCondition(cid, condition)
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid,1)
doPlayerFeed(cid, 12)
doSendAnimatedText(pos, "[+15] Mana gain.", 112)
return true
end
if(not isKnight(cid) and not isPaladin(cid)) then
local pos = getPlayerPosition(cid)
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid,1)
doPlayerFeed(cid, 12)
doAddCondition(cid, condition)
doSendAnimatedText(pos, "[+15] Mana gain.", 112)
end
return true
end
end
end