Advertisement
Guest User

Untitled

a guest
May 25th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. function use_potions()
  2. {
  3. function use_potion() {
  4. if (!parent.next_skill.use_hp)
  5. parent.next_potion = new Date();
  6.  
  7. if (new Date() > parent.next_potion) {
  8. if (character.hp < character.max_hp * 0.20) use('use_hp');
  9. else if (character.mp < character.max_mp * 0.20) use('use_mp');
  10. else if (character.hp < character.max_hp * 0.50) use('use_hp');
  11. else if (character.mp < character.max_mp - 300) use('use_mp');
  12. else if (character.hp < character.max_hp - 1400) use('use_hp');
  13. }
  14. }
  15.  
  16. setInterval(use_potion, 250);
  17. }
  18.  
  19. function grind() {
  20. function grindIter() {
  21. if (character.rip || is_moving(character)) return;
  22. var target = get_targeted_monster();
  23. if (!target) {
  24. target = get_nearest_monster({ min_xp: 100, max_att: 200 });
  25. change_target(target);
  26. }
  27. if (target)
  28. {
  29. if (!in_attack_range(target))
  30. move(character.x + (target.x - character.x) / 2, character.y + (target.y - character.y) / 2);
  31.  
  32. if (can_attack(target))
  33. attack(target);
  34. }
  35.  
  36. loot();
  37. }
  38.  
  39. setInterval(grindIter, 250);
  40. }
  41.  
  42. function auto_attack() {
  43. setInterval(() => {
  44. var target = get_targeted_monster();
  45. if (target && can_attack(target))
  46. attack(target);
  47. }, 250);
  48. }
  49.  
  50. function auto_follow() {
  51. setInterval(() => {
  52. var target = parent.ctarget;
  53. if (target && !in_attack_range(target))
  54. move(character.x + (target.x - character.x) / 2, character.y + (target.y - character.y) / 2);
  55. }, 250);
  56. }
  57.  
  58. function auto_loot() {
  59. setInterval(() => {
  60. loot();
  61. }, 250);
  62. }
  63.  
  64. use_potions();
  65. if(false) {
  66. grind();
  67. }
  68. else {
  69. auto_attack();
  70. //auto_follow();
  71. auto_loot();
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement