local conf = { effectlist = {12,13,14,3,28,29,30,39,68}, allPercent = 50, itemId = 12599, itemName = 'Berserk Stomach', berserkLength = 30, berserkCooldown = 120, storageCooldown = 32485, storageBerserkTime = 32486 } -- END OF CONFIG local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_BUFF, true) setConditionParam(condition, CONDITION_PARAM_TICKS, conf.berserkLength * 1000) -- not longer then berserkLength time! setConditionParam(condition, CONDITION_PARAM_SUBID, 49) setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_FISTPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUBPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORDPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_AXEPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCEPERCENT, 100 + conf.allPercent) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, 100 + conf.allPercent) local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) setCombatCondition(combat, condition) function checkBuff(cid, n) if not isPlayer(cid) then return end local tb_rot = {{0,2},{6,5},{1,3},{7,4}} local mod = (n % #tb_rot) + 1 if(getPlayerStorageValue(cid, conf.storageBerserkTime) > os.time()) then if(mod == 1) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA) end doSendMagicEffect(getPosByDir(getCreaturePosition(cid), tb_rot[mod][1]), conf.effectlist[math.random(1,#conf.effectlist)]) doSendMagicEffect(getPosByDir(getCreaturePosition(cid), tb_rot[mod][2]), conf.effectlist[math.random(1,#conf.effectlist)]) addEvent(checkBuff, 200, cid, n+1) else doRemoveCondition(cid, CONDITION_ATTRIBUTES, 49) setPlayerStorageValue(cid, conf.storageBerserkTime, -1) end end function onSay(cid, words, param, channel) if(getPlayerStorageValue(cid, conf.storageBerserkTime) > os.time()) then doRemoveCondition(cid, CONDITION_ATTRIBUTES, 49) setPlayerStorageValue(cid, conf.storageBerserkTime, -1) doCreatureSay(cid, 'BERSERK MODE OFF!', TALKTYPE_MONSTER) return true end if(getPlayerStorageValue(cid,conf.storageCooldown) < os.time()) then if(doPlayerRemoveItem(cid, conf.itemId, 1)) then setPlayerStorageValue(cid, conf.storageCooldown,os.time()+conf.berserkCooldown) setPlayerStorageValue(cid, conf.storageBerserkTime,os.time()+conf.berserkLength) checkBuff(cid, 0) doCreatureSay(cid, 'BERSERK MODE ON!', TALKTYPE_MONSTER) doCombat(cid, combat, numberToVariant(cid)) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Berserk effect stays for 30 seconds. Say !berserk to disable it anytime you want.') else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need ' .. conf.itemName .. ' to use this buff!') end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Wait ' .. (getPlayerStorageValue(cid, conf.storageCooldown) - os.time()) .. ' seconds before you use it again!') end return true end