Post
by Nerfy » Mon Oct 28, 2002 1:44 pm
You're right Fip - hadn't realized what a problem this would be. Guys, he's not looking for the name of what hit him, he's looking for it's ID. Big difference. And yes, Perl is a wonderful way to to store your hate list - but you still have to figure out what to put into that hate list. Perl did not add any new commands to MQ with respect to interacting with EQ, it just allows some versitility with scripting language and (especially) variable handling.
Now we have three instances where we pick up an unwanted guest:
> While fighting, someone joins in the fray
> While resting, something picks a fight
> While going to a fight, something aggros on us
As a matter of fact, these three instances actually corralate to the three states that your toon is in during a hunting session. Rest, seek, and destroy. Ok, there may be a fourth that happens while you're looting - but I'd classify that as a Rest state. So, we now need to keep track of (and keep updated) a variable CurrentState. I'd say:
> -1 : Resting
> 0 : Seeking
> 1 : Fighting
Anyway, you need to moniter what action the toon is taking at the moment. Keep that event in there, as a matter of fact I'd also set up one for 'MISSES YOU' so that we don't wait until we take damage. If it's a greenie that's aggroed (say while you've been medding) then you may be sitting for a while until he clocks you.
Anyway, you now have these two events that your looking for. MissesYou and HitsYou. On either event, call Sub BeenAttacked. BeenAttacked then looks at our variable CurrentState. If you're currently Resting or Seeking, it's a no brainer. FIrst change current state to fighting, then fight the baddie. Or you can perform some escape procedure if the baddie is too high a level. Say he's a yellow con. Then you may want to FD, or stun/root/gate. Class dependant exit routines are another fun addition I'd like to put into Hunter.Mac - but one thing at a time.
So we have Resting attacks and Seeking attacks taken care of. What happens if we're in fight mode?
Well, while fighting we're going to be firing those HitsYou and MissesYou events a good bit. This is where our HateList comes into play. Of course, now that we've got bigger arrays to play with (yay!) I'd suggest storing more than just a 1d array of MOB id's. First off, set a standard for the way that you organize a monster list. Our type monsterList would be:
3d array where:
> 0 = id
> 1 = level
> 2 = aggro state (-1:Not|0:Unknown|1:Yes)
Now I would have a function that fills this array with all MOBs near to you. Say, within a 7 range. Default the 3rd position to -1 (not aggroed). Now put your current target into that array and set it's aggro state to 1. If you order this list first by AggroState, then by level - then you now have the order in which you should fight these things. Add in a check to only kill those things with an aggro state of 1, and you will not be wasting your time on killing everythying in a given radius of yourslef. This includes that Priest of Discord over there. This also changes our list from simply a hatelist to a NearbyNPCList, but I'll still call it a hate list just cause it's easier.
Now to handle the random aggro. Two kinds of random aggro can happen. One is that a MOB with a new name comes onto the scene, the other is that a MOB with a similar name shows up. Different name first:
So you have this list. It's correctly ordered and you are fighting 'a wolf'. There are 2 'fire beetles' nearby, but being green they aren't paying you any attention. Every time that wolf attempts to, or succeeds in biting you, your events fire. Theres a check in that event to see if he's already in your list. Since he is - you simply return with no action.
Then Fippy Darkpaw comes onto the scene and hits you for ruining his lands or some other nonesense. Event gets fired, we see that Fippy is not in the HateList, so we add him. He tried to smack us, so we set his AggroState to 1. Since the hatelist is ordered by AggroState, Level - the wolf is moved to second place. Fippy sits in first. We fight Fippy.
Ok, now the real problem. Back to our scenario of fighting a wolf, 2 beeltes in range but with AggroStates of -1. Then say another wolf joins in - only this one is a level higher. Being a level higher, he also cons blue and therefore could inflict a good deal of hurt while we're wasting time on the green wolf. Now - the events are still firing, but because we are fighting 'a wolf' and there are two 'a wolf's that are at our throats we would normally not know to switch to the new one. This gets complex.
Simple solution: set all mobs with similar names that are in that HateList (remember, we're monitering all things near) to an AggroState of 1. This means that you will kill all wolves near to you in order of their level.
Slightly more complex: Set up level ranges based on your con to a creature. So that you know if the creature cons green, blue, etc. Then if the new creature cons green and is nearby - you know that he DID NOT aggro on you. Green cons only aggro if you're sitting on your tail end medding and/or healing. So if that new wolf that has entered your aggro radius is green to you, don't add him to your list - you know he's not big enough to be challenging you.
Ok, forgive the stream of thought on this one - but I'm at work and I just wanted to get these ideas down. Let me know if I can clarify any of the above. Back to work for me.