Fight.mac (my Monk Quick Fighter script)

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Fight.mac (my Monk Quick Fighter script)

Post by Shin Noir » Tue Aug 05, 2003 8:54 pm

It can be modified pretty easily to be used for other classes. The idea is simple, and really isn't mine originally. This is just my compilation of other people's scripts. Hope you find use of it!

How I use this script:
I simply /alias /fight /mac fight.mac
then create a hotbutton that I press every time I fight a creature ( I placed this hotkey where I usually put the special button)

an example being:
[Assist main tank hotkey]
/assist <Main Tank Name>
/fight

Code: Select all

|#-     Monk Quick Fighter ver 2.1  -  
|#---------------------------------------
|# Last Revision: Sept 5th 2003
|#Feature List:
|*Loops pressing a given button set below
|*Tracks your exp gain per kill
|*Attempt to position you near the target (commented out by default, remove comments if you want it)

|#*****MAJOR NOTICE: THIS MACRO WILL REQUIRE THE FILE npc.ini IN THE SAME DIRECTORY AS THE MACRO FILE!*****

sub Main 
|#Purpose:Set current target to a(8,*) array
/varset a(8,0) "$target(name,clean)" 
/varset a(8,1) $target(level) 
/varset a(8,2) $target(name) 
/varset a(8,3) $target(id) 
|#Purpose:Set current EXP to v56 (used for EXP comparison sub)
/varset v56 $char(exp) 
:CloserAF 
  /if "$target(id)"!="$a(8,3)" /goto :EndAF
  |#Purpose:used for positioning, uncomment below this out if you want to auto-move
|  /if n $target(distance)>10 /sendkey down up 
|  /if n $target(distance)<6 /sendkey down down 
|  /if n $target(distance)<11 /sendkey up up 
|  /if n $target(distance)>5 /sendkey up down 
|  /if n $target(distance)<11 /attack on 
|  /if n $target(distance)>15 /attack off 
|  /face fast nopredict 
  |#End of positioning code chunk
  |#Purpose:use specials (change "Round Kick" to whichever specials you like to use, remove mend\FD if you aren't monk)
    /if n $char(ability,"Round Kick")>0 /doability "Round Kick" 
    /if n $char(ability,"Disarm")>0 /doability "Disarm"  
    /if n $char(ability,"Sense Heading")>0 /doability "Sense Heading" 
    /if n $char(ability,"Mend")>0 { 
      |if below 70%hp, do mend
    /if n $char(hp,pct)<70 /doability "Mend" 
    } 
      |if below 20%hp, turn off attack and FD
    /if n $char(hp,pct)<20 { 
      /attack off 
      /doability "Feign Death" 
      /end 
    } 
   |Loop until you lose your target
  /goto :CloserAF 

:EndAF 
|#Purpose:Target vanished, check if it dies and announce this\call exp comparison
/if $spawn($a(8,3),state)==DEAD  /echo The level $a(8,1) $a(8,0) is dead... 
|#Purpose: Used with positioning, Removes Sticky-Keys after mob dies
|  /sendkey up up 
|  /sendkey up down 
|#End of Sticky-Key removal
|#Purpose: Turn off attack and clear current target
  /call event_exp
  /attack off 
  /varset a(8,3) 0 
/return


|#Exp Comparison Sub Event
sub event_exp 
/delay 1s 
 
/varset v57 $char(exp) 
/varcalc v58 $v57-$v56 
/varcalc v60 100-$char(exp) 
/varcalc v59 $v60/$v58 
  /if n $v58>0 { 
  /echo and you've gained $v58% exp, bringing your total exp to $char(exp)%!! 
   |#Read npc.ini for any entries of last target. (comment from here to next !! area to stop INI saving)
   /if n $ini(npc.ini,"$zone","$a(8,0)")=="notfound" {
    /varset v74 0
   } else {
    /varset v74 $ini(npc.ini,"$zone","$a(8,0)")
   }
   /varcalc v74 $v74+1
   |#Save the data in npc.ini
   /ini npc.ini "$zone" "$a(8,0)" $v74
   |!!
   /echo Don't forget, $v60% left till level, with only $v59 of these mobs to kill. 
    |#display npc.ini data. (comment from here to next !! area to stop INI saving)
    /if n $v74==1.00 {
     /echo This is your first kill of $a(8,0) in $zone.
    } else {
     /echo You've have killed $a(8,0) a total of $int($v74) times in $zone.
    }  
    |!!
   /varset v73 0 
  } else { 
|# Below handles when you don't get exp or just dinged
|# Comment it out if you don't want to hear when you didn't get exp!
  /echo Exp remains at $char(exp)% after kill.
  } 
/return

|# Notes: Thanks to Leezard for the Fighting portion, the exp portion was really done by loadingpleasewait. 
|#        ap50 did a quick add of mend\FD, then lastly Valerian explained ini file manipulation.
Last edited by Shin Noir on Fri Sep 05, 2003 7:19 pm, edited 5 times in total.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Tue Aug 05, 2003 9:09 pm

very nice indeed :)
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Tue Aug 05, 2003 11:31 pm

Oh, I wanted to also note this line of code you can do to this thing to make it "Search and Destroy" at a click of a button.

in your hotkey (assuming you did /alias /fight fight.mac) BEFORE /fight
Add in this line:

/target npc <name>

<name> being what you want to hunt, example:
/target npc "orc pawn"

Then, if you have the positioning on, you'll target the nearest X mob, walk over to it, and start beating on it. It's designed for YOU to be there to press the button and turn on attack, but it's a heck of alot easier than going around searching mindlessly for a dumb mob or being stuck in this huge complex script to find the next mob like I find in the hunter macros (no insult to them though!)

