EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Quest::CreateGuild(guild_name, leader); - Question! (https://www.eqemulator.org/forums/showthread.php?t=34992)

Nall 03-05-2012 02:08 PM

Quest::CreateGuild(guild_name, leader); - Question!
 
Good Afternoon Gentlemen,

Pretty simple question, tough answer?

In Referance too,
"quest::CreateGuild(guild_name, leader); "

i've read the following thread:
http://www.eqemulator.org/forums/sho...guild+creation

:???:
"How does the player specify the guild name for a quest creation"?



I understand it grabs leaders name from the person turning in the quest. and the variable it uses is "guild_name" but how do i fill that variable as a player? Can the player type it into a parchment? Say it out loud at a certain point?

Goal: Im attempting to make a quest to automate guild creation, so that no GM intervention is required. AKA.. Turn in Item "A" and "B" and your guild is created.


EXAMPLE:

Quote:


my $first_item = 0;
my $second_item = 0;

sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Hello there, I'm XYZ the Headmaster for Guild Creation. are you intrested in creating a guild?")
}
if ($text=~/guild/i) {
quest::say("I'd like to help you create a guild, however im going to need a few items to make this happen, bring me the feather of the Mighty Griffon Grimfeather from North Karana and Paw of Fippy Darkpaw from Qeynos ");
}
if ($text=~/flags/i) {
quest::say("$first_item $second_item");
}
}

sub EVENT_ITEM {
if ($itemcount{19113} > 0) {
$first_item = $first_item + $itemcount{19113};
}
if ($itemcount{16498} > 0) {
$second_item = $second_item + $itemcount{16498};
}


if (($first_item >= 1) && ($second_item >= 1))
{
$first_item = 0;
$second_item = 0;
quest::emote("cheers enthusiastically .");
quest::CreateGuild(guild_name, leader);
quest::ding();
}

}
Missing just a little something to connect the dots

Nall 03-06-2012 02:19 PM

basically as a NON-GM how would a user specify the guild name for a quest creation?

joligario 03-06-2012 02:38 PM

I've got an idea for you, but I'd have to test it out first. Maybe I'll have a chance when I get home tonight. It would basically use the text from the client following the turn-in and specific dialogue.

Nall 03-06-2012 02:42 PM

excellent, let me know

joligario 03-06-2012 08:31 PM

I was thinking something like this (untested):

Code:

my $GuildName = '';
my $GuildLeader = '';

sub EVENT_TIMER {
  quest::stoptimer("cooldown");
  quest::say("$GuildLeader, just come back when you think of a good [name] for your guild.");
  $GuildName = '';
  $GuildLeader = '';
}

sub EVENT_SAY {
  if (defined($qglobals{newguild}) && ($qglobals{newguild} == 1)) {
    if (($GuildLeader eq '') || ($GuildLeader eq $name)) {
      if ($text =~ /name/i) {
        quest::say("Ok, $name. What is the name of the guild you would like to create?");
        $GuildLeader = $name;
        quest::settimer("cooldown", 60);
      }
      elsif (($text =~ /^yes$/i) && ($GuildLeader eq $name)) {
        quest::say("Ok, $name. Your guild will be called $GuildName. Congratulations!");
        quest::CreateGuild(guild_name, leader);
        quest::ding();
        quest::delglobal("newguild");
        quest::stoptimer("cooldown");
        $GuildName = '';
        $GuildLeader = '';
      }
      elsif (($text =~ /^no$/i) && ($GuildLeader eq $name)) {
        quest::say("Ok, $name. Your guild will not be called $GuildName. Just let me know when you come up with a good [name] for your guild.");
        $GuildName = '';
        $GuildLeader = '';
      }
      else {
        $GuildName = $text;
        quest::say("Ok, $name. You want your guild to be called $GuildName? You must tell me 'yes' or 'no' to continue.");
      }
    }
    else {
      quest::say("Sorry, $name. Let me finish with $GuildLeader first.");
    }
  }
  else {
    if ($text =~ /hail/i) {
      quest::say("Hello there, I'm XYZ the Headmaster for Guild Creation. Are you intrested in creating a [guild]?");
    }
    elsif ($text =~ /guild/i) {
      quest::say("I'd like to help you create a guild, however I'm going to need a few items to make this happen. Bring me the feather of the Mighty Griffon Grimfeather from North Karana and Paw of Fippy Darkpaw from Qeynos.");
    }
  }
}

sub EVENT_ITEM {
  if (plugin::check_handin(\%itemcount, 19113 => 1, 16498 => 1)) {
    quest::emote("cheers enthusiastically.");
    quest::say("Excellent work, $name. I can now help you to create a guild. Let me know when you would like to [name] your guild.");
    quest::setglobal("newguild", 0, 1, "F");
  }
  else {
    quest::say("I do not need this.");
    plugin::return_items(\%itemcount);
  }
}


trevius 03-07-2012 02:57 AM

That looks pretty good. There is at least 1 thing that needs to be corrected in that script and it is the line that actually creates the guild:

Code:

quest::CreateGuild(guild_name, leader);
I think if you change that line to the following, it should correct at least that one issue:

Code:

quest::CreateGuild($GuildName , $GuildLeader);
It looks like the quest command is coded to return a value for that command so you know if the guild was created or not. If that was true, then you would probably want to account for that in the script to make sure one was created before saying that their guild was created. Though, it looks like in quest_mgr.cpp the actual function is set to void, so it won't return anything, unless I am missing something.

joligario 03-07-2012 06:14 AM

Yeah, I realized that I hadn't added the variables late last night and came to edit but you already caught it. I also didn't check the syntax of the create command.

trevius 03-07-2012 07:48 AM

Looking at the code again, it looks like it is looking for the character id for the leader instead of just the name, so you would want to get their character ID and use it in that function instead of the char name.

Akkadius 03-07-2012 02:25 PM

Quote:

Originally Posted by trevius (Post 207862)
Looking at the code again, it looks like it is looking for the character id for the leader instead of just the name, so you would want to get their character ID and use it in that function instead of the char name.

It gets the ID based on the name of the leader, works much like the # command.

http://www.eqemulator.org/forums/showthread.php?t=33655

Nall 03-08-2012 02:14 AM

going to try it with the corrections tomorrow... its 1am atm.. bout to pass out.. I'll let you know how it turns out.

cannon 06-09-2015 10:54 PM

Anyone ever get this working?

Kingly_Krab 06-10-2015 12:35 AM

Yes, this now works, as this post was 3 years ago, but I guess they never posted to let anyone know, check here for our Perl reference:
Code:

quest::createguild(guild_name, leader_name) # Creates a new guild.


All times are GMT -4. The time now is 12:25 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.