HateList.mac - Proof of Concept

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

Moderator: MacroQuest Developers

Post routines like this, or should I only post finished scripts?

Poll ended at Sun Oct 27, 2002 10:32 pm

Keep coming with the routines, I like to copy and paste!
8
89%
Don't waste my time, come back in 6 weeks with your completed .MAC. Details bore me.
1
11%
 
Total votes: 9

Nerfy
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Oct 15, 2002 11:37 am

HateList.mac - Proof of Concept

Post by Nerfy » Sun Oct 20, 2002 11:29 pm

So I've been messing around with hunter scripts. Keep having problems to the point that I have to intervene if something aggros on me. Then I remembered how Verant does it - they keep a hate list. So here you go, the code to maintain a hate list. I'm working it into a hunter now, but since the weekend's over (and I know I won't be scripting much during the week) I thought I'd publish the working portions.

Modify the targets so that they outline 3 NPCs in the zone you're testing in. There's no fight code in here, so don't worry about dying. It simply targets the NPCs, and then orders them in an array based on their level.

Ideas I want to do but would like for others to do so that I can be lazy:

- Have a 'RunAway' variable. Weight it based on the number in the list. Say the if RunAway => 1 then /call RunRunRun where RunRunRun does it's best to get you the hell outta dodge. Then we can work on a mathimatical formula for the variable RunAway. Say, each full blue on you counts as .5, each even con as .9, and each greenie as .2. Yellows and higher are worth 1. Really want to make it smart? Factor health into it. If I'm at half I want to run from a full blue.

- Smarten up the hate. This would be easy, I just wanted to keep my code clean. Say, if it's a caster then add .5 to the level. Then it attacks a 10 caster before a 10 melee, but will still go after that 11 brute.

Anyway, as I said I'm still working on a hunter script - using a lot of Fippys concepts in it (that one he did was incredible, just reading through it made this language make sense to me). Let me know if there are any questions / suggestions and please, if you use this then at least PM me so that I can see what you did with it. Enjoy :).




Code: Select all


|
|  HateList.mac
|
|  By Nerfy
|  Status: Proof of concept
|
|  This just demos a hatelist array.  Keeps meanest mob in 
|  top position. Idealy you could keep casting mob in top
|  position, or the main mob you're hunting.  This way you 
|  can keep a list of mobs to track down - and if you get 
|  bashed in route you won't go all the way to the greenie 
|  before taking on the guy that can actually deal damage.

#define HateListLen v21

| Main Subroutine
Sub Main

	| Init
	/call CleanUpScreen
	/varset HateListLen 0
	
	| Pick 3 different guys, add each to the hate list
	
	/call GetTarget1
	/call GetTarget2
	/call GetTarget3

	| Display Hate List
	/call DisplayHateList

	|Clean Up
	/call CleanUpScreen
/return


Sub GetTarget1
	| Target Me
	/press F1
	| Target MOB
	/target npc Vox
	| Tell what we did
	/echo GT1: $target(name)
	| If we found something, add it to the list
	/if $target(name)!=$char(name) /call AddToHateList $target(id)
/return

Sub GetTarget2
	/press F1
	/target npc Priest
	/echo GT2: $target(name)
	/if $target(name)!=$char(name) /call AddToHateList $target(id)
/return

Sub GetTarget3
	/press F1
	/target npc Goblin
	/echo GT3: $target(name)
	/if $target(name)!=$char(name) /call AddToHateList $target(id)
/return


Sub DisplayHateList
	| Spit out your hate list to the screen
	/echo
	/echo ListLen: $HateListLen
	/echo ---------------------
	/for v95 1 to $HateListLen
	  /target id $a(0,$v95)
	  /echo $v95 ID: $a(0,$v95)
	  /echo $v95 LV: $target(level)
	  /echo $v95 NM: $target(name)
 	  /echo ---------------------
	/next v95
	/echo
/return


