ScriptUO

Scripting Resources & Utilities => Orion UO Client => Orion UO Scripts => Topic started by: Vinsanity_1 on November 02, 2023, 07:31:06 PM

Title: Question on primary ability syntax (Whirlwind Attack)
Post by: Vinsanity_1 on November 02, 2023, 07:31:06 PM
Hello all,

I have recently modified a script to train Bushido with minimum effort. I used this in Yew sheep pen to get my Bushido to 100 as it targets a mob, uses lightning strike, then targets a new mob.

My question is for Whirlwind Attack. Since Whirlwind attack is not a buff, I do not know the language needed to use Whirlwind Attack, wait until it hits a mob, then repeat.

Right now I can only get it to toggle on/off with "wait", which is not optimal. Any help here would be greatly appreciated. Please let me know if you have any questions. Thanks!

-V

p.s. Feel free to use my Bushido sheep pen script below.

Code: Javascript
  1. function attackNearestMob(){
  2. var target, range = 14;
  3.  
  4. for(;;){
  5. var mobs = Orion.FindTypeEx(any, any, ground, 'mobile|live|inlos', 8, 'gray|enemy').sort(function(a, b){
  6. return a.Distance() - b.Distance();
  7. })[0];
  8. if(mobs){
  9. Orion.Print("Attacking " +mobs.Name());
  10. if(mobs.Hits("%") == 100){
  11. Orion.AddWaitTargetObject(mobs.Serial());
  12. Orion.InvokeVirtue('Honor');
  13. }
  14. Orion.Attack(mobs.Serial());
  15. while(mobs.Exists()){
  16. if(Player.Mana() > 10 && !Orion.BuffExists('Lightning Strike'))
  17. Orion.Cast('Lightning Strike');
  18. Orion.Wait(500);
  19. }
  20. Orion.Print("Target dead");
  21. } else {
  22. Orion.Print("No targets found");
  23. Orion.Wait(2000);
  24. }
  25. }
  26. }
Title: Re: Question on primary ability syntax (Whirlwind Attack)
Post by: Gaderian on November 04, 2023, 07:32:56 PM
Is there an orion based test for a special move being active?
The icon will change color whether it is active or not, so there must be some communication between client and server to indicate that. I would think that testing for it would be available in orion, but I have not spent much time coding with that language.

Whirlwind will only clear by hitting more than 1 target, while lightning strike works with a single target. So while you still target 1 opponent for each, you need more than one in range for the special move to happen. I don't remember the timer (2 seconds?) of cool down after a special move where mana cost will be doubled. You need enough mana available to execute the special move as well.

I have a routine in EUO that will swap special moves based on how many targets are in range and do the mana calculations. It works very reliably. The same logic should be available through Orion as well.
Title: Re: Question on primary ability syntax (Whirlwind Attack)
Post by: Vinsanity_1 on November 06, 2023, 06:42:37 PM
Hey, thanks for the reply here, Gaderian.

I was actually thinking of planning ahead for the future, clearing champ spawns with whirlwind attack.

Optimally, I would like to write a script that cycles through and pulls aggro on everything, then whirlwind when there is a big cluster of mobs.

I'll keep hacking away but if anyone would like to share something like that I would really love to dissect and study the script.

-V
Title: Re: Question on primary ability syntax (Whirlwind Attack)
Post by: altiric on November 20, 2023, 07:19:32 AM
Getting to this a little late, but here is some info.

Whirlwind is an AbilityStatus so either AbilityStatus('Primary') or AbiliatyStatus('Secondary'). Here are a couple snippets i use for working with special abilities.

Code: [Select]
function have_ability(name){
    return Orion.Contains(Orion.GetCurrentAbilityNames(), name);
}

Code: [Select]
function ability_status(name){
    const abilities = Orion.GetCurrentAbilityNames();
    if(Orion.AbilityStatus('Primary') && abilities[0].match(new RegExp(name, 'i')))
        return true;
    else if(Orion.AbilityStatus('Secondary') && abilities[1].match(new RegExp(name, 'i')))
        return true;
    else
        return false;
}

Code: [Select]
function use_ability(name){
    const abilities = Orion.GetCurrentAbilityNames();
    const primary = Orion.AbilityStatus('Primary');
    const secondary = Orion.AbilityStatus('Secondary');
    const regex = new RegExp(name, 'i');

    if(abilities[0].match(regex) && !primary){
        Orion.SetTimer('ability', 500);
        Orion.UseAbility('Primary', true);
        Orion.Wait(200);
    } else if(abilities[1].match(regex) && !secondary){
        Orion.SetTimer('ability', 500);
        Orion.UseAbility('Secondary', true);
        Orion.Wait(200);
    } else {
        return false;
    }
}

I set a timer when using an ability so i can calculate the mana cost of abilities, since if you use an ability within 3 seconds of another ability, the cost is doubled.