PDA

View Full Version : Interactive Bots


RichardoX
07-23-2009, 11:10 AM
This feature would be to use bots as interactive npcs. For example, we'd need some custom perl commands. Here is an example of what I mean.


sub EVENT_SAY {
if($text=~/hail/i)
{
quest::say("Hello, $name! I am a traveling adventurer and mercenary for hire. For 5 platinum, I will join your party!")
}}

sub EVENT_ITEM {
if($platinum == 5)
{
quest::botjoin();
##the npc will join the players group and function as a bot.
quest::groupsay("Hello! Glad to be of service.");
##groupsay would be a means of the bot responding in group chat.
}}


We could even expand on the abilities to control the bot. Group commands such as the following:

/g !stay
/g !protect playername
/g !follow playername
/g !attack
/g !assist playername
/g !stop

I think this would bring in a bag of opportunities to those who enjoy creating ring events and other forms of interactive questing.

From what I understand, you have to remove the check for ownership of the bot to place a bot somewhere and force him to join any players group. Any useful comments or pointers on where to start with this? I've never written perl commands before so I don't know where to start with that.

Krugus
07-23-2009, 08:01 PM
That would be cool :)

I've been working on a quest script just to add the commands via saylinks to the bots, you have find that post here (http://www.eqemulator.net/forums/showthread.php?t=28962) Only problem with it, its only feasible for small servers since you have to create a quest for each bot.

Adding the functions you are talking about would be cool though. You could set up a various bots npc's in Tavern's and Inns that you could go hire! It would give people a reason to go to Inn's and Taverns besides to quickly sell something.....

RichardoX
07-24-2009, 02:31 AM
I am working on this feature but considering I am not a well seasoned coder, I've hit a couple road blocks but we'll figure it all out.

RichardoX
07-24-2009, 12:12 PM
Well, I am trying to construct this into a perl command. I found the 'join group' code for the bot.

bool Bot::AddBotToGroup(Bot* bot, Group* group) {
bool Result = false;

int i = 0;

if(bot && group) {
//Let's see if the bot is already in the group
for(i = 0; i < MAX_GROUP_MEMBERS; i++) {
if(group->members[i] && !strcasecmp(group->members[i]->GetCleanName(), bot->GetCleanName()))
return false;
}

// Put the bot in the group
for(i = 0; i < MAX_GROUP_MEMBERS; i++) {
if(group->members[i] == NULL) {
group->members[i] = bot;
break;
}
}

// We copy the bot name in the group at the slot of the bot
strcpy(group->membername[i], bot->GetCleanName());
bot->SetGrouped(true);

//build the template join packet
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;
strcpy(gj->membername, bot->GetCleanName());
gj->action = groupActJoin;

int z = 1;
for(i=0; i < MAX_GROUP_MEMBERS; i++) {
if(group->members[i] && group->members[i]->IsClient()) {
if(group->IsLeader(group->members[i])) {
strcpy(gj->yourname, group->members[i]->GetName());
strcpy(group->members[i]->CastToClient()->GetPP().groupMembers[0], group->members[i]->GetName());
group->members[i]->CastToClient()->QueuePacket(outapp);
}
else {
strcpy(group->members[i]->CastToClient()->GetPP().groupMembers[0+z], group->members[i]->GetName());
group->members[i]->CastToClient()->QueuePacket(outapp);
}
}
z++;
}

safe_delete(outapp);

// Need to send this only once when a group is formed with a bot so the client knows it is also the group leader
if(group->GroupCount() == 2) {
Mob *TempLeader = group->GetLeader();
group->SendUpdate(groupActUpdate, TempLeader);
}

Result = true;
}

return Result;
}


Before I do this however, I need to find a way to remove ownership checks. It will error out if I try to just put the bot in anyone's group. Im trying to find it but I'm not having the best of luck.

RichardoX
08-06-2009, 06:12 PM
I'm willing to pay for help with this. :)

Angelox
08-06-2009, 11:28 PM
You know, I probably made what resembled the first eqemu bot ever. I did it in Perl and still have the scripts included with our database package. It worked very well, one setback was, you had to target it to command it, but I think that can be resolved with the new quest code.

You spoke with Bohat at Gunthak Lighthouse, she eventually sold you hired help, and spawned you a "Perl -bot". I could use it around the Gulf pretty well. It was all Alpha and just a start - But enter Magoth78 then Congdar with the greatest yet EQBOTS code, so I forgot about mine. Would be interesting to see how far you could go with it. I even had ideas on how to zone and turn up in the next zone with it.

RichardoX
08-07-2009, 05:29 PM
This project is unfortunately beyond my C++ comprehension skills. I'd gladly donate money for this to get it started. :) I'm more of a "copy/paste/rewrite what other people have written" kindof guy. lol

Yeormom
08-07-2009, 09:29 PM
haha so you finally gave up eh? That didn't last long!

RichardoX
08-08-2009, 08:44 PM
haha so you finally gave up eh? That didn't last long!

I'm a struggling coder/script kiddy. Cutt me a break :(

You could offer me some advice!

Yeormom
08-08-2009, 10:23 PM
Thought you were gonna add commands to control them? Last I heard, you had already found the right places to do all of that.

RichardoX
08-08-2009, 11:35 PM
I did find it but I've hit some nasty road blocks. :p