Advertisement
Alscara

Untitled

Nov 11th, 2015
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. local exhaust = Condition(CONDITION_EXHAUST_COMBAT)
  2. exhaust:setParameter(CONDITION_PARAM_TICKS, (1000))
  3. local gcd = Condition(CONDITION_SPELLGROUPCOOLDOWN)
  4. gcd:setParameter(CONDITION_PARAM_TICKS, 1000)
  5. gcd:setParameter(CONDITION_PARAM_SUBID, 1)
  6. -- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
  7. local combat = createCombatObject()
  8. setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
  9. setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
  10. setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
  11.  
  12. function onGetFormulaValues(cid, level, maglevel)
  13. min = -((level / 1) + (maglevel * 10.1) + 39)
  14. max = -((level / 1) + (maglevel * 13.7) + 58)
  15. return min, max
  16. end
  17.  
  18. setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
  19.  
  20. local cfg ={
  21. mlvl = 15, -- Magic level needed
  22. lvl = 45, -- Level Needed
  23. }
  24.  
  25.  
  26. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  27. if target == nil or target == player or not target:isCreature() or target:isNpc() then
  28. return true
  29. end
  30. if player:getCondition(CONDITION_EXHAUST_COMBAT) or player:getCondition(CONDITION_SPELLGROUPCOOLDOWN, CONDITIONID_COMBAT, 1) then
  31. player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
  32. return true
  33. end
  34. if player:getTile():hasFlag(TILESTATE_NOPVPZONE) and target:isPlayer() then
  35. player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot attack this player.")
  36. return true
  37. end
  38. if target:isPlayer() and (player:getLevel() < 80 or target:getLevel() < 80) then
  39. player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot attack this player.")
  40. return true
  41. end
  42. if player:getTile():hasFlag(TILESTATE_PROTECTIONZONE) or target:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
  43. player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot attack a creature in a protection zone.")
  44. return true
  45. end
  46. if not player:getPosition():isSightClear(target:getPosition()) then
  47. player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
  48. player:getPosition():sendMagicEffect(CONST_ME_POFF)
  49. return true
  50. end
  51. if (player:getLevel() < cfg.lvl) then
  52. player:sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, your level is to low. You need to be atleast level "..cfg.lvl.." to use this rune.")
  53. return true
  54. end
  55. if (player:getMagicLevel() < cfg.mlvl) then
  56. 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.")
  57. return true
  58. end
  59.  
  60. doCombat(player, combat, Variant(target:getId()))
  61. player:addCondition(exhaust)
  62. player:addCondition(gcd)
  63.  
  64. return true
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement