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
  #4  
Old 09-07-2010, 01:53 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by thepoetwarrior View Post
I haven't talked to you in a while, plus figured I'd see what everyone thought about the instance thing, multiple opinions.

Half the code was from example that Trevius posted here, and half from your example as well.

Do these zones take up a dynamic zone? Users complaining they can't enter a new zone that isn't already booted.
Yes, they take up a dynamic. Here is the script you are looking for, I haven't tested it but it should do what you want it to do. I cleaned up some parts of it and also added the ability to use the Waypoint credit system that I made for you as well, but not add to the NPC for credits.

You also were using objects that you made that were conflicting with the perl objects in the source. I made this just as flexible as you desired it to be before, and the qglobals and instances should not expire... Period.

You should be able to see the instances in your qglobals table up after they become populated by players, and will never go away unless you manually deleted them yourself. The qglobals get created and read by everyone for Instance 1 and 2 for all players.

Code:
sub EVENT_SAY {
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
	my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
	my $Waypoint1Inst = quest::saylink("Waypoint Credit Instance 1", 1);
	my $Waypoint2Inst = quest::saylink("Waypoint Credit Instance 2", 1);
	my $ExitInst = quest::saylink("Exit Instance", 1);
	my $accountname1 = $client->AccountName();
	my $accountname = "<c \"#FBB117\">$accountname1</c>";
	my $accountid = $client->AccountID();
	my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
    if ($text =~/hail/i) 
		{
			$client->Message(315, "$npc_name says, 'Please make a choice:'");
			$client->Message(315, "..::[LDON Instance: $zonln]::..");
			$client->Message(315, "[$Enter1Inst]");
			$client->Message(315, "[$Enter2Inst]");
			$client->Message(315, "[$ExitInst]");
			
		} # End hail
	if ($text =~/Enter Instance 1/i) 
		{
			$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter $zonesn Instance Version (1)'");
			$client->Message(315, "Or enter with [$Waypoint1Inst]");
		} 	# End Instance 1
	if ($text =~/Enter Instance 2/i) 
		{
			$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter $zonesn Instance Version (2)'");
			$client->Message(315, "Or enter with [$Waypoint2Inst]");
		} 	# End Instance 2
	if ($text =~ /^Exit Instance$/i)
		{
			$client->Message(315, " " );
			$client->Message(315, "Moving player $name to a non-instance version of $zoneln.");
			quest::movepc($zoneid, $Cx, $Cy, $Cz); 
		}	
	if ($text =~ /Waypoint Credit Instance 1/i){
		my $InstanceCost = 1000; ###1,000 Entry Fee
					if ($bankcredit < $InstanceCost)
						{
							$client->Message(315,"You need "
								. ($InstanceCost - $bankcredit) . " more plat!");
						}
						else {
							$bankcredit -= $InstanceCost;
							quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
							my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
							$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
							$timestamp = localtime(time);
							my $npc_name = $npc->GetCleanName(); 
							my $accountname1 = $client->AccountName();
							quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
							$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
							if (defined($qglobals{"Inst1$zonesn"}))
								{
									my $instance_1 = $qglobals{"Inst1$zonesn"};
									quest::AssignToInstance($instance_1);
									quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
								}
							else
								{
									$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
									my $instanceID = quest::CreateInstance("$zonesn", 0, 0);
									quest::AssignToInstance($instanceID); 
									quest::setglobal("Inst1$zonesn",$instanceID, 7, 0);
									quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
								}
							}		
				}
				if ($text =~ /Waypoint Credit Instance 2/i){
					my $InstanceCost = 2000; ###2,000 Entry Fee
					if ($bankcredit < $InstanceCost)
						{
							$client->Message(315,"You need "
								. ($InstanceCost - $bankcredit) . " more plat!");
						}
						else {
							$bankcredit -= $InstanceCost;
							quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
							my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
							$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
							$timestamp = localtime(time);
							my $npc_name = $npc->GetCleanName(); 
							my $accountname1 = $client->AccountName();
							quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
							$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
							if (defined($qglobals{"Inst2$zonesn"}))
								{
									my $instance_2 = $qglobals{"Inst2$zonesn"};
									quest::AssignToInstance($instance_2);
									quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
								}
							else
								{
									$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
									my $instanceID = quest::CreateInstance("Inst2$zonesn", 0, 0);
									quest::AssignToInstance($instanceID); 
									quest::setglobal("Inst2$zonesn", $instanceID, 7, 0);
									quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
									$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
								}
							}		
				}
}



sub EVENT_ITEM
{
	my $Cx = $client->GetX();
	my $Cy = $client->GetY();
	my $Cz = $client->GetZ();
	my $npc_name = $npc->GetCleanName();
	if ($platinum == 1000) # IF 1k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
		
			if (defined($qglobals{"Inst1$zonesn"}))
			{
				my $instance_1 = $qglobals{"Inst1$zonesn"};
				quest::AssignToInstance($instance_1);
				quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
				my $instanceID = quest::CreateInstance("$zonesn", 0, 0);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("Inst1$zonesn",$instanceID, 7, 0);
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
			}
		} # End plat > 1000
		
	elsif ($platinum == 2000) # IF 2k+ plat for instance 2
		{
			$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
		
			if (defined($qglobals{"Inst2$zonesn"}))
			{
				my $instance_2 = $qglobals{"Inst2$zonesn"};
				quest::AssignToInstance($instance_2);
				quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
			}
			else
			{
				$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
				my $instanceID = quest::CreateInstance("Inst2$zonesn", 0, 0);
				quest::AssignToInstance($instanceID); 
				quest::setglobal("Inst2$zonesn", $instanceID, 7, 0);
				quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
				$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
			}
		} # End plat > 2000		

	else # If not enough plat, return everything.
		{
			plugin::return_items(\%itemcount);
    	}		
		
} # End sub EVENT_ITEM
Here's this too lol
Code:
UPDATE `items` SET `idfile` = 'IT166', `icon` = `588` WHERE NAME LIKE '%Sword of the Eternal Power Epic 4.0%';
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 07:01 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