|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
|
|
|
12-05-2012, 10:40 AM
|
Hill Giant
|
|
Join Date: May 2012
Posts: 122
|
|
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.
|
|
|
|
12-05-2012, 11:03 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
12-05-2012, 11:19 AM
|
Hill Giant
|
|
Join Date: May 2012
Posts: 122
|
|
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
|
12-05-2012, 12:18 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
what is it that isn't working?
|
|
|
|
12-05-2012, 01:16 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
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
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.");
}
}
|
|
|
|
12-05-2012, 09:09 PM
|
Hill Giant
|
|
Join Date: May 2012
Posts: 122
|
|
Hmm I'll try that out, Harmtouch made the script originally.
|
12-05-2012, 09:17 PM
|
Hill Giant
|
|
Join Date: May 2012
Posts: 122
|
|
So tried it, it didn't set the bot limit...
|
12-05-2012, 09:32 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
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".
|
12-06-2012, 02:52 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
07-16-2017, 01:03 PM
|
Hill Giant
|
|
Join Date: Feb 2008
Posts: 189
|
|
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.
|
07-17-2017, 01:39 PM
|
|
Dragon
|
|
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
|
|
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"
|
07-17-2017, 01:41 PM
|
Hill Giant
|
|
Join Date: Feb 2008
Posts: 189
|
|
You're a badass. Thanks a ton.
|
07-19-2017, 12:12 AM
|
|
Dragon
|
|
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
|
|
Quote:
Originally Posted by Fridgecritter
You're a badass. Thanks a ton.
|
You're welcome, anytime.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:50 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|