DontShoot
a lesser mummy
a lesser mummy
Posts: 58
Joined: Thu Jun 20, 2002 11:20 am

Post by DontShoot » Wed Aug 06, 2003 2:29 pm

good stuff, I'll have to try this out when I get home (if MQ is working by then). I like the fact that you're not making it totally automated, which is what I have problems with most fighting macros. Personally, I think I'm smarter than a macro can be, assisting the MA or SA if we're pulling 2-3 mobs at a time, etc.

To clarify though, you'd log in, type /alias /fight fight.mac.

then, each time you target a mob, hit the hotbutton with /fight in it?

if that's the case might work really well in conjuction with the assist command...

/assist MA
/fight

on one hotbutton.

/assist SA
/fight

on another

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Fri Aug 08, 2003 1:07 am

Totally. That's the entire idea behind this macro. It's simple, easy to use in many situations.

[hotbutton "Assist"]
/assist <target>
/fight

When you press your assist button it'll snapshot your current EXP in a variable, mash your special attack button (kick, whatever it is) until that target poofs. When it does, it'll report your exp gain, and how many more mobs of that type you need to ding. (you can tweak it report AAexp really easily too)

You can tweak this to announce mob, auto-taunt, bash, ect if you're MA too. (example)

[hotbutton "Assist Me"]
/gsay Assist me on %T !
/fight

<then edit the macro from the round kick and sense heading bash to /doability taunt and /doability bash>

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Fri Aug 08, 2003 3:55 am

Just to cover aspect 3 of your future plans while I was looking at it.. Add this to your specials area.

Code: Select all

    /if n $char(ability,"Mend")>0 {
		/if n $char(hp,pct)<70 /doability "Mend"
	}
	/if n $char(hp,pct)<20 {
		/attack off
		/doability "Feign Death"
		/end
	}
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Fri Aug 08, 2003 6:32 am

Hope to hear comments about my mob counter i just added in. ^^

it brings a new question to me though...

Is there a command to verify an NPC has physically died and turned into a corpse? The counter above only works if you get EXP and it dies without you switching targets. If I could find a way to make it keep track of mobs and triggering the counter when they die after you touch them, it'd work a lot better.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Fri Aug 08, 2003 7:06 am

a corpse of an NPC has the same SpawnID of the NPC that died. set a var with the live NPC's ID, and then when it poofs, check for a corpse with the same ID.

err... at least I'm pretty sure the ID is the same, try it.

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Fri Aug 08, 2003 7:14 am

Ok, I understand the spawnID and how to grab it with $target(id) , but how do you search for a non-targetted object for their id's ?

I mean I could do something like

/varset v69 $target(id)
|#Target poofed, check if it died by /targetting nearest corpse
/target corpse
if n $v69=$target(id) /echo Target really did die !

I guess if it was done really quick as in, right when the mob died it targetted the corpse then lost the target, you wouldn't notice it as the macro runs.... but ick, I hope I can just verify if it's dead without targetting the nearest corpse.

DontShoot
a lesser mummy
a lesser mummy
Posts: 58
Joined: Thu Jun 20, 2002 11:20 am

Post by DontShoot » Fri Aug 08, 2003 7:24 am

Maybe have it count the "You have gained party experience" or "You have gained raid experience" as a kill?

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Fri Aug 08, 2003 7:37 am

Hrrm so something amongts the line of..

---------Button Press /fight---------------
[Current Target Name, ID stored in v69]

Fight_loop:
[Loop Fight Events Until "You have gained prt exp!", then goto: exp_event]
[goto Fight_loop]

exp_event:
[if $ID($v69) is not dead, {]
[then goto fight_loop]
[}else{}
[ tally up and conclude exp\add mob counter }]
-------------------------------------------

Reason I'd have the if ID ($v69) is not dead check is in case you kill another mob that isn't the current target.

The bonus to this idea is it'd allow the macro to change targets and not assume the mob is dead. The downside to this code is it still has a problem if you started the code by targetting a greenie... This code would loop forever.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Fri Aug 08, 2003 7:52 am

um... $spawn(SpawnID,name) perhaps? $spawn(SpawnID,state)?

I hate to be a RTFM kinda guy... but this is from the current readme.html:
Readme.html wrote:$spawn(id,xxx)
Returns information on a spawn
xxx can be: name[clean], surname, id, x, y, z, heading, headingto, state, speed, distance[,nopredict|x|y|z], type, level, gm, class, race, gender, light, pet, master
state can return: STAND, SIT, DUCK, BIND, FEIGN, DEAD
$spawn(id,hp,xxx) returns the spawn's hp: cur, max, pct
$spawn(id,next/prev) returns the id of the next/previous spawn.
$spawn(id,held,xxx) returns the model name for a held slot
xxx can be: right, left, shield

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Try looking in hunter.mac

Post by wassup » Fri Aug 08, 2003 9:05 am

I think hunter.mac has an example of storing the id of a mob you are fighting. When you use hunter.mac you will move to the mob you just killed and loot it.

DontShoot
a lesser mummy
a lesser mummy
Posts: 58
Joined: Thu Jun 20, 2002 11:20 am

Post by DontShoot » Fri Aug 08, 2003 1:11 pm

this macro is not currently doing the "fighting" part, just the mob/xp tracking

DontShoot
a lesser mummy
a lesser mummy
Posts: 58
Joined: Thu Jun 20, 2002 11:20 am

Post by DontShoot » Fri Aug 08, 2003 3:21 pm

Caught the edit thing to get the fight part working

however, it's now "bouncing" back and forth, trying to get the right distance from the mob.