Facebook
From Edgy Giraffe, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 50
  1. --[[
  2.     Script Name:                Haste If No Monsters
  3.     Description:                Cast haste spell when no monsters on screen.
  4.     Author:                     Ascer - example
  5. ]]
  6.  
  7. local SPELL = "utani hur"       -- spell to cast
  8.  
  9. -- DON'T EDIT BELOW THIS LINE
  10.  
  11.  
  12. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  13. --> Function:           getMonsters()
  14. --> Description:        Read creatures for monsters on screen.
  15. --> Class:                      None
  16. --> Params:                     None
  17. --> Return:             boolean true or false
  18. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  19. function getMonsters()
  20.         for i, mob in pairs(Creature.iMonsters(7, false)) do
  21.                 return true
  22.         end
  23.         return false
  24. end
  25.  
  26. -- loop module.
  27. Module.New("Haste If No Monsters", function (mod)
  28.        
  29.         -- when no hasted.
  30.         if not Self.isHasted() then
  31.  
  32.                 -- when no monsters.
  33.                 if not getMonsters() then
  34.  
  35.                         -- cast spell, mana, delay.
  36.                         Self.CastSpell(SPELL, 40, 500)
  37.  
  38.                 end    
  39.  
  40.         end
  41.  
  42.         -- module delay in miliseconds         
  43.         mod:Delay(200, 400)
  44.        
  45. end)