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 09-01-2008, 05:34 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default Kingdom Quest

After many days of playing with this quest, I have finally made it work. I still have some enhancements to add, but here is the working script.

Overview
The quest assumes four kingdoms (each with its own faction). You can adjust it for as many as you need. The quest also assumes a single instance (at a time) of a unique item. In the present case, it's a ring. The quest begins with a player either discovering the ring or winning it by defeating another kingdom that holds it. Once that player has the ring, he becomes pvp. This allows other players to kill him and take the ring as their own (I have not added the pvp loot feature yet). To avoid this, the player may opt to click the ring and make himself invisible (item click effect). However, each time the player enters a new zone, certain opposing-faction npcs are alerted to his presence and hunt him down (via an ENTERZONE aggro timer). If they find him and kill him, their "king" spawns and takes the ring (via a nukeitem object). If he makes it to his kingdom of choice, he is allowed to enter the king's presence (via the check_hasitem plugin) and turn in the ring. Upon turn-in, he is granted full ally status (along with 5k plat and enough exp to level a lvl 32 player). The turn-in also sets a global that grants an hp buff (conviction) to all players who have at least 850 faction with the "holding" kingdom. The buff remains until the ring is taken from the kingdom by another faction (even if you accidentally click it off, the global will immediately recast it as long as your faction remains high). Once an opposing faction raids your kingdom and kills the right npcs, they can do a turn-in to the king in exchange for the ring. That triggers a delglobal for the kingdom faction, and all kingdom buffs fade.

Set Global Script
The starting script that sets the global resides on the npc_id.pl for the king of each faction (this is not the entire script, but the relevant portion only):
Code:
sub EVENT_ITEM 
{
	if(plugin::check_handin(\%itemcount,13732 => 1)) 
		{
    		quest::setglobal("kingdomfaction", 1, 7, "F");
		quest::givecash("0","0","0","5000");
    		quest::exp(3500000);
    		quest::faction(484,2000);
    		quest::ding();
                 }
}
Check Global and Buff-By-Faction Script
Here is the the check_global script. It resides in the player.pl of each zone where you want it to apply. It buffs all players that hold a "kingdom" faction of 850 or more:
Code:
sub EVENT_ENTERZONE 
	{
	if(plugin::check_hasitem($client, 13732))
		{
		$client->SetPVP(1);
		quest::settimer("aggro",20);
		$client->Message(257, "A mysterious voice whispers to you, 'I'm coming for you!' ");
		}
	else
		{
		quest::settimer("check",1);
		}
	}
		
sub EVENT_TIMER 
	{
	if($timer eq "aggro")
		{
		my $guard_one = $entity_list->GetMobByNpcTypeID(999243);
		if ($guard_one) 
			{
			my $hate_guard_one = $guard_one->CastToNPC();
			$hate_guard_one->AddToHateList($client, 1);
			}
		quest::stoptimer("aggro");
		}
	elsif($timer eq "check")
		{
		my $factioncheck = undef;
		if (defined($qglobals{kingdomfaction}))
			{	
			if ($qglobals{kingdomfaction} == 1) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(484);
					{
					if ($factioncheck >= 850)
						{
						if (!$client->FindBuff(5257)) 
							{
							quest::selfcast(5257);
							}
						}
					elsif ($client->FindBuff(5257)) 
						{
						$client->BuffFadeBySpellID(5257);
						}
					}
				}

			elsif ($qglobals{kingdomfaction} == 2) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(485);
					{
					if ($factioncheck >= 850)
						{
						if (!$client->FindBuff(5257)) 
							{
							quest::selfcast(5257);
							}
						}
					elsif ($client->FindBuff(5257)) 
						{
						$client->BuffFadeBySpellID(5257);
						}
					}
				}

			elsif ($qglobals{kingdomfaction} == 3) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(486);
					{
					if ($factioncheck >= 850)
						{
						if (!$client->FindBuff(5257)) 
							{
							quest::selfcast(5257);
							}
						}
					elsif ($client->FindBuff(5257)) 
						{
						$client->BuffFadeBySpellID(5257);
						}
					}
				}
			
			elsif ($qglobals{kingdomfaction} == 4) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(486);
					{
					if ($factioncheck >= 850)
						{
						if (!$client->FindBuff(5257)) 
							{
							quest::selfcast(5257);
							}
						}
					elsif ($client->FindBuff(5257)) 
						{
						$client->BuffFadeBySpellID(5257);
						}
					}
				}

			elsif ($client->FindBuff(5257))
				{
				$client->BuffFadeBySpellID(5257);
				}
			}
		}
	}
Delete Global Script
This is the script that triggers when a player turns in a bridle after killing the king's guard. With the first script, it also resides on each king's npc_id.pl script:
Code:
sub EVENT_SAY
	{
	if($text=~/hail/i)
		{
		if(plugin::check_hasitem($client, 15001)) #looted bridle of the king's guard
			{
			quest::say("What is the meaning of your presence here, $name? And what is that in your hand? It looks like my personal guard's own bridle! Give me the proof of my defeat!");
			}
		}
	if($text=~/accept that risk/i) #refers to turn-in statements
		{
		quest::say("You have been warned, $name.");
		quest::delglobal("kingdomfaction");
		quest::summonitem("13732");
		quest::pvp("on");
		quest::setsky(1);
		quest::rain(0);
		quest::repopzone();
		}
	}

sub EVENT_ITEM 
	{
	if(plugin::check_handin(\%itemcount,15001 => 1)) 
		{
    		quest::say("Just as I feared. My personal guard is dead, and our kingdom is lost. The ring has betrayed me. I will give you what 

you seek, $name. But be warned--The ring is trecherous. It will betray you, even to your death. Do you wish to [accept that risk]?");
		quest::emote("begins to weep; his face fills with sadness");
		}
	else
		{
    		quest::say("What is this, $name? This is not my guard's bridle!");
    		plugin::return_items(\%itemcount); 
		}
	}
It's messy, I know. But it works. Feel free to improve.
Reply With Quote
  #2  
Old 09-01-2008, 05:50 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

By the way, bear in mind that I run a world where there is no player spell casting and no normal player buffs. Hence, there is a very real advantage to the players of the ring-bearing faction, and a very real incentive for players of opposing factions to get the ring for their own kingdom. You may need to use something else besides a buff for your world (e.g., summon a no-rent item that has nice stats).

In the future I will enhance this script to give highest -level players multiple buffs, lower-level players lower-level buffs, and lesser buffs to other kingdoms that are considered "friendly" to the ring-bearing kingdom.

And, yes, my "ring" concept is not exactly my own
Reply With Quote
  #3  
Old 09-01-2008, 08:47 PM
lanileb
Sarnak
 
Join Date: Jul 2007
Posts: 79
Default

whoa, what server do you run? I definitely want to check this out.
Reply With Quote
  #4  
Old 09-01-2008, 09:45 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

It's called MOTW, but it's not on very often since it's currently on my laptop and since I use the laptop for work, lol. That will change in about a month when I order a custom-built gaming pc that will host a dedicated server. It is based entirely on custom zones that reflect a decidedly LOTR theme. Right now it's just a hobby that I am working on with my son, who is a computer science major at CU.
Reply With Quote
  #5  
Old 09-03-2008, 08:52 AM
lanileb
Sarnak
 
Join Date: Jul 2007
Posts: 79
Default

wow cool stuff, let me know when you have it up more full time and I'll be sure to check it out!
Reply With Quote
  #6  
Old 09-06-2008, 07:33 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Post

I have revised this script to increment the reward for kingdom faction based on level.

Levels 1-19 get Valor
Levels 20-35 get Temperance
Levels 36-49 get Aegolism
Levels 50-60 get Virtue
Levels 60-65 get Conviction

The script still assumes four kingdoms (factions) that may be eligible for kingdom blessings. I placed this in my quest/templates folder, and renamed the player.pl in the other zones I'm working with, and it works great.

Here it is
Code:
sub EVENT_ENTERZONE 
	{
	quest::settimer("check",1);
	}	

sub EVENT_TIMER 
	{
	if($timer eq "check") {
		my $factioncheck = undef;
		if (defined($qglobals{kingdomfaction}))
			{	
			if ($qglobals{kingdomfaction} == 1) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(484);
					{
					if ($factioncheck >= 850 && $ulevel >= 60)
						{
						if (!$client->FindBuff(5257)) #kingdom blessing V  

							{
							quest::selfcast(5257);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 50) 
						{
						if (!$client->FindBuff(3467)) 
#kingdom blessing IV
							{
							quest::selfcast(3467);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 35) 
						{
						if (!$client->FindBuff(1447)) 
#kingdom blessing III
							{
							quest::selfcast(1447);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 20) 
						{
						if (!$client->FindBuff(3692)) 
#kingdom blessing II
							{
							quest::selfcast(3692);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 1) 
						{
						if (!$client->FindBuff(312)) 
#kingdom blessing I
							{
							quest::selfcast(312);
							}
						}
					
					elsif ($client->FindBuff(5257) || $client->FindBuff(3467) || $client->FindBuff(1447) || $client->FindBuff(3692) || $client->FindBuff(312)) 
						{
						$client->BuffFadeBySpellID(5257);
						$client->BuffFadeBySpellID(3467);
						$client->BuffFadeBySpellID(1447);
						$client->BuffFadeBySpellID(3692);
						$client->BuffFadeBySpellID(312);		
						}
					}
				}
			
			if ($qglobals{kingdomfaction} == 2) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(485);
					{
					if ($factioncheck >= 850 && $ulevel >= 60)
						{
						if (!$client->FindBuff(5257)) #kingdom blessing V  

							{
							quest::selfcast(5257);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 50) 
						{
						if (!$client->FindBuff(3467)) 
#kingdom blessing IV
							{
							quest::selfcast(3467);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 35) 
						{
						if (!$client->FindBuff(1447)) 
#kingdom blessing III
							{
							quest::selfcast(1447);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 20) 
						{
						if (!$client->FindBuff(3692)) 
#kingdom blessing II
							{
							quest::selfcast(3692);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 1) 
						{
						if (!$client->FindBuff(312)) 
#kingdom blessing I
							{
							quest::selfcast(312);
							}
						}
					
					elsif ($client->FindBuff(5257) || $client->FindBuff(3467) || $client->FindBuff(1447) || $client->FindBuff(3692) || $client->FindBuff(312)) 
						{
						$client->BuffFadeBySpellID(5257);
						$client->BuffFadeBySpellID(3467);
						$client->BuffFadeBySpellID(1447);
						$client->BuffFadeBySpellID(3692);
						$client->BuffFadeBySpellID(312);		
						}
					}
				}

			if ($qglobals{kingdomfaction} == 3) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(487);
					{
					if ($factioncheck >= 850 && $ulevel >= 60)
						{
						if (!$client->FindBuff(5257)) #kingdom blessing V  

							{
							quest::selfcast(5257);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 50) 
						{
						if (!$client->FindBuff(3467)) 
#kingdom blessing IV
							{
							quest::selfcast(3467);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 35) 
						{
						if (!$client->FindBuff(1447)) 
#kingdom blessing III
							{
							quest::selfcast(1447);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 20) 
						{
						if (!$client->FindBuff(3692)) 
#kingdom blessing II
							{
							quest::selfcast(3692);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 1) 
						{
						if (!$client->FindBuff(312)) 
#kingdom blessing I
							{
							quest::selfcast(312);
							}
						}
					
					elsif ($client->FindBuff(5257) || $client->FindBuff(3467) || $client->FindBuff(1447) || $client->FindBuff(3692) || $client->FindBuff(312)) 
						{
						$client->BuffFadeBySpellID(5257);
						$client->BuffFadeBySpellID(3467);
						$client->BuffFadeBySpellID(1447);
						$client->BuffFadeBySpellID(3692);
						$client->BuffFadeBySpellID(312);		
						}
					}
				}
		
			if ($qglobals{kingdomfaction} == 4) 
				{	
				$factioncheck = $client->GetCharacterFactionLevel(488);
					{
					if ($factioncheck >= 850 && $ulevel >= 60)
						{
						if (!$client->FindBuff(5257)) #kingdom blessing V  

							{
							quest::selfcast(5257);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 50) 
						{
						if (!$client->FindBuff(3467)) 
#kingdom blessing IV
							{
							quest::selfcast(3467);
							}
						}

					elsif ($factioncheck >= 850 && $ulevel >= 35) 
						{
						if (!$client->FindBuff(1447)) 
#kingdom blessing III
							{
							quest::selfcast(1447);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 20) 
						{
						if (!$client->FindBuff(3692)) 
#kingdom blessing II
							{
							quest::selfcast(3692);
							}
						}
					elsif ($factioncheck >= 850 && $ulevel >= 1) 
						{
						if (!$client->FindBuff(312)) 
#kingdom blessing I
							{
							quest::selfcast(312);
							}
						}
					
					elsif ($client->FindBuff(5257) || $client->FindBuff(3467) || $client->FindBuff(1447) || $client->FindBuff(3692) || $client->FindBuff(312)) 
						{
						$client->BuffFadeBySpellID(5257);
						$client->BuffFadeBySpellID(3467);
						$client->BuffFadeBySpellID(1447);
						$client->BuffFadeBySpellID(3692);
						$client->BuffFadeBySpellID(312);		
						}
					}
				}
			}
		}
	}
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 02:12 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