[EasyUO] Shindaril's Weapon Special Moves

If you make a Client-side script you can publish it here for other players to use
Locked
Shindaril
Grandmaster Scribe
Posts: 96
Joined: Tue Jul 01, 2014 12:11 pm

[EasyUO] Shindaril's Weapon Special Moves

Post by Shindaril »

Greetings and Merry Christmas to each and everyone!

It's once again the Christmas and as my personal thank you for yet another great year on Excelsior, I present you yet another weapon special moves spammer script. During the last year, my main script grew and grew to the point, it slowed down so much that it couldn't keep up with my character's abilities, so I decided to divide it over multiple scripts and this is the first one of those.
WeaponSpecialMoves.png
WeaponSpecialMoves.png (14.82 KiB) Viewed 2425 times
It's simple, fast and reliable, even though it does need to be adjusted if you're suffering from latency. This can be done easily by increasing the value of %Wait variable. Other things you need to be aware of:

-When you run the script, make sure your weapon special moves and Momentum Strike are turned off. Otherwise the script will not be able to turn them on properly
-You need to use the built in weapon switcher to gain benefit from the "Smart Mode", which adjusts your special move by the weapon wielded and the amount of creatures within your striking range
-The list of creature types is not complete, though it should have most of the creatures listed. When you find a creature not in the list, simply add that into the %Creature listing
-It's easier to add the IDs of the weapons you're using to the script, even though there's a setup button for setting your weapons while the script is running. These are not saved so unless the IDs are listed in the script, you'll have to run the setup every time you run the script
-The two setup buttons are both labeled as "Setup", but I think it's quite obvious which one is for the ability icons and which one for weapons
-It's possible that the "Clear" button causes primary ability set. This is due to lag when the ability icon's hue is read before it's set. At this moment, the script is already turned off for the weapon special moves. You can, however, press the "Clear" button again and it should set the primary move off as well. Useful when making changes to the script as it's assumed that the weapon special moves are all turned off when the script is run

Code: Select all

; Shindaril's Weapon Special Moves
; Version 1.0.14
; Date: 2.12.2015
; First version created on 27.11.2015

; Features:
; -Automatically spams your weapon special moves
; -Automatically changes your chosen weapon special move to whirlwind if your weapon has that move, or momentum strike when more than 1 creature is within the range
; -Automatically sets the range to 10 when you are using a bow, or 1 if you're using a melee weapon. This is used to detect the amount of possible targets within the weapon's range
; -Three slot weapon switcher. You really need to use this if you wish to use the "Smart mode" for the weapon abilities. Otherwise the script cannot tell what weapon you're holding
; -Menu button for re-arming your weapon. This is not automated as this script doesn't detect spellcasting, so re-arming would mess up for those who have no Spell Channelling in their weapons


set %AbilityMinMana 75               ; Mana percentage for weapon abilities
set %SmartAbility #True              ; Change to #False if you wish the "Smart Mode" to be off when the script is started
set %WeaponBag #BackPackID           ; The container in which you carry your weapons in - This container needs to be open when you're switching your weapons
set %Weapon1 XXXXXXX ; null          ; Set the item id's of your weapons here, you can run the setup for weapons to change them while the script is running
set %Weapon2 null
set %Weapon3 null
set %Wait 6                          ; Increase this if the weapon switching/re-arming messes due to latency

