Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local exhaust = Condition(CONDITION_EXHAUST_COMBAT)
- exhaust:setParameter(CONDITION_PARAM_TICKS, (1000))
- local gcd = Condition(CONDITION_SPELLGROUPCOOLDOWN)
- gcd:setParameter(CONDITION_PARAM_TICKS, 1000)
- gcd:setParameter(CONDITION_PARAM_SUBID, 1)
- -- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
- local combat = createCombatObject()
- setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
- setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
- setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
- function onGetFormulaValues(cid, level, maglevel)
- min = -((level / 1) + (maglevel * 10.1) + 39)
- max = -((level / 1) + (maglevel * 13.7) + 58)
- return min, max
- end
- setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
- local cfg ={
- mlvl = 15, -- Magic level needed
- lvl = 45, -- Level Needed
- }
- function onUse(player, item, fromPosition, target, toPosition, isHotkey)
- if target == nil or target == player or not target:isCreature() or target:isNpc() then
- return true
- end
- if player:getCondition(CONDITION_EXHAUST_COMBAT) or player:getCondition(CONDITION_SPELLGROUPCOOLDOWN, CONDITIONID_COMBAT, 1) then
- player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
- return true
- end
- if player:getTile():hasFlag(TILESTATE_NOPVPZONE) and target:isPlayer() then
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot attack this player.")
- return true
- end
- if target:isPlayer() and (player:getLevel() < 80 or target:getLevel() < 80) then
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot attack this player.")
- return true
- end
- if player:getTile():hasFlag(TILESTATE_PROTECTIONZONE) or target:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot attack a creature in a protection zone.")
- return true
- end
- if not player:getPosition():isSightClear(target:getPosition()) then
- player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
- player:getPosition():sendMagicEffect(CONST_ME_POFF)
- return true
- end
- if (player:getLevel() < cfg.lvl) then
- player:sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, your level is to low. You need to be atleast level "..cfg.lvl.." to use this rune.")
- return true
- end
- if (player:getMagicLevel() < cfg.mlvl) then
- player:sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, your magic level is to low. You need to atleast have magic level "..cfg.mlvl.." to use this rune.")
- return true
- end
- doCombat(player, combat, Variant(target:getId()))
- player:addCondition(exhaust)
- player:addCondition(gcd)
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement