Page 1 of 1

Parallelised npc aggro list auto atk

Posted: Sun Nov 20, 2016 9:15 pm
by moguay
For the Fun, A sample to build and auto launch a parallelised attack command to a raid for optimize the farming.

The aim being to optimally launch/manage all raid alt with the aggro npc list. This in order to save farming time.

Code: Select all

Sub command-guard

   /if (${Me.XTarget}>0 && ${SpawnCount[npc targetable radius 30 zradius 10 noalert 1]}) {

        /declare intMainBotCount int local 0
        /declare intSecBotCount int local 0
        /declare intAltBotCount int local 0
        /declare strMainBot string local
        /declare strSecBot string local
        /declare strAltBot string local

        /declare intXTarget int local

        /if (!${Defined[j]})            /declare j int local                0
        /if (!${Defined[k]})            /declare k int local                0
        /if (!${Defined[l]})            /declare l int local                0

        /for k 1 to 50
            /if (!${Defined[strAttackID${k}]}) /declare strAttackID${k} int outer
            /if (!${Defined[strAttackList${k}]}) /declare strAttackList${k} string outer
        /next k

        /varset intMainBotCount 0
        /varset intSecBotCount 0
        /varset intAltBotCount 0
        /varset strMainBot
        /varset strSecBot
        /varset strAltBot

        | Analyse primary offtank, secondary offtank, and the DPS alt
        /for l 1 to ${NetBots.Counts}
            /if (${NetBots[${NetBots.Client.Arg[${l}, ]}].ID}!=${Me.ID} && ${Spawn[id ${NetBots[${NetBots.Client.Arg[${l}, ]}].ID}].Distance} < 150) {
                /if (${Select[${Spawn[id ${NetBots[${NetBots.Client.Arg[${l}, ]}].ID}].Class.ShortName},WAR,PAL,SHD]}) {
                    /varcalc intMainBotCount ${intMainBotCount} + 1
                    /if (!${strMainBot.Length}) {
                        /varset strMainBot ${NetBots.Client.Arg[${l}, ]}
                    } else {
                        /varset strMainBot ${strMainBot} ${NetBots.Client.Arg[${l}, ]}
                    }
                } else /if (${Select[${Spawn[id ${NetBots[${NetBots.Client.Arg[${l}, ]}].ID}].Class.ShortName},ROG,BER,MNK]}) {
                    /varcalc intSecBotCount ${intSecBotCount} + 1
                    /if (!${strSecBot.Length}) {
                        /varset strSecBot ${NetBots.Client.Arg[${l}, ]}
                    } else {
                        /varset strSecBot ${strSecBot} ${NetBots.Client.Arg[${l}, ]}
                    }
                } else /if (${Select[${Spawn[id ${NetBots[${NetBots.Client.Arg[${l}, ]}].ID}].Class.ShortName},ROG,BER,BRD,MNK,RNG,WAR,PAL,SHD,BST,DRU,ENC,MAG,WIZ,NEC]}) {
                    /varcalc intAltBotCount ${intAltBotCount} + 1
                    /if (!${strAltBot.Length}) {
                        /varset strAltBot ${NetBots.Client.Arg[${l}, ]}
                    } else {
                        /varset strAltBot ${strAltBot} ${NetBots.Client.Arg[${l}, ]}
                    }
                }
            }
        /next l

        | Combine the offtank
        /if (${intMainBotCount} < ${Me.XTarget}) {
            /varcalc intMainBotCount ${intMainBotCount} + ${intSecBotCount}
            /varset strMainBot ${strMainBot} ${strSecBot}
        }

        | Build the max XTarget
        /if (${intMainBotCount} >= ${Me.XTarget}) {
            /varset intXTarget ${Me.XTarget}
        } else {
            /varset intXTarget ${intMainBotCount}
        }

        | Exit if no Offtank
        /if (!${intXTarget}) /return

        /varset k 0
        /for j 1 to 5
            /if (${Me.XTarget[${j}].ID}) {
                /varcalc k ${k} + 1

                /if (!${Spawn[id ${strAttackID${j}}].ID}!=NULL) {
   
                    | Add offtank in each list
                    /varset strAttackID${j} ${Me.XTarget[${j}].ID}
   
                    | Add DPS in each list
                    /varset strAttackList${j} ${strMainBot.Arg[${k}, ]}
                    /for l 1 to ${Int[${Math.Calc[${intAltBotCount} / ${intXTarget}]}]}
                        /varset strAttackList${j} ${strAttackList${j}}|${strAltBot.Arg[${Math.Calc[((${k} - 1) * ${Int[${Math.Calc[${intAltBotCount} / ${intXTarget}]}]}) + ${l}]}, ]}
                    /next l
   
                    | The ATK Command
                    /bc PAttack|${Me.XTarget[${j}].ID}|${strAttackList${j}}
                }
            } else {
                | Clear List
                /varset strAttackID${j}
                /varset strAttackList${j}
            }
        /next j
    }

/return

In the preview: first the Main, after the command, the NPC ID, Offtank, and to finish the DPS
The offtank is selected automatically by priority class, and the dps is distributed according to the aggo list.

Re: Parallelised npc aggro list auto atk

Posted: Thu Sep 07, 2017 7:00 pm
by moguay
Massive Attack command in action : https://youtu.be/XUUvpzOq1co

Re: Parallelised npc aggro list auto atk

Posted: Thu Sep 07, 2017 7:58 pm
by Sian
freak :twisted: !!...lagging freak :mrgreen: ;)

Re: Parallelised npc aggro list auto atk

Posted: Thu Sep 07, 2017 10:56 pm
by Lillu
I think Moguay is an alien but surely not human. :P