[Script] OrionUO - AutoChivalry

Don't know how something works? Here you will find some useful links. And if you have a question, feel free to ask.
Post Reply
Uforek
Novice Scribe
Posts: 5
Joined: Fri Apr 28, 2023 5:09 pm

[Script] OrionUO - AutoChivalry

Post by Uforek »

Are you a defender of the realm, a champion of honor, and a paragon of virtue? Do you wield the power of chivalry with grace and skill? Then this script is your faithful companion on your noble quest!

Code: Select all

//v1.1
const CASTING_DELAY = "1500";
const CONSECRATE_WEAPON = "Consecrus Arma";
const DIVINE_FURY = "Divinum Furis";
const CONSECRATE_WEAPON_DURATION = "9000";
const DIVINE_FURY_DURATION = "20000";
const STAMINA_THRESHOLD = 0.2;
const SCRIPT_DELAY = "250";

function getDT(prevTime, currTime) {
    return currTime - prevTime;
}

function AutoChivalry() {
    while (true) {
        const now = Orion.Now();
        const divineFuryMsg = Orion.InJournal(DIVINE_FURY, "self");
        const consecrateWeaponMsg = Orion.InJournal(CONSECRATE_WEAPON, "self");

        if (!Player.Dead() && !Player.Hidden()) {
            if (
                Player.MaxStam() - Player.Stam() >
                Player.MaxStam() * STAMINA_THRESHOLD
            ) {
                Orion.Cast("Divine Fury");
                Orion.Wait(CASTING_DELAY);
            }

            if (Player.WarMode()) {
                if (
                    divineFuryMsg == null ||
                    getDT(divineFuryMsg.Timer(), now) > DIVINE_FURY_DURATION
                ) {
                    Orion.Cast("Divine Fury");
                    Orion.Wait(CASTING_DELAY);
                }
            }

            if (Player.WarMode()) {
                if (
                    consecrateWeaponMsg == null ||
                    getDT(consecrateWeaponMsg.Timer(), now) >
                        CONSECRATE_WEAPON_DURATION
                ) {
                    Orion.Cast("Consecrate Weapon");
                    Orion.Wait(CASTING_DELAY);
                }
            }
        }
        Orion.Wait(SCRIPT_DELAY);
    }
}
Update: Fixed cpu issues.
Update: Fixed a major flaw where spells weren't being triggered due to other player journal events.
Update: Removed the ability to bypass warmode. Didn't see the point in casting chivalry spells for no reason.

Note: The script currently casts Divine Fury when you're below 80% stamina. Until I sort out the swing speed vs stamina relationship, this will have to be manually adjusted by the user.
Last edited by Uforek on Fri May 19, 2023 12:25 am, edited 6 times in total.
074769
Passer by
Posts: 2
Joined: Wed Apr 12, 2023 5:58 am

Re: [Script] OrionUO - AutoChivalry

Post by 074769 »

Pretty good, thank you. Noticed a problem, if there are ppl around casting conc weapon, ur conc weapon stops casting.
User avatar
Nalo
Apprentice Scribe
Posts: 13
Joined: Thu May 07, 2020 10:07 pm

Re: [Script] OrionUO - AutoChivalry

Post by Nalo »

074769 wrote:
Tue May 09, 2023 11:18 pm
Pretty good, thank you. Noticed a problem, if there are ppl around casting conc weapon, ur conc weapon stops casting.
Yea...don't use Journal for stuff like this. Just use a Timer
074769
Passer by
Posts: 2
Joined: Wed Apr 12, 2023 5:58 am

Re: [Script] OrionUO - AutoChivalry

Post by 074769 »

Nalo wrote:
Thu May 11, 2023 9:23 pm
074769 wrote:
Tue May 09, 2023 11:18 pm
Pretty good, thank you. Noticed a problem, if there are ppl around casting conc weapon, ur conc weapon stops casting.
Yea...don't use Journal for stuff like this. Just use a Timer
Was fixed, i think he added self, and i updated it and its working without issues.
Post Reply