Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AutoHealTwoPets()
- {
- //Selecting your first pet. If previously selected same Pet with ID will be used. You can delete it from
- //Objects in OA to select again.
- var petOne = Orion.FindObject('petOne');
- if(petOne == null || petOne == 0){
- Orion.Print( '-1', 'You have not selected your first Pet');
- Orion.Print( '-1', 'Target your first pet.');
- Orion.AddObject('petOne');
- while(Orion.HaveTarget()){
- Orion.Wait('50');
- }
- petOne = Orion.FindObject('petOne');
- }
- //Selecting your second pet. If previously selected same Pet with ID will be used. You can delete it from
- //Objects in OA to select again.
- var petTwo = Orion.FindObject('petTwo');
- if(petTwo == null || petTwo == 0){
- Orion.Print( '-1', 'You have not selected your second Pet');
- Orion.Print( '-1', 'Target your second pet.');
- Orion.AddObject('petTwo');
- while(Orion.HaveTarget())
- {
- Orion.Wait('50');
- }
- petTwo = Orion.FindObject('petTwo');
- }
- var Timer, Msg = "You finish applying bandages.";
- //var bandageType= '0x0E21';
- while (!Player.Dead() && Orion.Count('0x0E21')) {
- //calculating pet hp percentages
- var petOneHpPercentage=petOne.Hits()*100/petOne.MaxHits();
- var petTwoHpPercentage=petTwo.Hits()*100/petTwo.MaxHits();
- //Printing HpPercentages on screen if wanted
- Orion.Print(petOneHpPercentage);
- Orion.Print(petTwoHpPercentage);
- Orion.Wait(100);
- //CheckHp percentages start heal if one of the pets have lower than 95% hp
- if (petOneHpPercentage < 99 || petTwoHpPercentage < 99) {
- //If petOne has lower or eqaul hp to petTwo heal petOne, else heal petTwo
- if((petOne.Hits()*100/petOne.MaxHits()) < (petTwo.Hits()*100/petTwo.MaxHits()) || (petOne.Hits()*100/petOne.MaxHits()) == (petTwo.Hits()*100/petTwo.MaxHits())){
- Orion.Print( '-1', 'Attempting to heal your pet:' + petOne.Name());
- //Orion.UseObject('bandage');
- var bandageType= '0x0E21';
- Orion.UseType(bandageType);
- Orion.WaitTargetObject(petOne.Serial());
- Timer = Orion.Now()+6000;
- while (Orion.InJournal(Msg) || Orion.Now() < Timer)
- {
- Orion.Wait(100);
- }
- //Printing Bandage Count. Further improvement required for better alerting the player when bandage count is lower than 5.
- if(Orion.Count('0x0E21') < 11){
- Orion.Print('0x066d',Orion.Count('0x0E21') + ' Bandages Left.');
- }
- else
- {
- Orion.Print(Orion.Count('0x0E21') + ' Bandages Left.');
- }
- }
- else{
- Orion.Print( '-1', 'Attempting to heal your pet:' + petTwo.Name());
- //Orion.UseObject('bandage');
- var bandageType= '0x0E21';
- Orion.UseType(bandageType);
- Orion.WaitTargetObject(petTwo.Serial());
- Timer = Orion.Now()+6000;
- while (!Orion.InJournal(Msg) && Orion.Now() < Timer)
- {
- Orion.Wait(100);
- }
- //Printing Bandage Count. Further improvement required for better alerting the player when bandage count is lower than 5.
- Orion.Print(Orion.Count('0x0E21') + ' Bandages Left.'); //BandageCount
- }
- }
- else
- {
- Orion.Wait(100);
- }
- }
- Orion.Print('YOU HAVE NO BANDAGES LEFT');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement