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

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-12-2011, 07:18 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default BoT Custom Code

Wasn't really sure which forum to post this, but it is bot code so put it here.

I don't really have much free time atm which is why I haven't been posting. However, my son and I have been messing around in the game and something that has been bugging the hell out of me is raids with many adds. The chanter bot's current AI is spotty IMO so I threw this code together as a band-aid until I can get in there and get dirty. Thought I'd post it, though, as it is handy to have anyway and thought someone might want to use it.

It adds the #bot aoemez command

Code:
// AoE Mez
	if(!strcasecmp(sep->arg[1], "aoemez")) {
		Mob *mezzer = NULL;
		Mob *target = c->GetTarget();
		bool hasmezzer = false;
		if(c->IsGrouped())
		{
			Group *g = c->GetGroup();
			if(g) {
				for(int i=0; i<MAX_GROUP_MEMBERS; i++)
				{
					if(g->members[i] && g->members[i]->IsBot() && (g->members[i]->GetClass() == ENCHANTER))
					{
						hasmezzer = true;
						mezzer = g->members[i];
					}
				}
				if(!hasmezzer) {
					c->Message(15, "You must have an Enchanter in your group.");
				}
			}
		}
		if(hasmezzer) {
			if      (c->GetLevel() <= 15) {
				mezzer->Say("I need to be level 16 or higher for this...");
			}
			else if ((c->GetLevel() >= 16) && (c->GetLevel() <= 51)) {
				mezzer->Say("Casting Mesmerization...");
				mezzer->CastSpell(307, target->GetID(), 1, -1, -1);
			}
			else if ((c->GetLevel() >= 52) && (c->GetLevel() <= 64)) {
				mezzer->Say("Casting Fascination...");
				mezzer->CastSpell(1690, target->GetID(), 1, -1, -1);
			}
			else if ((c->GetLevel() >= 65) && (c->GetLevel() <= 68)) { 
				mezzer->Say("Casting Bliss of the Nihil...");
				mezzer->CastSpell(4878, target->GetID(), 1, -1, -1);
			}
			else if ((c->GetLevel() >= 69) && (c->GetLevel() <= 70)) { 
				mezzer->Say("Casting Wake of Felicity...");
				mezzer->CastSpell(5511, target->GetID(), 1, -1, -1);
			}
		}
		return;
	}
Edit:

be careful with this code
there are no checks in it. unsure how it will work if cast on players or in an area with friendly npcs.
Reply With Quote
  #2  
Old 08-13-2011, 04:58 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Here is an update. Yea yea. I can't help myself.

Anyway...
I added a code to check if there is a target cause that was causing a crash and I also made it where the chanter will stop casting and cast AoE mez because if you are telling the chanter to cast this spell then you want it now or people will probably die.

Code:
// AoE Mez
	if(!strcasecmp(sep->arg[1], "aoemez")) {
		Mob *mezzer = NULL;
		Mob *target = c->GetTarget();
		bool hasmezzer = false;
		if(c->IsGrouped())
		{
			Group *g = c->GetGroup();
			if(g) {
				for(int i=0; i<MAX_GROUP_MEMBERS; i++)
				{
					if(g->members[i] && g->members[i]->IsBot() && (g->members[i]->GetClass() == ENCHANTER))
					{
						hasmezzer = true;
						mezzer = g->members[i];
					}
				}
				if(!hasmezzer) {
					c->Message(15, "You must have an Enchanter in your group.");
				}
			}
		}
		if((hasmezzer)&&(!target == NULL)) {
			if      (c->GetLevel() <= 15) {
				mezzer->Say("I need to be level 16 or higher for this...");
			}
			else if ((c->GetLevel() >= 16) && (c->GetLevel() <= 51)) {
				mezzer->Say("Casting Mesmerization...");
				if(mezzer->IsCasting()){
					mezzer->InterruptSpell();
				}
				mezzer->CastSpell(307, target->GetID(), 1, -1, -1);
			}
			else if ((c->GetLevel() >= 52) && (c->GetLevel() <= 64)) {
				mezzer->Say("Casting Fascination...");
				if(mezzer->IsCasting()){
					mezzer->InterruptSpell();
				}
				mezzer->CastSpell(1690, target->GetID(), 1, -1, -1);
			}
			else if ((c->GetLevel() >= 65) && (c->GetLevel() <= 68)) { 
				mezzer->Say("Casting Bliss of the Nihil...");
				if(mezzer->IsCasting()){
					mezzer->InterruptSpell();
				}
				mezzer->CastSpell(4878, target->GetID(), 1, -1, -1);
			}
			else if ((c->GetLevel() >= 69) && (c->GetLevel() <= 70)) { 
				mezzer->Say("Casting Wake of Felicity...");
				if(mezzer->IsCasting()){
					mezzer->InterruptSpell();
				}
				mezzer->CastSpell(5511, target->GetID(), 1, -1, -1);
			}
		}
		return;
	}
Reply With Quote
  #3  
Old 08-14-2011, 10:41 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Part 2 - This code is to help patch the lack of a CH rotation during raids. This code is incomplete in that it is only for a level 70 character for the time being. I wrote it to test the code. I run a 3 group level 70 raid set up.
Group 1:
Myself - Barbarian Warrior
Cleric
Enchanter
Bard
Monk
Rogue

Group 2:
Shadowknight
Shaman
Druid
Cleric
Ranger
Beastlord

Group 3:
Paladin
Enchanter
Magician
Necromancer
Wizard
Wizard

I am not to keen on running with more than 3 groups and that is why I upped the level cap to 70 (which also allows for the GoD AAs).

Anyway, this is the code. Adds the #bot healme <healer name> command

Code:
// Heal Command - patch for heal rotation
	if(!strcasecmp(sep->arg[1], "healme")) {
		if(sep->arg[2][0] == '\0') {
				c->Message(0, "Usage: #bot healme <healer name>");
				return;
		}
		int argCount = 0;
		argCount = sep->argnum;
		std::string botGroupMemberName;

		if(argCount >= 2)
			botGroupMemberName = std::string(sep->arg[2]);

		Bot* botGroupMember = entity_list.GetBotByBotName(botGroupMemberName);

		if(!botGroupMember) {
			if(botGroupMemberName.empty())
				c->Message(0, "You have must call the healer by name.");
			else
				c->Message(13, "%s is not a bot in this zone. Please try again.", botGroupMemberName.c_str());

			return;
		}
		/*else if(!botGroupMember->CastToBot()->GetBotOwner() == c){
			c->Message(0, "You have must call a healer that you own.");
		}*/
		else if(botGroupMember->GetClass() == CLERIC)
		{
			if(botGroupMember->IsCasting()){
					botGroupMember->InterruptSpell();
			}
			botGroupMember->CastSpell(6140, c->GetID(), 1, -1, -1);
		}
		else if(botGroupMember->GetClass() == DRUID)
		{
			
			if(botGroupMember->IsCasting()){
					botGroupMember->InterruptSpell();
			}botGroupMember->CastSpell(6141, c->GetID(), 1, -1, -1);
		}
		else if(botGroupMember->GetClass() == SHAMAN)
		{
			
			if(botGroupMember->IsCasting()){
					botGroupMember->InterruptSpell();
			}
			botGroupMember->CastSpell(6142, c->GetID(), 1, -1, -1);
		}
		return;
	}
If you have any suggestions on streamlining or improving let me know.
I will be adding other spells for lower levels soonish

Criimson

EDIT: To test I just used these two codes...the aoemez and healme to run the Bertox event and did it successfully.
Reply With Quote
  #4  
Old 08-14-2011, 12:54 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Something I also didn't really like when playing with my bots.
If I want them to change target while engaged I have to command them to guard then attack. Not efficient at all IMO.

If you add the line

botGroupMember->WipeHateList();

in the function:
void Bot::BotGroupOrderAttack(Group* group, Mob* target, Client* client)

like this:

Code:
if(botGroupMember->GetBotOwnerCharacterID() == client->CharacterID()) {
						botGroupMember->WipeHateList();
						botGroupMember->AddToHateList(target, 1);
It basically wipes the agro list and they will immediately attack what you tell them to
Reply With Quote
  #5  
Old 08-28-2011, 05:49 PM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

Quote:
Originally Posted by Criimson View Post
Something I also didn't really like when playing with my bots.
If I want them to change target while engaged I have to command them to guard then attack. Not efficient at all IMO.

If you add the line

botGroupMember->WipeHateList();

in the function:
void Bot::BotGroupOrderAttack(Group* group, Mob* target, Client* client)

like this:

Code:
if(botGroupMember->GetBotOwnerCharacterID() == client->CharacterID()) {
						botGroupMember->WipeHateList();
						botGroupMember->AddToHateList(target, 1);
It basically wipes the agro list and they will immediately attack what you tell them to
I just committed something similar for bit attack, follow, and guard. I had the issue of bot's pets not following the command and continuing to attack, so I added them in as well. Thanks for the suggestion. This always bothered me as well.
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 04:37 AM.


 

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