Sub AddToHateList
	| v90 - Hold ID 
	| v91 - Hold Lvl
	| v92 - Current HateList Level
	| v93 - Swap ID
	| v95 - For Loop Var

	| Set the new ID into the hold var
	/varset v90 $p0
	/echo Adding $v90 to HateList

	| Get his level into v91
	/target id $v90
        /varset v91 $target(level)

	| If he's not the first, make sure he's put into the right place.
	| We want to order out hate list in order of strongest mob
	
	/if $HateListLen>1 {
	  /for v95 1 to $HateListLen
	    
	    | Check the level of the current mob
	    /target id $a(0,$HateListLen)
	    /varset v92 $target(level)
	    
	    /if $v92<$v91 {	     | New guy is stronger, time to reorder
	      /varset v93 $a(0,$v95) | Store old one to Swap ID
	      /varset a(0,$v95) $v90 | Put stronger guy in list
	      /varset v90 $v93	     | Put old one into Hold ID
	      /varset v91 $v92	     | Old level into Hold Lvl
	    }
	  /next v95
	  
	  | Add whats left in Hold ID to the list
	  /varcalc HateListLen $HateListLen+1
	  /varset a(0,$HateListLen) $v90
	} else {
	  /varcalc HateListLen $HateListLen+1
	  /varset a(0,$HateListLen) $p0
	}

/return


Sub CleanUpScreen

	/sendkey up ctrl 
	/sendkey up shift 
	/sendkey up alt 
	/press esc
	/press esc
	/press esc
	/sit off
	/delay 2
	
/return

----------
* Nerfy *

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Mon Oct 21, 2002 9:02 pm

Salutations,
My apologies... I get that it makes a hatelist, but what do you mean by 'hate list'? like the things the orc pawns use to know who to fight based on damage delt by, faction of? or some other one?

Nerfy
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Oct 15, 2002 11:37 am

Post by Nerfy » Mon Oct 21, 2002 11:16 pm

Well, there's Verants idea of a hate list, and then there's mine. I'm not sure if your asking what a hatelist is in general, or what the concept I have here is. I'll explain both... sorry if it's too much info.

Verants List:
Say you're in a group of 4 people. Tank, Healer, 2 Wizards. Typical roles are that the tank pisses off the MOB real good and then when the MOB is low on health the Wizzies nuke him that last bit. Healer heals. Now problems start to happen if that MOB doesn't cooperate and starts to hit some non-tank member of the group. MOBs decide who to hit based on their own personal hate lists - arrays that list people he hates from most to least.
In this sample group, we want him to hate people in this order: Tank,Wiz,Wiz,Healer. That way the tank takes all the damage, if he dies then the wizzies start getting hit - but the healer at least can get away to rez.
In it's simplest form, the HateList Order is determined by who's inflicted the most damage. That's why everyone waits for the tank to fight for a bit before joining in the fray. On a MOB with 100 hp, Tank hits for 50 and then both Wizzies can nuke for 20 a piece with no fear. Then Tank can finish it off. Healers? Well the MOB sees every HP they restore as a hit against them. Heal for 55 HP in the above situation and the cleric has a new best friend.
Yes, it's more complex then that. There's actually a bonus that's added if you're the lucky chap that originally pissed the guy off. That and when a MOB that has you on it's list runs by another MOB that has a clear hate list (hasn't been aggroed) your name gets put on that new guys list and you now have two friends.

My List:

The hunter macs out there are awesome. But there's a problem. These macs follow this structure (loosely):

Get a target
Move to that target
Fight that target
Repeat

Now Fippy did something cool and added a check to see if during that move process you picked up any friends, or if while doing that fight thing something jumped in to help. My problem is that I'm not going to run a macro that hunts unless it's hunting greenies for me. So, say I'm in the above situation and something blue looks my way. Do I stay on my current fellow, or do I switch to it? Switch to it of course! I need to 'hate' him more. Well, what if it was green? Or what if I have 2 greens and a blue on me? Or what if I'm fighting a green, that super rare other green I've been wanting wonders by - I should 'hate' him more shouldn't I? Do him in then finish off the orginal?

If something is on my alert list then I hate it. If something hits me then I hate it. This code that I pasted is a start to more complex tracking of what's happening to you in game. It keeps a list of everything that you want to track in order of how hard their going to be to kill. It then kills the hardest one first, and so on. Well, you can code it to kill the hardest guy first. That's why this is just a code showing how to track MOBs right now - still working on incorporating it into a hunting mac.

I'm rambling... any of this make sense?
----------
* Nerfy *

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Mon Oct 21, 2002 11:50 pm

Salutations,
I was asking for your definition... Thank you...

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Tue Oct 22, 2002 4:05 am

Hey this is really cool. A much better way to handle aggro management. Gonna have to splice this with hunter asap. Unfortuantely got a busy few days relocating a bunch of servers so ya might have it done already by then Nerfy. Ill post it when its done under my Hunter thread.

Fippy

Oid
a snow griffon
a snow griffon
Posts: 416
Joined: Thu Oct 17, 2002 3:26 am
Contact:

