Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2011, 08:01 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default Enchanter mez code

SO looking through some of the code I found an agro check and thought I'd start there.

But my C++ knowledge hasn't quite gotten to pointers. Ive only taken early classes at this point and am hoping somone can help.

Code:
//Criimson:  Testing AI mez code
					//Say("BotOwner = %s.", GetBotOwner());
					//Say("Target = %s.", GetTarget());
					//int testMez = (entity_list.GetHatedCount(GetBotOwner(), GetTarget()));
					//Say("The number of mobs I could mez is %s.", testMez);
This is the code I was working with. A simple check during the enchanter spell ai to see if the chanter can even see how many mobs the MT has agroing him.

Here is the actual code I am calling:

Code:
int EntityList::GetHatedCount(Mob *attacker, Mob *exclude) {

	// Return a list of how many non-feared, non-mezzed, non-green mobs, within aggro range, hate *attacker

	if(!attacker) return 0;

	int Count = 0;

	LinkedListIterator<NPC*> iterator(npc_list);

	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {

		NPC* mob = iterator.GetData();

		if(!mob || (mob == exclude)) continue;
		
		if(!mob->IsEngaged()) continue;

		if(mob->IsFeared() || mob->IsMezzed()) continue;

		if(attacker->GetLevelCon(mob->GetLevel()) == CON_GREEN) continue;

		if(!mob->CheckAggro(attacker)) continue;

		float AggroRange = mob->GetAggroRange();

		// Square it because we will be using DistNoRoot
			
		AggroRange = AggroRange * AggroRange;

		if(mob->DistNoRoot(*attacker) > AggroRange) continue;

		Count++;

	}

	return Count;

}
I was hoping this code could be modified a bit to allow the enchanter bot to mez the adds.

I'm guessing I'm missing something simple

Criimson
Reply With Quote
  #2  
Old 07-07-2011, 10:20 AM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

If you add in the mez spells to the enchanter bot spell list in the database with the proper spell type (i think 256?) they will mez adds.
Reply With Quote
  #3  
Old 07-07-2011, 10:53 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Thank you

I'll try that.
I did notice that the code seemed to be in place, but wasnt behaving.

Criimson
Reply With Quote
  #4  
Old 07-07-2011, 01:41 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

I added a couple mes spells to the chanter bot list from:
Mes spells


Code:
INSERT INTO `npc_spells_entries` (`id`, `npc_spells_id`, `spellid`, `type`) VALUES (8146, 705, 292, 2048);
Is one of the early ones. And you are right the code starts to fire. !addMob starts spamming the screen during each fight, but even when there is an add it doesn't seem to realize it.

Testing with a level 15 group.

Code:
case SpellType_Mez: {
			if (tar->GetBodyType() != BT_Giant) {
					if(!checked_los) {
						if(!CheckLosFN(tar))
							break;	//cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
						
						checked_los = true;
					}
					
					botSpell = GetBestBotSpellForMez(this);

					if(botSpell.SpellId == 0)
						break;

					Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);

					if(!addMob){
						Say("!addMob.");
						break;}

					if(!(!addMob->IsImmuneToSpell(botSpell.SpellId, this) && addMob->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0))
						break;
					
					castedSpell = AIDoSpellCast(botSpell.SpellIndex, addMob, botSpell.ManaCost);
			}
			break;
							}
		default: {
			break;
					  }
	}
Did more testing and added a Say("") check where the mez should fire on add and it reaches the say, but no mezzing of any adds.
Reply With Quote
  #5  
Old 07-07-2011, 05:07 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Got it working after getting spells set up better. I think the Bot was trying to use a spell it couldn't on first tests, but unsure. Kind of weird, but after I added the line

Code:
//Criimson Added - Test code
					//Say("There is an add to be mezzed and I could use %d.", (botSpell.SpellId));
it started working.

Thank you for the advice of where to start work.

Criimson
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:57 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3