Author Topic: Magic Resist Script  (Read 2846 times)

0 Members and 1 Guest are viewing this topic.

Offline soconTopic starter

  • Newbie
  • *
  • Posts: 3
  • Activity:
    0%
  • Reputation Power: 1
  • socon has no influence.
  • Referrals: 0
    • View Profile
Magic Resist Script
« on: March 23, 2022, 03:25:51 PM »
Disclaimer:  I only started using Javascript 3 months ago.  The server I play on provides good magic resist skill gain by walking through fire fields.  I got sick of the mouse action and made a script.  Just make sure you stock enough regeants.  I have my auto bandage script running as well to not drop below 20% health.  If you do drop below 20% health it will hide and pause script.

Code: [Select]
start()

function start()
{
  while(true)
  {
    // Alert if low on regeants
    if(Orion.Count("0x0F8D|0x0F7A|0x0F8C", 'any', 'backpack') < 60 )
      {
        Orion.Sound(61);
        Orion.Print('0xF0000', "LOW FIREFIELD REGEANT COUNT");
      }
    //While your health is greater than 20%
    while(Player.Hits() > Player.MaxHits()/100*20)
      {
        //Cast Firefield on yourelf
        Firefield()
        //Find the fire on the ground.  On this server always 5 tiles long.
        var fire = Orion.FindType('0x398C','any',ground, 'item', 150);
        //Find the first fire tile
        var fireobj0 = Orion.FindObject(fire[0]);
        //find the last fire tile
        var fireobj4 = Orion.FindObject(fire[4]);
        //while there is fire on the ground and your health is greater than 20%
        while(Orion.FindType('0x398C','any',ground, 'item', 150).length > 0 && (Player.Hits() > Player.MaxHits()/100*20))
        {
          //run back and forth between first tile of fire and last tile of fire
          Orion.WalkTo(fireobj0.X()-2,fireobj0.Y(),1,1,255,1);
          Orion.WalkTo(fireobj4.X()+2,fireobj4.Y(),1,1,255,1);
        }
      }
    //If we do get too low, lets get our of the way and hide and pause. 
    if(Player.Hits() < Player.MaxHits()/100*20)
      {
        Orion.Print("HITS TOO LOW, BAILING OUT")
        Orion.WalkTo(fireobj0.X()-2,fireobj0.Y()+5,1,1,255,1);
        Orion.UseSkill('Hiding');
        Orion.Wait(4000);
        Orion.PauseScript();
      }
    }

}
function Firefield() {
    Orion.Cast('Fire field')
    Orion.Wait(900);
    Orion.TargetObject(self);
    Orion.Wait(3000)
}
« Last Edit: March 23, 2022, 03:38:35 PM by socon »

Tags: