Author Topic: Orion Snippets!  (Read 8163 times)

0 Members and 1 Guest are viewing this topic.

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 83
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Orion Snippets!
« on: May 12, 2022, 12:13:40 AM »
 Been away for a while, was glad to see some interest in the client while i was gone! Decided to throw this up for some of the newer people getting into Orion. I'll post up some examples i know are sought after, and add any smaller functions i can that people ask for. Ive got a couple big projects i was close to wrapping up when i left, looking forward to grinding those out!

This will simply attack the nearest neutral target within the range set by var range = 12, up to a max of 24. While the target exists, it will keep your lightning strike up.
Code: [Select]
function attackNearestMob(){
    var target, range = 12;

    var mobs = Orion.FindTypeEx(any, any, ground, 'mobile|live|inlos', 8, 'gray|enemy').sort(function(a, b){
        return a.Distance() - b.Distance();
    })[0];
    if(mobs){
        Orion.Print("Attacking " +mobs.Name());
        if(mobs.Hits("%") == 100){
            Orion.AddWaitTargetObject(mobs.Serial());
            Orion.InvokeVirtue('Honor');
        }
        Orion.Attack(mobs.Serial());
        while(mobs.Exists()){
            if(Player.Mana() > 10 && !Orion.BuffExists('Lightning Strike'))
                Orion.Cast('Lightning Strike');
            Orion.Wait(500);
        }
        Orion.Print("Target dead");
    } else {
        Orion.Print("No targets found");
    }
}

This is the same function, rewritten for animal tamers. It will sick your pet on the nearest target.
Code: [Select]
function petAttackNearest(){
    var target, range = 12;

    var mobs = Orion.FindTypeEx(any, any, ground, 'mobile|live|inlos', 8, 'gray|enemy').sort(function(a, b){
        return a.Distance() - b.Distance();
    })[0];
    if(mobs){
        Orion.AddWaitTargetObject(mobs.Serial());
        Orion.Say("All kill");
    } else {
        Orion.Print("No targets found");
    }
}

This one will ask you to target a pet, unless you already have. Then will watch your pets health until you move. If you are in range, and have bandages, it will apply as needed. Otherwise, it will check your magery skill and mana for a ranged cure/heal.
Code: [Select]
function vetPet(){
    var pet, startX = Player.X(), startY = Player.Y();
    if(!Orion.FindObject('pet')){
        Orion.Print("Select your pet");
        Orion.WaitForAddObject('pet');
    }
    pet = Orion.FindObject('pet');
    if(!pet)
        return;
    Orion.Print("Starting Auto Vet");
    while(Player.X() == startX && Player.Y() == startY){
        if(pet.Poisoned()){
            if(pet.Distance() < 3 && Orion.Count(bandages) > 0 && !Orion.BuffExists('vet'))
                Orion.BandageTarget('pet');
            else if(Orion.SkillValue('Magery') > 400 && Player.Mana() > 20)
                Orion.Cast('Arch Cure', 'pet');
        } else if(pet.Hits("%") < 90){
            if(pet.Distance() < 3 && Orion.Count(bandages) > 0 && !Orion.BuffExists('vet'))
                Orion.BandageTarget('pet');
            else if(Orion.SkillValue('Magery') > 500 && Player.Mana() > 25)
                Orion.Cast('Greater Heal', pet.Serial());
        }
        Orion.Wait(250);
    }
    Orion.Print("Auto Vet Ended");
}

Simple vacuum function for grabbing gold piles.
Code: [Select]
function vacuum(){
Orion.FindType('0x0EED', '0xFFFF', 'ground', 'item|inlos|near', 2).forEach(function(gold){
Orion.MoveItem(gold, 0, backpack);
Orion.Wait('moveitemdelay');
});
}

This is a really basic travel function. Use travel(runebook.Serial(), 'gate', 1); To gate travel to the first location in your book, for example.
Code: [Select]
function travel(book, method, rune){
    var startX = Player.X(), startY = Player.Y();
    if(method == 'recall')      // Recall
        rune += 49;
    else if(method == 'gate')   // Gate
        rune+=99;
    else   
        rune += 74;             // Sacred Journey
       
    Orion.UseObject(book);
    Orion.WaitGump(Orion.CreateGumpHook(rune));
    if(method == 'gate'){
        while(!Orion.FindType(0x0F6C, any, ground))
            Orion.Wait(500);
        while(Player.X() == startX && Player.Y() == startY){
            Orion.Wait(2000);
            Orion.UseFromGround(0x0F6C, any, 2);
            Orion.WaitGump(Orion.CreateGumpHook(1));
        }
        Orion.CancelWaitGump();
    }
}





 


Offline seanriter

  • Newbie
  • *
  • Posts: 3
  • Activity:
    0%
  • Reputation Power: 1
  • seanriter has no influence.
  • Referrals: 0
    • View Profile
Re: Orion Snippets!
« Reply #1 on: November 06, 2023, 06:44:19 AM »
Hi, thank you for this.

Offline donghwan

  • Newbie
  • *
  • Posts: 6
  • Activity:
    0%
  • Reputation Power: 1
  • donghwan has no influence.
  • Referrals: 0
    • View Profile
Re: Orion Snippets!
« Reply #2 on: November 06, 2023, 05:11:02 PM »
thx a lot.

Is it possible to have a script that automatically insurance items that come in the bag?

:)

Tags: