Loot Nearest Corpse

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Mon Jun 18, 2007 2:59 am

I can't see any reason it would work. What happens if /target isn't done instantly (because it isn't)?

mrwhionyx
decaying skeleton
decaying skeleton
Posts: 2
Joined: Thu Apr 12, 2007 5:27 am

Post by mrwhionyx » Mon Jun 18, 2007 8:22 am

I was under the imprestion that the 2nd macro would target npc corpse, open loot window, then loot all the items off a corpse, close window. As long as it was in the 120 range, and there was a corpse on the ground, it would not matter if it was a fresh kill or one that had been sitting.

Here is my problem, I cast a few AoE DD on about 20 mobs and kill them outright. Now, looting them is a problem. /target npc corpse has been a saving grace.

So please stop me right here if I'm wrong (Always willing to admit defeat) But this macro was designed to do that, even if you have to run it for each corpse. If not is there anything close to do that? I've tryed to do it myself, after trolling the forums for hours, But have spent a fair few hours getting it wrong. Scapped all works in progress in dissguist.

noober
a lesser mummy
a lesser mummy
Posts: 71
Joined: Mon Mar 08, 2004 4:09 pm

Post by noober » Thu Jun 28, 2007 11:13 pm

I modified the original code to work for me, this loots any corpse(s) near the radius set on nc.

***Edit:Made a change to set the loot radius in the variable of the same name. This macro does not make any checks so beware. ***

Code: Select all

Sub LootCorpses
    /declare nc int local 0
    /declare cslot int local 0
    /declare nitems int local 0
    /declare radius int local 0
    /varset radius 100
    /varset nc ${SpawnCount[los corpse radius ${radius}]}
    /if (!${nc}) /return
    /delay 1s
    /hidecorpses none
:lootit
    /target corpse
    :movetocorpse
    /if (${Math.Distance[${Me.Y},${Me.X}:${Target.Y},${Target.X}]}>6) {
        /face fast nolook
        /keypress forward hold
        /goto :movetocorpse
    }
    /keypress forward
    /face fast nolook
    /loot
    /if (${Corpse.Open}) {
        /delay 1s
        /if (${Corpse.Items}) {
            /varset nitems ${Corpse.Items}
            /for cslot 1 to ${nitems}
                /delay 1s
                /echo Corpse has ${nitems} items left
                /echo Looting slot ${cslot}
                /itemnotify Loot${cslot} leftmouseup 
                /delay 1s 
                /if (${Window[ConfirmationDialogBox].Open}) { 
                    /notify ConfirmationDialogBox Yes_Button leftmouseup 
                    /delay 1s 
                }
                /autoinventory
                /delay 1s
            /next cslot
        }
        /notify LootWnd DoneButton leftmouseup
    }
    /if (${SpawnCount[los corpse radius ${radius}]}) /goto :lootit
/return