View Full Version : Alignment based guilds
GurkhaPanzers
08-07-2013, 07:20 PM
I been toying with the idea of creating 4 guilds on my server. One to align with Good powers, one with Evil powers, one to align with Undead and one to align with Dragon. Idea being each guild hall will have custom spells and items. My question is what is the best way to prevent one person from quiting a guild, joining another to get all the spells/items? My thought would be making a task to pick the guild and making it non-repeatable. Any good ideas. Is it possible to assign guilds in a task?
sorvani
08-07-2013, 07:46 PM
Do you mean guild as in player guild? If so no idea how to implement it.
Sounds like an. Interesting concept though.
GurkhaPanzers
08-07-2013, 08:52 PM
Yes sir, a player guild.
Kingly_Krab
08-07-2013, 09:13 PM
I don't believe you can do guilds in a task, however you can handle guilds in Perl and check if their guild id is the correct guild id in order to talk to said NPC or whatever you want to do.
Mariomario
08-07-2013, 09:15 PM
There is a quest::setguild(guild_id,rank) function. Set the task to function off of a script when completed. Make sure no members of the guild are officers/leader so therefore there can be no invites. Setting up the instances would be easy enough with Akkadius' plugin. Just use different versions to set up each.
The easiest way to prevent people from doing as you said, quitting and joining with another would probably be to set it up how you suggested. To join a guild by task, making it non repeatable and setting a qglobal in conjunction with the char id marking that character to which guild he belongs to. That way if they ever decide to leave the guild and attempt to get the task again, it checks the qglobal for that toon and then puts that toon back in the guild they belong.
This is just how I would personally set it up. The idea is completely doable.
GurkhaPanzers
08-07-2013, 11:22 PM
My perl script so far. What should I do next? Sorry I am a beginner at coding in PERL. My language is SAS which we don't use.
ENT_SAY {
my $sl1 = quest::saylink("Good", 1, "Join, The Order of Heaven");
my $sl2 = quest::saylink("Evil", 1, "Join, The Legion of the Infernal");
my $sl3 = quest::saylink("Undead", 1, "Join, The Unliving");
my $sl4 = quest::saylink("Dragon", 1, "Join, The Order of the Dragon");
my $sl5 = quest::saylink("Good2", 1, "I accept, I will give my life in service to Heaven and the Innocent!");
my $sl6 = quest::saylink("Evil2", 1, "I accept, I will pursue carnage, chaos and vengence and be a force of pure violence!");
my $sl7 = quest::saylink("Undead2", 1, "I accept, I will become death and visit it upon all. I will bless those I meet with death or undeath if they be lucky!");
my $sl8 = quest::saylink("Dragon2", 1, "I accept, I will follow the dragon blood in my veins and aide the great lords in once again ruling the world!");
my $sl9 = quest::saylink("Decline", 1, "I decline!");
my $NPCName = $npc->GetCleanName();
if ($uguild_id < 1) {
if($text=~/Hail/i) {
$client->Message(14,"$NPCName says 'Welcome. Please join an order that matches your soul. Remember once a choice is made it can not be changed! Choose wisely!'");
$client->Message(11,"::: $sl1");
$client->Message(11,"::: $sl2");
$client->Message(11,"::: $sl3");
$client->Message(11,"::: $sl4");
} elsif ($text=~/Good/i) {
$client->Message(14,"$NPCName says 'The Order of Heaven strives to meet Evil head on and lay it low in order to protect those who are innocent. Do you wish to join our Order of Heaven Sent Knights?'");
$client->Message(11,"::: $sl5");
$client->Message(11,"::: $sl9");
} elsif ($text=~/Good2/i) {
quest::setguild(30,0);
$client->Message(14,"$NPCName says 'I welcome the newest Heavensent Knight, $name!'");
} elsif ($text=~/Evil/i) {
$client->Message(14,"$NPCName says 'The Legion of the Infernal wishes to lay waste to all that is good and holy. Do you wish to join the Legion of the Infernal?'");
$client->Message(11,"::: $sl6");
$client->Message(11,"::: $sl9");
} elsif ($text=~/Evil2/i) {
quest::setguild(31,0);
$client->Message(14,"$NPCName says 'All fear the newest Infernal Deathbringer, $name!'");
} elsif ($text=~/Undead/i) {
$client->Message(14,"$NPCName says 'The Unliving will bring death and undeath rebirth to the world. Do you wish to be part of the rebirth of undeath?'");
$client->Message(11,"::: $sl7");
$client->Message(11,"::: $sl9");
} elsif ($text=~/Undead2/i) {
quest::setguild(32,0);
$client->Message(14,"$NPCName says 'The living tremble in terror at your might, $name!'");
} elsif ($text=~/Dragon/i) {
$client->Message(14,"$NPCName says 'The Dragons shall rule the world again! Do you wish to join their ranks of soldiers!'");
$client->Message(11,"::: $sl8");
$client->Message(11,"::: $sl9");
} elsif ($text=~/Dragon2/i) {
quest::setguild(33,0);
$client->Message(14,"$NPCName says 'A powerful change overcomes you, rise as a dragonborn!, $name!'");
}
}
Kingly_Krab
08-07-2013, 11:46 PM
It'd be much nicer if you posted that in [code] tags man, rather than a huge block of text, haha.
Mariomario
08-08-2013, 05:45 PM
You'll want to include qglobals as well to store which guild they chose initially, in case they decide to leave or accidentally remove themselves that way you can restore them to the correct guild without needing to guess or go off of their word since quite simply, people lie. When I get home in a bit I'll write up something for ya as a sample for 1 guild.
Mariomario
08-08-2013, 06:56 PM
sub EVENT_SAY {
my $sl1 = quest::saylink("Good", 1, "Join, The Order of Heaven");
my $sl2 = quest::saylink("Evil", 1, "Join, The Legion of the Infernal");
my $sl3 = quest::saylink("Undead", 1, "Join, The Unliving");
my $sl4 = quest::saylink("Dragon", 1, "Join, The Order of the Dragon");
my $sl5 = quest::saylink("Light", 1, "I accept, I will give my life in service to Heaven and the Innocent!");
my $sl6 = quest::saylink("Dark", 1, "I accept, I will pursue carnage, chaos and vengence and be a force of pure violence!");
my $sl7 = quest::saylink("Unliving", 1, "I accept, I will become death and visit it upon all. I will bless those I meet with death or undeath if they be lucky!");
my $sl8 = quest::saylink("Draco", 1, "I accept, I will follow the dragon blood in my veins and aide the great lords in once again ruling the world!");
my $sl9 = quest::saylink("Decline", 1, "I decline!");
my $rejoin = quest::saylink("silent rejoin",1,"rejoin");
if(!defined $qglobals{"Guild_Assignment"}) {
if($text=~/Hail/i) {
plugin::ClientSay("Welcome. Please join an order that matches your soul. Remember once a choice is made it can not be changed! Choose wisely!");
$client->Message(11,"::: $sl1");
$client->Message(11,"::: $sl2");
$client->Message(11,"::: $sl3");
$client->Message(11,"::: $sl4");
} elsif ($text=~/Good/i) {
plugin::ClientSay("The Order of Heaven strives to meet Evil head on and lay it low in order to protect those who are innocent. Do you wish to join our Order of Heaven Sent Knights?");
$client->Message(11,"::: $sl5");
$client->Message(11,"::: $sl9");
} elsif ($text=~/Light/i) {
quest::setglobal("Guild_Assignment",30,5,"F");
quest::setguild(30,0);
plugin::ClientSay("I welcome the newest Heavensent Knight, $name!");
} elsif ($text=~/evil/i) {
plugin::ClientSay("The Legion of the Infernal wishes to lay waste to all that is good and holy. Do you wish to join the Legion of the Infernal?");
$client->Message(11,"::: $sl6");
$client->Message(11,"::: $sl9");
} elsif ($text=~/dark/i) {
quest::setglobal("Guild_Assignment",31,5,"F");
quest::setguild(31,0);
plugin::ClientSay("All fear the newest Infernal Deathbringer, $name!");
} elsif ($text=~/undead/i) {
plugin::ClientSay("The Unliving will bring death and undeath rebirth to the world. Do you wish to be part of the rebirth of undeath?");
$client->Message(11,"::: $sl7");
$client->Message(11,"::: $sl9");
} elsif ($text=~/unliving/i) {
quest::setglobal("Guild_Assignment",32,5,"F");
quest::setguild(32,0);
plugin::ClientSay("The living tremble in terror at your might, $name!");
} elsif ($text=~/Dragon/i) {
plugin::ClientSay("The Dragons shall rule the world again! Do you wish to join their ranks of soldiers!");
$client->Message(11,"::: $sl8");
$client->Message(11,"::: $sl9");
} elsif ($text=~/draco/i) {
quest::setglobal("Guild_Assignment",33,5,"F");
quest::setguild(33,0);
plugin::ClientSay("A powerful change overcomes you, rise as a dragonborn!, $name!");
}
}
else
{
if($text=~/hail/i)
{
plugin::ClientSay("You already belong to a guild, if you have forsaken that name, but wish to $rejoin their cause I may induct you back into their guild.");
}
if($text=~/rejoin/i)
{
if($qglobals{"Guild_Assignment"} == 30)
{
quest::setguild(30,0);
plugin::ClientSay("Welcome back Heavensent Knight, $name!");
}
if($qglobals{"Guild_Assignment"} == 31)
{
quest::setguild(31,0);
plugin::ClientSay("Welcome back Infernal Deathbringer, $name!");
}
if($qglobals{"Guild_Assignment"} == 32)
{
quest::setguild(32,0);
plugin::ClientSay("The living tremble in terror at your might, $name!");
}
if($qglobals{"Guild_Assignment"} == 33)
{
quest::setguild(33,0);
plugin::ClientSay("Rise again as a dragonborn!, $name!");
}
}
}
}
I simply copied your code, so your initial set up is still there along with your wording. I changed a few things around and added in the qglobal set up. I tested it for fun just to ensure it worked correctly. Just be sure those 4 guilds are properly created and make the leaders of each guild (since a guild needs a leader) one of your own toons, therefore making invites impossible. Also be sure the NPC you use has qglobal turned on (1) in the DB under npc_types, otherwise he wont function correctly.
There were also changes to your 'evil','evil2' etc say links since they overlapped. /evil2/i =~ /evil/i since evil2 contains all the same characters as evil and overlapped causing you to receive the first saylink asking to join the guild. I changed them around to different words associated with the type, ie. good, light, evil, dark, undead, unliving, dragon, draco so the saylinks work as intended. Hope this is helpful.
Drajor
08-09-2013, 02:34 AM
If people are assigned a guild via quest, in my experience there does not need to be a leader or any officers.
Kingly_Krab
08-09-2013, 03:18 AM
If people are assigned a guild via quest, in my experience there does not need to be a leader or any officers.
Yeah, you can set their rank to 0, there's no need for the other ranks to exist.
Mariomario
08-09-2013, 12:13 PM
Im aware you can just set their rank to 0, but upon initial creation of the guild a leader must be named. In the guilds table the `leader` attribute must be unique, so its not like you can just set them all to 0. You cant just assign a guild via quest::setguild(id,rank) if the guild id doesnt exist. That was my only concern. I know you could after initially creating the guilds set the leader characters rank to 0 in the guild_members table as well, but I dont know what the relationship between the guild tables `leader` and anything have in common. I havent done any extensive testing with this.
GurkhaPanzers
08-10-2013, 07:51 AM
Thanks for all the help. One more question how in perl can I set a player as a banker in their guild?
Mariomario
08-10-2013, 10:50 AM
I dont think there are any quest functions to do that. Since you probably dont care about the individual, you can just run a vague query to set all players in those guilds bankers. Something like:
UPDATE guild_members SET banker = 1 WHERE (guild_id = 30 || guild_id = 31 || guild_id = 32 || guild_id = 33);
In order to run a query through Perl you first need to make a connection with the DBI module. If you don't know how to use the DBI module there are a few posts with examples.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.