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.
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.
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.
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.
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.
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();
}
}