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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #22  
Old 01-21-2013, 11:51 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Here is the instance code I am using.

Currently allows Solo / Group / Guild

Guild and group will only show up if you are in.. well... a GUILD or GROUP! =p

If that guild / group / solo -- has an instance already defined you have 2 options now!

Can either Enter the instance or Delete it -- I might have to add a pop-up for delete so people don't just go ... OOPS deleted.

The event spawn / timer were not written by me but adds a neat effect to the NPC.

Use this / pick through it --- might help you with what you are trying to do.


One thing I need to add is an Instance Wipe .. but I am lazy


Code:
sub EVENT_SPAWN {

    my $x = $npc->GetX();
	my $y = $npc->GetY();
	my $z = $npc->GetZ();
	my $range = (15);
	quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range, $z - 10, $z + 20);
	quest::settimer("effect",1);
	quest::settimer("effect2",1);
}

sub EVENT_ENTER
{
			$client->Message(315, "For Waypoint Options: Target the portal and Hail for options.");	
}

sub EVENT_TIMER
{
	if($timer eq "effect"){
		$npc->SpellEffect(178);
		$npc->SpellEffect(203);
		$npc->SendAppearanceEffect(77,78);
		quest::stoptimer("effect");
		quest::settimer("effect",12);
	}
	if($timer eq "effect2"){
		$npc->SendAppearanceEffect(77,78);
		quest::stoptimer("effect2");
		quest::settimer("effect2",4);
	}
}

sub EVENT_SAY
{
			my $Cx = $client->GetX();
			my $Cy = $client->GetY();
			my $Cz = $client->GetZ();
			my $createsolo = quest::saylink("Create Solo",1);
			my $entersolo = quest::saylink("Enter Solo",1);
			my $deletesolo = quest::saylink("Delete Solo",1);
			my $createguild = quest::saylink("Create Guild",1);
			my $enterguild = quest::saylink("Enter Guild",1);
			my $deleteguild = quest::saylink("Delete Guild",1);
			my $creategroup = quest::saylink("Create Group",1);
			my $entergroup = quest::saylink("Enter Group",1);
			my $deletegroup = quest::saylink("Delete Group",1);
			my $space = "_";
			my $instguild = "guild";
			my $soloinst = "solo";
			my $groupinst = "group";
			my $soloname = "$name";
			my $sologlob = "$name$space$soloinst$space$zonesn";
			my $guildglob = "$uguild_id$space$instguild$space$zonesn";
			my $qglobals = plugin::var('qglobals');	
			my $GETGROUP = plugin::GetGroupID();
			my $groupglob = "$GETGROUP$space$groupinst$space$zonesn";
			
			
	if($text=~/Hail/i)
	{
				
			$client->Message(15,"---------- ");
		#Check to see if player has solo instance in current zone	
			if (defined $qglobals{$sologlob})
			{
				$client->Message(15,"$entersolo instance!");
				$client->Message(15,"$deletesolo instance!");
			}
			else
			{
				$client->Message(15,"$createsolo instance!");
			}
			$client->Message(15,"----------");
		#End solo check
		
		#Check if player is in guild otherwise no prompt for guild
		if($uguild_id >=1)
			{
				if (defined $qglobals{$guildglob})
				{
					$client->Message(15,"$enterguild instance!");
					$client->Message(15,"$deleteguild instance!");
				}
				else 
				{
					$client->Message(15,"$createguild instance!");
				}
			}
		#End Guild check
			
			
			$client->Message(15,"----------");   #break
			
		#Check if player is grouped otherwise no prompt
		if ($GETGROUP >= 1)
			{
			if (defined $qglobals{$groupglob})
				{
				$client->Message(15,"$entergroup instance!");
				$client->Message(15,"$deletegroup instance!");
				}
			else
				{
				$client->Message(15,"$creategroup instance!");
				}
			}
		#End Group Check
	}	
		#Start Create
			
			#Create solo start
			if($text=~/Create Solo/i && !defined $qglobals{$sologlob})
			{
			plugin::SendToInstance("solo", "$zonesn", 0, $Cx, $Cy, $Cz, solo, 86400);
			}
			elsif($text=~/Create Solo/i && defined $qglobals{$sologlob})
			{
			$client->Message(15,"You have a solo instance type - $entersolo!");
			}
			#Create solo end
			
			
			#Create group start
			if($text=~/Create Group/i && !defined $qglobals{$groupglob})
			{
				my $isgrouped = $client->GetGroup();
			
				if($isgrouped >= 1) 
					{
						my $groupsid = $isgrouped->GetID();
						plugin::SendToInstance("group", "$zonesn", 0, $Cx, $Cy, $Cz, group, 86400);
					}				
				else
					{
						$client->Message(315,"You must be in a Group to create a Group Instance!");
					}
			}
			elsif($text=~/Create Group/i && defined $qglobals{$groupglob})
			{
			$client->Message(15,"You have a guild instance type - $entergroup!");
			}
			#Create group end
		
			#Create guild start
			if($text=~/Create Guild/i && !defined $qglobals{$guildglob})
				{
				if ($uguild_id >=1)
					{
					plugin::SendToInstance("guild", "$zonesn", 0, $Cx, $Cy, $Cz, guild, 259200);
					}
				else {
				$client->Message(15,"You must be in a guild to create a guild instance!");
					}
				}
			elsif($text=~/Create Guild/i && defined $qglobals{$guildglob})
				{
				$client->Message(15,"You have a guild instance type - $enterguild!");
				}
			#Create guild end
			
		#END CREATE
				
				
		#Start ENTER
			if($text=~/Enter Solo/i && defined $qglobals{$sologlob})
				{
					my $instid = $qglobals->{$sologlob};
					quest::AssignToInstance($instid);
					quest::MovePCInstance($zonesn, $instid, $Cx, $Cy, $Cz); 
				}
			if($text=~/Enter Guild/i && defined $qglobals{$guildglob})
				{
					my $instid = $qglobals->{$guildglob};
					quest::AssignToInstance($instid);
					quest::MovePCInstance($zonesn, $instid, $Cx, $Cy, $Cz);				
				}
			if($text=~/Enter Group/i && defined $qglobals{$groupglob})
				{
					my $instid = $qglobals->{$groupglob};
					quest::AssignToInstance($instid);
					quest::MovePCInstance($zonesn, $instid, $Cx, $Cy, $Cz);				
				}
		#End Enter
		
		
		#Start Delete
			if($text=~/Delete Solo/i && defined $qglobals{$sologlob})
				{
					quest::delglobal($sologlob);
				}
			if($text=~/Delete Group/i && defined $qglobals{$groupglob})
				{
					quest::delglobal($groupglob);
				}
			if($text=~/Delete Guild/i && defined $qglobals{$guildglob})
				{
					quest::delglobal($guildglob);
				}				
		#End Delete
}
Reply With Quote
 


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 08:42 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3