Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2012, 10:40 AM
Sinclipse
Hill Giant
 
Join Date: May 2012
Posts: 122
Default Need help... Bot quest...

Code:
##Bot Script ##Made by Dirge

sub EVENT_SAY
{
	$botcount = $qglobal{bot_spawn_limit};
	
	if(($ulevel >= 10) && ($botcount == 0))
	{
		$companion = quest::saylink("companion");
		$yes = quest::saylink("yes");
		
		if($botcount == 0)
		{
			if($text=~/hail/i)
			{
				plugin::Whisper("Hello there $name; would you be interested in obtaining a [$companion]?");
			}
			elsif($text=~/companion/i)
			{
				plugin::Whisper("Of course, I live to serve. 'Insert info about bot 1'");
			}
			elsif($text=~/yes/i)
			{
				if(($ulevel >= 10) && ($botcount == 0))
				{
					plugin::Whisper("Enjoy your first of many companions.");
					$botcount = $qglobals{bot_spawn_limit} + 1;
				}
				else
				{
					plugin::Whisper("You already have one bot; come back again once you are more experienced.");
				}
			}
		}
	}
	elsif(($ulevel >= 30) && ($botcount > 0 && $botcount < 2))
	{
		$completed = 0;
		$companion = quest::saylink("companion");
		
		if($text=~/hail/i)
		{
			plugin::Whisper("Hello again $name; are you interested in acquiring a second [$companion]?");
		}
		elsif($text=~/companion/i)
		{
			plugin::Whisper("Very well, 'Insert info about bot 2'");
		}
		
		
		##End Product
		elsif($completed == 1)
		{
			plugin::Whisper("Congratulations $name; here is your second companion.");
			$botcount = $qglobal{bot_spawn_limit} + 1;
		}
	}
	elsif($botcount >= 2)
	{
		plugin::Whisper("You already have the maximum number of companions; go adventure.");
	}
	else
	{
		plugin::Whisper("Please return when you have acquired enough knowledge.");
	}
}
This is the current code we have, it doesn't work. I've changed the plugin::Whisper to $npcwhisper as well, I can't seem to figure this out, is it something I'm doing wrong in the Database? As, when I tried copying over the Bazaar way of obtaining Bots to a random NPC in Nexus, it STILL didn't work... What's going on with the script, any help would be great.
Reply With Quote
  #2  
Old 12-05-2012, 11:03 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Are you setting the bot_spawn_limit qglobal in another script, cause I don't see you setting it anywhere in that script. Without it being set, it will fail to get a numeric value since it is undefined. You should do a defined check before trying to get a qglobal value.

Also, if you are missing the Whisper plugin in your plugins folder, that will cause an issue. You should be able to test if it works by replacing plugin:Whisper with quest::say throughout the script.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 12-05-2012, 11:19 AM
Sinclipse
Hill Giant
 
Join Date: May 2012
Posts: 122
Default

Quick response, I like it. I've set it to quest::say, still get the error of nothing... No other scripts have been placed. The Q global has 5 bot_spawn_limit's this is where I'm confused at... Listed below is all of them that I see... As I said, I copied the one directly from the Bazaar and put him in the Nexus, and it STILL didn't work (he wouldn't talk to me, yet he would in the Bazaar)...

Code:
ID: 215 charid: 438 NPCID: 0 zoneid: 0 Name: bot_spawn_limit Value: 0
Code:
ID: 198 charid: 1 NPCID: 0 zoneid: 0 Name: bot_spawn_limit Value: 1
Code:
ID: 62 charid: 41 NPCID: 0 zoneid: 0 Name: bot_spawn_limit Value:6
Code:
ID: 228 charid: 507 NPCID: 0 zoneid: 0 Name: bot_spawn_limit Value:0
Code:
ID: 213 charid: 429 NPCID: 0 zoneid: 0 Name: bot_spawn_limit Value:0
Reply With Quote
  #4  
Old 12-05-2012, 12:18 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

what is it that isn't working?
Reply With Quote
  #5  
Old 12-05-2012, 01:16 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

your logic was a bit convoluted, had redundant checks, and at least one part was never going to be triggered (see highlights). also, when you were incrementing $botcount, it wasn't updating the qglobals, which it seemed to appear what you intended.

Quote:
Originally Posted by Sinclipse View Post
Code:
##Bot Script ##Made by Dirge

sub EVENT_SAY
{
    $botcount = $qglobal{bot_spawn_limit};
    
    if(($ulevel >= 10) && ($botcount == 0))
    {
        $companion = quest::saylink("companion");
        $yes = quest::saylink("yes");
        # we already know $botcount is 0
        if($botcount == 0)
        {
            if($text=~/hail/i)
            {
                plugin::Whisper("Hello there $name; would you be interested in obtaining a [$companion]?");
            }
            elsif($text=~/companion/i)
            {
                plugin::Whisper("Of course, I live to serve. 'Insert info about bot 1'");
            }
            elsif($text=~/yes/i)
            {
                # we already know both of these are true
                if(($ulevel >= 10) && ($botcount == 0))
                {
                    plugin::Whisper("Enjoy your first of many companions.");
                    # this is not updating the qglobal
                    $botcount = $qglobals{bot_spawn_limit} + 1;
                }
                # this will never happen, as we already know $botcount is 0
                else
                {
                    plugin::Whisper("You already have one bot; come back again once you are more experienced.");
                }
            }
        }
    }
    elsif(($ulevel >= 30) && ($botcount > 0 && $botcount < 2))
    {
        $completed = 0;
        $companion = quest::saylink("companion");
        
        if($text=~/hail/i)
        {
            plugin::Whisper("Hello again $name; are you interested in acquiring a second [$companion]?");
        }
        elsif($text=~/companion/i)
        {
            plugin::Whisper("Very well, 'Insert info about bot 2'");
        }
        
        
        ##End Product
        elsif($completed == 1)
        {
            plugin::Whisper("Congratulations $name; here is your second companion.");
            # this is not updating the qglobal
            $botcount = $qglobal{bot_spawn_limit} + 1;
        }
    }
    elsif($botcount >= 2)
    {
        plugin::Whisper("You already have the maximum number of companions; go adventure.");
    }
    else
    {
        plugin::Whisper("Please return when you have acquired enough knowledge.");
    }
}
This is the current code we have, it doesn't work. I've changed the plugin::Whisper to $npcwhisper as well, I can't seem to figure this out, is it something I'm doing wrong in the Database? As, when I tried copying over the Bazaar way of obtaining Bots to a random NPC in Nexus, it STILL didn't work... What's going on with the script, any help would be great.
try this:

Code:
##Bot Script ##Made by Dirge

sub EVENT_SAY
{
    $companion = quest::saylink("companion");
    $yes       = quest::saylink("yes");
    # qglobal not set, assume no bots.
    if (!defined $qglobal{bot_spawn_limit})
    {
        if ($ulevel < 10)
        {
            quest::say("Please return when you have acquired enough knowledge.");
        }
        elsif ($text=~/hail/i)
        {
            quest::say("Hello there $name; would you be interested in obtaining a [$companion]?");
        }
        elsif ($text=~/companion/i)
        {
            quest::say("Of course, I live to serve. 'Insert info about bot 1'");
        }
        elsif ($text=~/yes/i)
        {
            quest::say("Enjoy your first of many companions.");
            quest::setglobal('bot_spawn_limit', 1, 5);
        }
    }
    # qglobal is set to 1
    elsif ($qglobal{bot_spawn_limit} == 1)
    {
        $completed = 0;
        if ($ulevel < 30)
        {
            quest::say("Please return when you have acquired enough knowledge.");
        }
        elsif ($text=~/hail/i)
        {
            quest::say("Hello again $name; are you interested in acquiring a second [$companion]?");
        }
        elsif ($text=~/companion/i)
        {
            quest::say("Very well, 'Insert info about bot 2'");
        }
        ## End Product
        elsif ($completed == 1)
        {
            quest::say("Congratulations $name; here is your second companion.");
            quest::setglobal('bot_spawn_limit', 2, 5);
        }
    }
    # qglobal is > 1
    else
    {
        quest::say("You already have the maximum number of companions; go adventure.");
    }
}
Reply With Quote
  #6  
Old 12-05-2012, 09:09 PM
Sinclipse
Hill Giant
 
Join Date: May 2012
Posts: 122
Default

Hmm I'll try that out, Harmtouch made the script originally.
Reply With Quote
  #7  
Old 12-05-2012, 09:17 PM
Sinclipse
Hill Giant
 
Join Date: May 2012
Posts: 122
Default

So tried it, it didn't set the bot limit...
Reply With Quote
  #8  
Old 12-05-2012, 09:32 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

probably because i forgot to include the duration parameter in my calls to quest::setglobal();

Code:
quest::setglobal(varname,value,options,duration)
you likely want to use a value of "F".
Reply With Quote
  #9  
Old 12-06-2012, 02:52 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Also, make sure that the NPC entry in the npc_types table has qglobal enabled. There is a field setting for that and if it is set to 0 (default), it won't load/read qglobals at all.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #10  
Old 07-16-2017, 01:03 PM
Fridgecritter
Hill Giant
 
Join Date: Feb 2008
Posts: 191
Default

This wouldn't work on a stock server setup that already has bots enabled where people can spawn a whole bunch of bots at once, correct? Because all they would have to do is not talk to the NPC and they could spawn all kinds of bots.

So I guess my question is, what needs to be set in order for this quest to work with every character from the start. I have a quest file just like this, but it relies on items being turned in for enabling more bots. I changed it to level based, but I want to know what settings in the database or anywhere else I need to change so that:
  • The default amount of bots a character can spawn is 0 until they talk to the NPC
  • After talking to the NPC it's 1 bot, and so on.
Reply With Quote
  #11  
Old 07-17-2017, 01:39 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

rule_values table:
Code:
Bots:QuestableSpawnLimit
Set to true

Then the server will use the type 5 quest global "bot_spawn_limit" for each player.

To initialize this, place this in the global_player.pl (assuming you use Perl):
Code:
sub EVENT_CONNECT {
	if (not defined $qglobals{"bot_spawn_limit"}) {
		quest::setglobal("bot_spawn_limit", 0, 5, "F");
	}
}
Then they'll have to talk to an NPC, or whatever conditions you set that will make changes to the type 5 quest global "bot_spawn_limit"
Reply With Quote
  #12  
Old 07-17-2017, 01:41 PM
Fridgecritter
Hill Giant
 
Join Date: Feb 2008
Posts: 191
Default

You're a badass. Thanks a ton.
Reply With Quote
  #13  
Old 07-19-2017, 12:12 AM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Fridgecritter View Post
You're a badass. Thanks a ton.
You're welcome, anytime.
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 11:33 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