Jump to content

[patch] BotAI


Recommended Posts

Hi Runsttren :)

Please look at this thread ^^ http://getmangos.eu/community/viewtopic.php?id=2661

Can i somehow persuade you to help us in this Bot System ?

An we use this to get the spell.

This is in the bot.cpp RETRIBUTION_AURA = ai->getSpellId("retribution aura");

And this in the playerbotai.cpp

uint32 PlayerbotAI::getSpellId(const char* args) const {
   if(!*args)
       return 0;

   std::string namepart = args;
   std::wstring wnamepart;

   if(!Utf8toWStr(namepart,wnamepart))
       return 0;

   // converting string that we try to find to lower case
   wstrToLower(wnamepart);

   int loc = m_master->GetSession()->GetSessionDbcLocale();

   uint32 foundSpellId = 0;
   bool foundExactMatch = false;
   bool foundMatchUsesNoReagents = false;

   for(PlayerSpellMap::iterator itr = m_bot->GetSpellMap().begin(); itr != m_bot->GetSpellMap().end(); ++itr)
   {
       uint32 spellId = itr->first;

       if(itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled || IsPassiveSpell(spellId))
           continue;

       const SpellEntry* pSpellInfo = sSpellStore.LookupEntry(spellId);
       if (! pSpellInfo)
           continue;

       const std::string name = pSpellInfo->SpellName[loc];
       if(name.empty() || !Utf8FitTo(name, wnamepart))
           continue;

       bool isExactMatch = (name.length() == wnamepart.length()) ? true : false;
       bool usesNoReagents = (pSpellInfo->Reagent[0] <=  0) ? true : false;

       // if we already found a spell
       bool useThisSpell = true;
       if (foundSpellId > 0) {
           if (isExactMatch && ! foundExactMatch) {}
           else if (usesNoReagents && ! foundMatchUsesNoReagents) {}
           else if (spellId > foundSpellId) {}
           else
               useThisSpell = false;
       }
       if (useThisSpell) {
           foundSpellId = spellId;
           foundExactMatch = isExactMatch;
           foundMatchUsesNoReagents = usesNoReagents;
       }
   }

   return foundSpellId;
}

I hope you take into consideration to help us.

Link to comment
Share on other sites

  • 39 years later...

Mornin' mates! Got something you might be interested in: yet another Bot-Patch WIP ;)

What it does you may ask... simple answer: summon a character of your own account as a bot!

What's done:

For now it is just a basic study implementation. It features some commands (listed below) to list, summon, dismiss characters. I implemented a 'fake' WorldSession called BotAI, and this one is loading the player just as the real thing would do. Benefits from doing it this way is that your summoned bot can do quests, will loot needed items (needed by a quest I mean), will accept trades, and is also leveling while playing. As mentioned it is very basic, especially in combat. A figther will do melee, a mage/priest will cast combat spells. Priests will always safe some mana to cast heal spells on group members.

What's planned:

After finalizing the basic features. I will add child classes of BotAI or maybe a brain class which is different for each player class. This will allow me to programm some common behaviour patterns. I.e. to say a warrior he should go to defence stance and tank. Or make a hunter correctly use it's pet and it's fighting abilities, etc. Think you can imageine it.

Known bugs:

1) Sometimes after a bot died and came back to life it seems the ghost aura is not removed correctly - the char is alive but looks like a ghost.

2) After combat is done sometimes it happens that spell casters still have the casting aura (or however it would be called).

3) Sometimes after combat teh bots just stuck. Not moving - just a dismiss and resummon solves the problem. Think I will add a state reset command...

Questions I have:

1) If you look at the BotIA::_actionCastSpell is there maybe a better way of finding spells? Something like 'get the highest rank of spell id x'?

2) If someone has some ideas about the mentioned bugs please share those with me.

BotAI v0.0.2 (patched against mangos r7782)

Let me know what you think about it :)

Cheers

Runsttren aka WickedImp

Link to comment
Share on other sites

well I don't belive the thing is to help u guys, but to cooperate eachother...

Afterall u have the same goal to create a diffrent levels of bots Ai...

But main idea is to create a bot system... that can do everything a normal player can do... lvling, pve, pvp, proffesions, etc..

With respect,

Alex

P.S.I wish u guys good luck this is an awesome project...

Link to comment
Share on other sites

well I don't belive the thing is to help u guys, but to cooperate eachother...

Afterall u have the same goal to create a diffrent levels of bots Ai...

But main idea is to create a bot system... that can do everything a normal player can do... lvling, pve, pvp, proffesions, etc..

With respect,

Alex

P.S.I wish u guys good luck this is an awesome project...

that is what i want playerbot to be (somewhere in the future) =)

Link to comment
Share on other sites

Hi ppl,

I just stopped working on my BotAI and joined PlayerbotAI as mentioned above by Natsukawa. It is well developed and already has implemented many things I also planned to do in BotAI. Will implement my loot routines there and see if I can help make this thing more stable. Also trying to seperate actions by death state. Hope ppl will now help developing PlayerbotAI ;) If you have anything, post it in the Bot System threat, please.

Cheers

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use