; List of creatures detected by the script. Most likely missing some creatures as I've been adding here when I meet something I haven't yet listed
set %Creature ED_UGB_UAB_TAB_LHB_GHB_HBB_YAB_QO_UE_SD_K_J_U_HD_BD_UI_IH_FE_AE_GH_PH_
        +FH_QE_AB_QF_AB_X_XE_YE_CD_DF_ZC_WI_WE_OD_YD_TI_II_BF_WD_EF_NO_CF_VI_R_WI_BD_
        +PE_KD_JB_ED_OJ_TH_FJ_PG_OE_BI_UB_CI_JD_ED_QD_YE_OD_BD_V_SE_HH_VE_XF_PG_OE_BI_FD_
        +HI_RF_ME_MD_MC_N_LC_YH_Q_KE_TM_CC_FN_KH_WH_PI_CN_VM_HF_OC_TO_LO_FO_RO_PO_QO_IJB_
        +CHB_TC_PJ_BE_W_UD_UC_N_NB_PB_V_UC_GJ_AF_GI_ND_WC_QJ_VC_KI_P_DD_BN_UF_XC_ZAB_EF_IJ_
        +JH_BH_VF_DG_IB_PE_KD_WI_JB_ED_TH_OJ_NH_QGB_ON_CO_SH_SC_NO_EC_Z_UJ_WM_EN_TJ_KHB_JHB_
        +BG_DN_VJ_ABB_DO_XH_WGB_L_FM_HL_I_
         +HS_IS_                     ; Male and female humans, shouldn't target NPC's or other players, even guildmates should be safe as should pets

; You should not need to edit anything below this
         
set #sCnt2 0
set %MaxRange 1                     ; Max range from the character for the search check for creatures
set %AbilityWait 5                  ; To slow down weapon ability spamming
set %AbilityTimer #sCnt2 - %AbilityWait                            ;
set %Ability 0                       ; Stores the selected weapon ability
set %ActionWait 15                   ; Timer for actions such as re-mounting
set %ActionTimer #sCnt2 - %ActionWait

set %WW 0
set %WWPrim RMH_YTH_XFR_FDP_ZTH_GFF_
; Large Battle Axe, Halberd, Radiant Scimitar, Kama, War Hammer, Black Staff
set %WWSec NSF_
; Double Axe
set %Bow WOH_USF_LMH_QPO_XCP_PPO_WER_PFR_
; Bow, Crossbow, Heavy Crossbow, Composite Bow, Repeating Crossbow, Yumi, Elven Composite Longbow, Magical Shortbow

set %CurrentWeapon null
set %Weapon1WWState 0
set %Weapon2WWState 0
set %Weapon3WWState 0
gosub ActiveWeapon
if #Result = null
{
    set %Weapon1 null
    set %Weapon2 null
    set %Weapon3 null
    set %CurrentWeapon null
    event ExMsg #CharID 0 20 Cannot find any of the pre-set weapon IDs equipped, weapon selection is now disabled.
}
else
{
    set %CurrentWeapon #Result
    gosub CheckWeapon %Weapon1
    set %Weapon1WWState #Result
    gosub CheckWeapon %Weapon2
    set %Weapon2WWState #Result
    gosub CheckWeapon %Weapon3
    set %Weapon3WWState #Result
}
if %CurrentWeapon = %Weapon1
{
    set %WW %Weapon1WWState
}
if %CurrentWeapon = %Weapon2
{
    set %WW %Weapon2WWState
}
if %CurrentWeapon = %Weapon3
{
    set %WW %Weapon3WWState
}

if *Save <> 1
{
    gosub Setup
}
gosub Init

sub DrawMenu
    menu clear
    set #menubutton none
    menu show
    menu Window Title Special Moves
    menu window color $FF99FF
    menu window transparent 95
    menu window size 66 158
    menu Font Name Gautami
    menu Font Size 8
    menu Font Style b
    menu Font BGColor $FF99FF
    menu Font Color $0000DD

    menu button Primary 3 3 60 20 Primary
    menu button Secondary 3 23 60 20 Secondary
    menu button Momentum 3 43 60 20 Momentum
    menu button Clear 3 63 60 20 Clear

    menu button SmartOn 3 88 60 20 Smart On
    menu button SmartOff 3 108 60 20 Smart Off
    
    menu button Setup 3 135 60 20 Setup
    
    menu button ReArm 66 3 60 20 Re-Arm

    if %Weapon1 <> null
    {
        menu button Weapon1 66 68 60 20 Weapon1
    }
    else
    {
        menu text W1NA 66 68 Not Available!
    }
    if %Weapon2 <> null
    {
        menu button Weapon2 66 88 60 20 Weapon2
    }
    else
    {
        menu text W2NA 66 88 Not Available!
    }
    if %Weapon3 <> null
    {
        menu button Weapon3 66 108 60 20 Weapon3
    }
    else
    {
        menu text W3NA 66 108 Not Available!
    }
    menu button WeapSetup 66 135 60 20 Setup
    menu show
    return

gosub DrawMenu

event ExMsg #CharID 0 20 Weapon Specials Script Started

while #True
{
    gosub CheckMenu
    if #CharGhost = NO && %AbilityTimer + %AbilityWait <= #sCnt2 && %Ability <> 0
    {
        if %SmartAbility = #True && %Ability <> 0
        {
            gosub SmartAbility
        }
        else
        {
            gosub Ability %Ability %AbilityIconX %AbilityIconY %AbilityColorTest %AttackEventMacroParam1 %AttackEventMacroParam2
        }
    }
    else
    {
        wait 5
    }
}

sub CheckMenu
    if #MenuButton = Primary
    {
        set #MenuButton #False
        set %Ability 1
        set %AbilityIconX *PrimaryX
        set %AbilityIconY *PrimaryY
        set %AbilityColorTest %PrimaryColour
        set %AttackEventMacroParam1 35
        set %AttackEventMacroParam2 0
    }
    if #MenuButton = Secondary
    {
        set #MenuButton #False
        set %Ability 2
        set %AbilityIconX *SecondaryX
        set %AbilityIconY *SecondaryY
        set %AbilityColorTest %SecondaryColour
        set %AttackEventMacroParam1 36
        set %AttackEventMacroParam2 0
    }
    if #MenuButton = Momentum
    {
        set #MenuButton #False
        set %Ability 3
        set %AbilityIconX *MomentumX
        set %AbilityIconY *MomentumY
        set %AbilityColorTest %MomentumColour
        set %AttackEventMacroParam1 15
        set %AttackEventMacroParam2 150
    }
    if #MenuButton = Clear
    {
        set #MenuButton #False
        set %Ability 0
        gosub ClearAbility
    }
    if #MenuButton = Setup
    {
        set #MenuButton #False
        gosub Setup
    }
    if #MenuButton = SmartOn
    {
        set #MenuButton #False
        set %SmartAbility #True
    }
    if #MenuButton = SmartOff
    {
        set #MenuButton #False
        set %SmartAbility #False
    }
    if #MenuButton = ReArm
    {
        set #Menubutton #False
        gosub ReArm
    }
    if Weapon in #menubutton
    {
        str right #MenuButton 1
        set #MenuButton #False
        gosub SwitchWeapon %Weapon . #StrRes %CurrentWeapon
    }
    if #MenuButton = WeapSetup
    {
        set #MenuButton #False
        gosub WeaponSetup
    }
    return

sub SmartAbility
    finditem %Bow C_ , #CharID
    if #FindKind <> -1
    {
        set %MaxRange 10
    }
    else
    {
        set %MaxRange 1
    }
    IgnoreItem #CharID 1
    finditem %Creature G_ , %MaxRange
    if #FindKind <> -1 && #FindRep > 2 && #FindRep < 7 || #FindType in WH_SH_SC_RC_HJ_SJ_        ; #FindRep 1=blue, 2=friend, 7=yellow, so this one attacks grey's (including animals listed), orange and reds
    {
        if #FindCnt > 1
        {
            if %WW = 1
            {
                gosub Ability 1 *PrimaryX *PrimaryY %PrimaryColour 35 0
            }
            if %WW = 2
            {
                gosub Ability 2 *SecondaryX *SecondaryY %SecondaryColour 36 0
            }
            if %WW = 0
            {
                gosub Ability 3 *MomentumX *MomentumY %MomentumColour 15 150
            }
        }
        else
        {
            gosub Ability %Ability %AbilityIconX %AbilityIconY %AbilityColorTest %AttackEventMacroParam1 %AttackEventMacroParam2
        }
    }
    else
    {
        gosub Ability %Ability %AbilityIconX %AbilityIconY %AbilityColorTest %AttackEventMacroParam1 %AttackEventMacroParam2
    }
    IgnoreItem reset 1
    return

;             gosub Ability %Ability %AbilityIconX %AbilityIconY %AbilityColorTest %AttackEventMacroParam1 %AttackEventMacroParam2
;             %0 = 6        %1       %2            %3            %4                %5                      %6

sub Ability
    if ( ( #Mana * 100 ) / #MaxMana > %AbilityMinMana )
    {
        savePix %2 %3 5

        set %AbilityTimer #sCnt2

        if ( #PixCol = %4 )
        {
            event macro %5 %6

            if %1 = 1
            {
                savePix %2 %3 5
                if ( #PixCol <> %4 )
                {
                    set %PrimaryOnColour #PixCol
                }
            }
            if %1 = 2
            {
                savePix %2 %3 5
                if ( #PixCol <> %4 )
                {
                    set %SecondaryOnColour #PixCol
                }
            }
        }
        else
        {
            if ( %1 = 1 ) && ( #PixCol <> %PrimaryOnColour )
            {
                savepix *PrimaryX *PrimaryY 1
                set %PrimaryColour #PixCol
                set %AbilityColorTest %PrimaryColour
            }
            if ( %1 = 2 ) && ( #PixCol <> %SecondaryOnColour )
            {
                savepix *SecondaryX *SecondaryY 2
                set %SecondaryColour #PixCol
                set %AbilityColorTest %SecondaryColour
            }
        }
    }
    return

sub ReArm
    finditem %CurrentWeapon C_ , #CharID
    if #FindKind = -1
    {
        if ( %ActionTimer + %ActionWait ) <= #sCnt2
        {
            set %AbilityTimer %AbilityTimer + 12
            if %CurrentWeapon = %Weapon1
            {
                exevent drag %Weapon1
                wait %Wait
                exevent droppd
                wait %Wait
                set %WW %Weapon1WWState
            }
            if %CurrentWeapon = %Weapon2
            {
                exevent drag %Weapon2
                wait %Wait
                exevent droppd
                wait %Wait
                set %WW %Weapon2WWState
            }
            if %CurrentWeapon = %Weapon3
            {
                exevent drag %Weapon3
                wait %Wait
                exevent droppd
                wait %Wait
                set %WW %Weapon3WWState
            }
            set %ActionTimer #sCnt2
        }
    }
    return

sub SwitchWeapon
    if ( %ActionTimer + %ActionWait ) <= #sCnt2 && %1 <> %2
    {
        set %AbilityTimer %AbilityTimer + 12
        exevent drag %2
        wait %Wait
        exevent dropc %WeaponBag
        wait %Wait
        exevent drag %1
        wait %Wait
        exevent droppd
        wait %Wait
        set %CurrentWeapon %1
        if %1 = %Weapon1
        {
            set %WW %Weapon1WWState
        }
        if %1 = %Weapon2
        {
            set %WW %Weapon2WWState
        }
        if %1 = %Weapon3
        {
            set %WW %Weapon3WWState
        }
        set %ActionTimer #sCnt2
    }
    return

sub CheckWeapon
    finditem %1 C_ , %WeaponBag
    if #FindKind <> -1
    {
        if #FindType in %WWPrim
        {
        return 1
        }
        if #FindType in %WWSec
        {
        return 2
        }
        return 0
    }
    finditem %1 C_ , #CharID
    if #FindKind <> -1
    {
        if #FindType in %WWPrim
        {
        return 1
        }
        if #FindType in %WWSec
        {
        return 2
        }
        return 0
    }
    return

sub ClearAbility
    savePix *PrimaryX *PrimaryY 4
    if ( #PixCol <> %PrimaryColour )
    {
        event macro 35 0
    }
    savePix *SecondaryX *SecondaryY 4
    if ( #PixCol <> %SecondaryColour )
    {
        event macro 36 0
    }
    savePix *MomentumX *MomentumY 4
    if ( #PixCol <> %MomentumColour )
    {
        event macro 15 150
    }
    wait 2s
    return

; Setup Subs

sub Setup
    display Please move your cursor over the Primary Ability Icon. You have 3 seconds to do so.
    wait 3s
    set *PrimaryX #CursorX
    set *PrimaryY #CursorY

    display Please move your cursor over the Secondary Ability Icon. You have 3 seconds to do so.
    wait 3s
    set *SecondaryX #CursorX
    set *SecondaryY #CursorY

    display Please move your cursor over the Momentum Strike Ability Icon. You have 3 seconds to do so.
    wait 3s
    set *MomentumX #CursorX
    set *MomentumY #CursorY

    savePix *PrimaryX *PrimaryY 1
    set %PrimaryColour #PixCol
    savePix *SecondaryX *SecondaryY 2
    set %SecondaryColour #PixCol
    savePix *MomentumX *MomentumY 3
    set %MomentumColour #PixCol
    set *Save 1
    event ExMsg #CharID 0 20 Abilities re-set
    wait %Wait
    return

sub WeaponSetup
    display okcancel Target the first weapon
    if #dispRes = ok
    {
        set #lTargetID null
        set #TargCurs 1
        Weapon1:
        if #lTargetID = null
        {
            goto Weapon1
        }
        set %Weapon1 #lTargetID
        gosub CheckWeapon %Weapon1
        set %Weapon1WWState #Result
    }
    else
    {
        set %Weapon1 null
    }
    display okcancel Target the second weapon
    if #dispRes = ok
    {
        set #lTargetID null
        set #TargCurs 1
        Weapon2:
        if #lTargetID = null
        {
            goto Weapon2
        }
        set %Weapon2 #lTargetID
        gosub CheckWeapon %Weapon2
        set %Weapon2WWState #Result
    }
    else
    {
        set %Weapon2 null
    }
    display okcancel Target the third weapon
    if #dispRes = ok
    {
        set #lTargetID null
        set #TargCurs 1
        Weapon3:
        if #lTargetID = null
        {
            goto Weapon3
        }
        set %Weapon3 #lTargetID
        gosub CheckWeapon %Weapon3
        set %Weapon3WWState #Result
    }
    else
    {
        set %Weapon3 null
    }
    gosub ActiveWeapon
    if #Result = null
    {
        set %Weapon1 null
        set %Weapon2 null
        set %Weapon3 null
        set %CurrentWeapon null
        event ExMsg #CharID 0 20 Cannot find any of the pre-set weapon IDs equipped, weapon selection is now disabled.
    }
    else
    {
        set %CurrentWeapon #Result
    }
    gosub DrawMenu
    return

sub Init
    savePix *PrimaryX *PrimaryY 1
    set %PrimaryColour #PixCol
    savePix *SecondaryX *SecondaryY 2
    set %SecondaryColour #PixCol
    savePix *MomentumX *MomentumY 3
    set %MomentumColour #PixCol
    set *Save 1
    wait %Wait
    return

sub ActiveWeapon
    finditem %Weapon1 C_ , #CharID
    if #FindKind <> -1
        return #FindID
    finditem %Weapon2 C_ , #CharID
    if #FindKind <> -1
        return #FindID
    finditem %Weapon3 C_ , #CharID
    if #FindKind <> -1
        return #FindID
    return null
Happy Holidays!
Sincerly,
-Shindaril
User avatar
Sailor Jerry
Elder Scribe
Posts: 114
Joined: Sun Sep 06, 2015 7:31 pm
Location: WA USA
Contact:

Re: [EasyUO] Shindaril's Weapon Special Moves

Post by Sailor Jerry »

WOW very nice present to wake up to :) Thank you!
Full throttle, half-bottle, fun lovin, script huggin gamer nerd...
a Napa Valley 1 Percenter
Locked