Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. function AutoHealTwoPets()
  2. {
  3. //Selecting your first pet. If previously selected same Pet with ID will be used. You can delete it from
  4. //Objects in OA to select again.
  5. var petOne = Orion.FindObject('petOne');
  6. if(petOne == null || petOne == 0){
  7. Orion.Print( '-1', 'You have not selected your first Pet');
  8. Orion.Print( '-1', 'Target your first pet.');
  9. Orion.AddObject('petOne');
  10. while(Orion.HaveTarget()){
  11. Orion.Wait('50');
  12. }
  13. petOne = Orion.FindObject('petOne');
  14. }
  15. //Selecting your second pet. If previously selected same Pet with ID will be used. You can delete it from
  16. //Objects in OA to select again.
  17. var petTwo = Orion.FindObject('petTwo');
  18. if(petTwo == null || petTwo == 0){
  19. Orion.Print( '-1', 'You have not selected your second Pet');
  20. Orion.Print( '-1', 'Target your second pet.');
  21. Orion.AddObject('petTwo');
  22. while(Orion.HaveTarget())
  23. {
  24. Orion.Wait('50');
  25. }
  26. petTwo = Orion.FindObject('petTwo');
  27. }
  28. var Timer, Msg = "You finish applying bandages.";
  29. //var bandageType= '0x0E21';
  30. while (!Player.Dead() && Orion.Count('0x0E21')) {
  31. //calculating pet hp percentages
  32. var petOneHpPercentage=petOne.Hits()*100/petOne.MaxHits();
  33. var petTwoHpPercentage=petTwo.Hits()*100/petTwo.MaxHits();
  34. //Printing HpPercentages on screen if wanted
  35. Orion.Print(petOneHpPercentage);
  36. Orion.Print(petTwoHpPercentage);
  37. Orion.Wait(100);
  38. //CheckHp percentages start heal if one of the pets have lower than 95% hp
  39. if (petOneHpPercentage < 99 || petTwoHpPercentage < 99) {
  40. //If petOne has lower or eqaul hp to petTwo heal petOne, else heal petTwo
  41. if((petOne.Hits()*100/petOne.MaxHits()) < (petTwo.Hits()*100/petTwo.MaxHits()) || (petOne.Hits()*100/petOne.MaxHits()) == (petTwo.Hits()*100/petTwo.MaxHits())){
  42. Orion.Print( '-1', 'Attempting to heal your pet:' + petOne.Name());
  43. //Orion.UseObject('bandage');
  44. var bandageType= '0x0E21';
  45. Orion.UseType(bandageType);
  46. Orion.WaitTargetObject(petOne.Serial());
  47. Timer = Orion.Now()+6000;
  48. while (Orion.InJournal(Msg) || Orion.Now() < Timer)
  49. {
  50. Orion.Wait(100);
  51. }
  52. //Printing Bandage Count. Further improvement required for better alerting the player when bandage count is lower than 5.
  53. if(Orion.Count('0x0E21') < 11){
  54. Orion.Print('0x066d',Orion.Count('0x0E21') + ' Bandages Left.');
  55. }
  56. else
  57. {
  58. Orion.Print(Orion.Count('0x0E21') + ' Bandages Left.');
  59. }
  60. }
  61. else{
  62. Orion.Print( '-1', 'Attempting to heal your pet:' + petTwo.Name());
  63. //Orion.UseObject('bandage');
  64. var bandageType= '0x0E21';
  65. Orion.UseType(bandageType);
  66. Orion.WaitTargetObject(petTwo.Serial());
  67. Timer = Orion.Now()+6000;
  68. while (!Orion.InJournal(Msg) && Orion.Now() < Timer)
  69. {
  70. Orion.Wait(100);
  71. }
  72. //Printing Bandage Count. Further improvement required for better alerting the player when bandage count is lower than 5.
  73. Orion.Print(Orion.Count('0x0E21') + ' Bandages Left.'); //BandageCount
  74. }
  75. }
  76. else
  77. {
  78. Orion.Wait(100);
  79. }
  80. }
  81. Orion.Print('YOU HAVE NO BANDAGES LEFT');
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement