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

Development::Bots Forum for bots.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-15-2009, 06:49 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default Bot Management Update

With SVN 328 I've made some updates to Angelox's BotCount code.

You need the required sql /utils/sql/svn/328_bot_management.sql
This adds a new rule EQOffline:BotCreateCount which allows admins to limit the number of bots a player can create.
I've changed the EQOffline:BotCount rule for readability to EQOffline:BotSpawnCount which controls how many bots a player can have spawned at one time. Additionally, i've added code using these rules to reduce the 'Orphaned Bot' issue. There initially will still be orphaned bots, but the player will be unable to spawn already spawned bots in other zones and a list of all spawned bots and the zone they are in will be displayed. Players will now have to make sure and group thier spawned bots so they don't get orphaned in static zones.

I've included an optional way of managing bots using the perl quest system with /utils/sql/svn/328_optional_bot_management.sql and it works along with the two new rules above.
This adds a new rule EQOffline:BotQuest that when set to true will use a new npc Aediles Thrall in the Bazaar. With this npc, you can make use of a new global variable in the database table quest_globals called bot_spawn_limit. Here's the perl for using this system. It has many changeable global values that can be used to customize the script for your preferences. It is initially set up to allow 0 bots to start and then a new bot at level 10, 15, 20, 25, 30 and 35 for the players group, and then at level 45 the player can begin creating additional raid groups. I have it set up to include trade skills as requirements to gain additional bots plus a platinum cost, but you can customize the script however you like.

Code:
############################################
# ZONE: Bazaar
# DATABASE: PEQ PoP-LoY
# LAST EDIT DATE: January 26, 2009
# VERSION: 1.0
# DEVELOPER: Congdar
#
# *** NPC INFORMATION ***
#
# NAME: Aediles Thrall
# TYPE: NPC
# RACE: Dwarf
# LEVEL: 71
#
# *** ITEMS GIVEN OR TAKEN ***
#
# Fish Rolls ID-13475
# Gnomish Spirits ID-13037
# Small Bowl ID-16939
# Studded Tunics ID-2204
# Banded Bracer ID-3061
# Class 4 Ceramic Hooked Arrows ID-8689
# Flag updates for quest global bot_spawn_limit
#
#
# *** QUESTS INVOLVED IN ***
#
# 1 - Custom Quest - Buying Slaves(bots)
#
#
# *** QUESTS AVAILABLE TO ***
#
# 1 - Anyone meeting level requirements
#
#
############################################

# Some global settings for the quest.  Set them to your preferred levels and plat costs
# Level options for when a character can acquire more slaves(bots)
my $firstbotlevel  = 10;
my $firstbotcost   = 100;
my $secondbotlevel = 15;
my $secondbotcost  = 200;
my $thirdbotlevel  = 20;
my $thirdbotcost   = 300;
my $fourthbotlevel = 25;
my $fourthbotcost  = 400;
my $fifthbotlevel  = 30;
my $fifthbotcost   = 500;

# They have enough for one group, now they start creating raid bots up to the quest::spawnbotcount() limit.
# A rule setting EQOffline:SpawnBotCount of 11 is two full groups including you.
my $nextbotlevel   = 45;
my $nextbotcost    = 1000;
my $nextextracost  = 1500;

sub EVENT_SAY {
   if(defined $qglobals{bot_spawn_limit} && (quest::spawnbotcount() > $qglobals{bot_spawn_limit})) {
      if(($ulevel >= $firstbotlevel) && ($qglobals{bot_spawn_limit} <= 0)) {
         quest::settimer("face", 25);
         if($text=~/Hail/i) {
            quest::say("Hey der youngster.  Lookin' fer a bit o' [help] with yer adventurin'?");
         }
         if($text=~/Help/i) {
            quest::emote("looks around the room and pauses a few seconds");
            quest::say("Well, I kin sell ye a [product] ye can't find no place else.");
         }
         if($text=~/Product/i) {
            quest::emote("looks around the room again");
            quest::say("Shhh, i'm involved in wut I like ta call A.I.D., I kin [AID] ye in yer adventurin'");
         }
         if($text=~/AID/i) {
            quest::emote("looks around the room again");
            quest::say("It be 'Acquired Individuals Delivery' and it means I kin supply ye with [Individuals].");
         }
         if($text=~/Individuals/i) {
            quest::emote("looks around the room again");
            quest::say("Shhh, not too loud... I kin deliver ye an Individual if yer [interested]?");
         }
         if($text=~/Interested/i) {
            quest::say("Let me tell ye, keepin' up a supply o' Individuals can be a costly endeavor and so's I kin feed 'em I need ye ta be collectin' up sum [supplies] fer me.");
         }
         if($text=~/Supplies/i) {
            quest::say("The Individual will cost ye $firstbotcost platinum pieces an' 4 o' dem Fish Rolls.");
         }
      }
      elsif(($ulevel >= $secondbotlevel) && ($qglobals{bot_spawn_limit} <= 1)) {
         if($text=~/Hail/i) {
            quest::say("Ahh, a returnin' customer. Are ye [interested] in another Individual?");
         }
         if($text=~/Interested/i) {
            quest::emote("looks around the room");
            quest::say("Shhh, I kin deliver ye another Individual for $secondbotcost platinum an' 4 o' dem Gnomish Spirits... heh, dey gets thirsty ya knows.");
         }
      }
      elsif(($ulevel >= $thirdbotlevel) && ($qglobals{bot_spawn_limit} <= 2)) {
         if($text=~/Hail/i) {
            quest::say("Ahh, a returnin' customer. Are ye [interested] in another Individual?");
         }
         if($text=~/Interested/i) {
            quest::emote("looks around the room");
            quest::say("Shhh, I kin deliver ye another Individual for $thirdbotcost platinum an' 4 o' dem Small Bowls... heh, dey needs ta eat outta sumtin' ya knows.");
         }
      }
      elsif(($ulevel >= $fourthbotlevel) && ($qglobals{bot_spawn_limit} <= 3)) {
         if($text=~/Hail/i) {
            quest::say("Ahh, a returnin' customer. Are ye [interested] in another Individual?");
         }
         if($text=~/Interested/i) {
            quest::emote("looks around the room");
            quest::say("Shhh, I kin deliver ye another Individual for $fourthbotcost platinum an' 4 o' dem Studded Tunics ta keeps da Individuals warm.");
         }
      }
      elsif(($ulevel >= $fifthbotlevel) && ($qglobals{bot_spawn_limit} <= 4)) {
         if($text=~/Hail/i) {
            quest::say("Ahh, a returnin' customer. Are ye [interested] in another Individual?");
         }
         if($text=~/Interested/i) {
            quest::emote("looks around the room");
            quest::say("Shhh, I kin deliver ye another Individual for $fifthbotcost platinum an' 4 o' dem Banded Bracers ta keeps da Individuals protected.");
         }
      }
      elsif(($ulevel >= $nextbotlevel) && ($qglobals{bot_spawn_limit} <= 5)) {
         if($text=~/Hail/i) {
            quest::say("Ahh, a returnin' customer. Are ye [interested] in another Individual?");
         }
         if($text=~/Interested/i) {
            quest::emote("looks around the room");
            quest::say("Shhh, I kin deliver ye another Individual for $nextbotcost platinum an' 4 o' dem Small Nock Class 4 Ceramic Hooked Arrows for shootin' at dem runaway Individuals.");
         }
      }
      elsif(($ulevel >= $nextbotlevel) && ($qglobals{bot_spawn_limit} >= 6)) {
         if($text=~/Hail/i) {
            quest::say("Ahh, a returnin' customer. Are ye [interested] in another Individual?");
         }
         if($text=~/Interested/i) {
            quest::emote("looks around the room");
            quest::say("Shhh, I kin deliver ye another Individual for $nextbotcost platinum an' 4 o' dem Small Nock Class 4 Ceramic Hooked Arrows for shootin' at dem runaway Individuals.");
            quest::say("If ye dun have dem arrows, ye can just pay me $nextextracost platinum.");
         }
      }
      else {
         if($text=~/Hail/i) {
            quest::say("eh? Mind yer own business, go away.");
            quest::settimer("face", 5);
         }
      }
   }
   else {
      if($text=~/Hail/i) {
         quest::say("eh? Mind yer own business, go away!");
         quest::settimer("face", 5);
      }
   }
}

sub EVENT_TIMER {
  if($timer eq "face") {
     my $facemob = $entity_list->GetMobByNpcTypeID(151071);
     $npc->FaceTarget($facemob);
     quest::stoptimer("face");
  }
}


sub EVENT_ITEM {
   if(defined $qglobals{bot_spawn_limit} && (quest::spawnbotcount() > $qglobals{bot_spawn_limit})) {
      my $success = 0;
      if(($ulevel >= $firstbotlevel) && ($qglobals{bot_spawn_limit} <= 0)) {
         if(($platinum == $firstbotcost) && plugin::check_handin(\%itemcount, 13475 => 4)) { #baking
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      elsif(($ulevel >= $secondbotlevel) && ($qglobals{bot_spawn_limit} <= 1)) {
         if(($platinum == $secondbotcost) && plugin::check_handin(\%itemcount, 13037 => 4)) { #brewing
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      elsif(($ulevel >= $thirdbotlevel) && ($qglobals{bot_spawn_limit} <= 2)) {
         if(($platinum == $thirdbotcost) && plugin::check_handin(\%itemcount, 16939 => 4)) { #pottery
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      elsif(($ulevel >= $fourthbotlevel) && ($qglobals{bot_spawn_limit} <= 3)) {
         if(($platinum == $fourthbotcost) && plugin::check_handin(\%itemcount, 2204 => 4)) { #tailoring/smithing
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      elsif(($ulevel >= $fifthbotlevel) && ($qglobals{bot_spawn_limit} <= 4)) {
         if(($platinum == $fifthbotcost) && plugin::check_handin(\%itemcount, 3061 => 4)) { #smithing
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      elsif(($ulevel >= $nextbotlevel) && ($qglobals{bot_spawn_limit} <= 5)) {
         if(($platinum == $nextbotcost) && plugin::check_handin(\%itemcount, 8689 => 4)) { #fletching
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      elsif(($ulevel >= $nextbotlevel) && ($qglobals{bot_spawn_limit} >= 6)) {
         if(($platinum == $nextextracost) || (($platinum == $nextbotcost) && plugin::check_handin(\%itemcount, 8689 => 4))) {
            $success = $qglobals{bot_spawn_limit}+1;
         }
      }
      if($success > 0) {
         quest::say("Thanks $name!");
         quest::setglobal("bot_spawn_limit", $success, 5, "F");
         $client->Message(6,"You receive a character flag!");
         $client->Message(6,"You can now create and spawn an Individual! See: '#bot help create' and '#bot spawn' commands.");
         $client->Message(6,"You have $qglobals{bot_spawn_limit} out of quest::spawnbotcount() possible Individuals.");
         $success = 0;
      }
      else {
         quest::say("I don't need this.");
         plugin::return_items(\%itemcount);
         if($platinum != 0 || $gold !=0 || $silver != 0 || $copper != 0) {
            quest::givecash($copper, $silver, $gold, $platinum);
         }
      }
   }
   else {
      quest::say("I don't need this.");
      plugin::return_items(\%itemcount);
      if($platinum != 0 || $gold !=0 || $silver != 0 || $copper != 0) {
         quest::givecash($copper, $silver, $gold, $platinum);
      }
   }
   quest::settimer("face", 45);
}

sub EVENT_SPAWN {
   quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
}

sub EVENT_ENTER {
   if(quest::botquest()) {
      if(!defined $qglobals{bot_spawn_limit}) {
         quest::setglobal("bot_spawn_limit", 0, 5, "F");
      }
   }
}

sub EVENT_SIGNAL {
   if($signal == 1) {
      if((defined $qglobals{bot_spawn_limit}) && ($qglobals{bot_spawn_limit} > 0)) {
         quest::say("Hey! No talkin' to da merchandise!");
      }
   }
}
# END of FILE Zone:bazaar -- Aediles_Thrall.pl
Code:
############################################
# ZONE: Bazaar
# DATABASE: PEQ PoP-LoY
# LAST EDIT DATE: January 26, 2009
# VERSION: 1.0
# DEVELOPER: Congdar
#
# *** NPC INFORMATION ***
#
# NAME: Aspen
# TYPE: NPC
# RACE: Wood Elf
# LEVEL: 10
#
# *** QUESTS INVOLVED IN ***
#
# 1 - Custom Quest - Buying Slaves(bots)
#
#
# *** QUESTS AVAILABLE TO ***
#
# 1 - Anyone meeting level requirements
#
#
############################################

sub EVENT_SAY {
   if($text=~/Hail/i) {
      quest::signalwith(151070, 1, 1);
      my $facemob = $entity_list->GetMobByNpcTypeID(151070);
      $npc->FaceTarget($facemob);
   }
}
# END of FILE Zone:bazaar -- Aspen.pl
I have done some limited testing of this code, but I welcome any bug reports.
Reply With Quote
 


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 07:45 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