Post by Oid » Tue Oct 22, 2002 2:39 pm

Can't wait to see this/play with it. Out of curiosity, is this one of those situations where an array would be useful? Or would that be overly complex?

Nerfy
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Oct 15, 2002 11:37 am

Post by Nerfy » Tue Oct 22, 2002 2:46 pm

An array to contain the hate list? I'm using one. The variable $a(X,Y) is an array. Well, it's a 2D array made to hold 1D arrays. So X being the number of the 1D array variable and Y being the index. I used array number 0 and that var HateListLen to store the length of the array.
----------
* Nerfy *

Oid
a snow griffon
a snow griffon
Posts: 416
Joined: Thu Oct 17, 2002 3:26 am
Contact:

Post by Oid » Tue Oct 22, 2002 2:52 pm

Ahh cool ;) Teach me to try to read anything without having slept. Wasn't questioning your code btw ;) Just trying to get a feel for more and more of this myself.

User avatar
Morath
a lesser mummy
a lesser mummy
Posts: 41
Joined: Tue Oct 22, 2002 3:09 pm

Question on coding from an aspiring (wannabe) coder...

Post by Morath » Thu Oct 24, 2002 11:18 am

Where have Target Mobs:

Sub GetTarget1
| Target Me
/press F1
| Target MOB
/target npc Vox
| Tell what we did
/echo GT1: $target(name)
| If we found something, add it to the list
/if $target(name)!=$char(name) /call AddToHateList $target(id)
/return


/target npc Vox Would you replace Vox with a MOB you want?

You initialize the hate list with 3 mobs correct? And this code:

| Add whats left in Hold ID to the list
/varcalc HateListLen $HateListLen+1
/varset a(0,$HateListLen) $v90
} else {
/varcalc HateListLen $HateListLen+1
/varset a(0,$HateListLen) $p0
}


Makes the list unlimited?

HOw does the range from MOBs play into it? For instance: If I zone into EC from FP...would this code prioritize the entire zone from the closest spider to the furthest orc?

Thx in advance to answers

Syn...

Nerfy
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Oct 15, 2002 11:37 am

Post by Nerfy » Thu Oct 24, 2002 12:15 pm

This was just an example to show how to track MOBs in an array - while keeping that array in order of level. This line here:

Code: Select all

/call AddToHateList $target(id)
is what actually adds a MOB to the hate list. In the exampl you would replace Vox with the name of a MOB. As well as place names of other things in for the other two target calls. These three were (again) just to demonstrate the funtionality of the subroutine.

I suppose that if there exists a function GetAllNPC for a zone then you could then loop over that list, calling the AddToHateList routine and therefore have a listing of all things in a zone... this was not the original intent of this function though. What I found happening when running hunting (or farming) scripts is that if something aggroed on me then I would continue killing off that little green mob before I focused on the baddie that had just tagged me. If you incorporate a hate list into your hunter script, and make sure that you are always fighting the first guy in your array, then it will improve your chances of survival significantly.

You could also use this to go after special npc's. Say there's a rare spawn that you want to kill in a zone, but while waiting you want the script to farm quality pelts. You can have it run on the pelts, and keep calling a check for the rare spawn. If the rare pops, add him first in the array. You now go after the rare, but will return to the little guy that you were going after as soon as the rare is dead.
----------
* Nerfy *

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Great Idea

Post by SingleServing » Sun Dec 22, 2002 7:49 am

Great Idea!

Have you though about adding a way to calculate hate including the mobs HP, like when your loh a mob agroes you to try to finish you off. If your fighting a 10 mob that has 5% hp and a 20 mob agros you want to finish the 10 mob real quick before moving on. If you go right for the 20 mob you will take extra damage.

However, what is the goal of this? Make a good hunting script!

Not getting adds in the first place is more important than handling them after adds. This is also important, if a way to handle the adds without dieing is achieved.

What else should would help in the goal?

A test if any mobs are in the direct agro radius of the mob you plan on attacking, then a test if any mobs are in "wandering" radious who might eventually add and if their are any agro mobs between you and your target.

If mobs in assist radius of target find new target

If mob in wander radius attack and pull back to a safe area.

If agro in way find new target. or circle around until LOS is clear of adds

So much work....

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Mon Dec 23, 2002 12:58 am

Salutations,
so much work, so much time.

Ariain
a ghoul
a ghoul
Posts: 88
Joined: Fri Oct 11, 2002 10:35 am

...

Post by Ariain » Mon Jan 13, 2003 4:46 pm

So little codeine....