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 06-15-2013, 12:52 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 516
Default

Fixed heh
Code:
sub EVENT_ENTERZONE {
	quest::setglobal("PvPState",$client->GetPVP(),5,"F");  #Adds their PVPstate to gloabl
	$client->SetPVP(1);
}

sub EVENT_ZONE {
	if(defined $qglobals{"PvPState"} && $qglobals{"PvPState"}==1)   
	{
		$client->SetPVP(1);   #Player was already PVP before entering zone will remain PVP on zone out
	}
	else
	{
		$client->SetPVP(0);  #This player was not PVP flagged when zoning in
	}

}


Here is the code I use for a PVP zone...

Limits the zone to a single character in the zone per IP

Requires that the zone is STATIC though

Code:
sub EVENT_ENTERZONE {
	my $playerip = $client->GetIP();
	@pvplist;
	if ( grep { $_ eq $playerip } @pvplist )
	{
		
		$client->Message(315,"YOU MAY ONLY HAVE ONE CHARACTER IN THIS ZONE!");
		push(@pvplist, "$playerip");
		$client->MovePC(348, 1.8, 1.6, -22.8, 187);
		return;
	}
	push(@pvplist, "$playerip");
	$client->SetPVP(1);
}

sub EVENT_ZONE {
	my $playerip = $client->GetIP();
	my $count = 0;
	foreach $pvp_player (@pvplist) 
	{
	next unless $pvp_player = $playerip;
	$count++;
	}

	if ($count >= 2)
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
		push(@pvplist, "$playerip");  #Add the IP back to list since there are 2 of the same IP
	}
	else
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
	}
	$client->SetPVP(0);
}

sub EVENT_DISCONNECT {
	my $playerip = $client->GetIP();
	my $count = 0;
	foreach $pvp_player (@pvplist) 
	{
	next unless $pvp_player = $playerip;
	$count++;
	}

	if ($count >= 2)
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
		push(@pvplist, "$playerip");  #Add the IP back to list since there are 2 of the same IP
	}
	else
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
	}
}
Reply With Quote
  #2  
Old 06-15-2013, 01:09 AM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Thank you for the input. I'm needing the player to return to the pvp state (derp just saw YOUR edit after my extensive editing lol) they were before they entered the contested zone. To paint the picture. I am having mischief be a pvp zone. upon entering you are forced pvp. now when you leave the zone I need it to return the player to their previous pvpstate, so if they were 0 then make them 0 but if they were state 1, leave them pvp. I was trying todo it in the player.pl in folder mischiefplane but due to not being able to share the global from EVENT ENTERZONE to EVENT ZONE, I believe it needs to be handled in global_player.

this is the current run after a few hours. it still doesn't initialize lol.
Oh c0ncrete I came across a post about perl -c filename.pl love it!

Code:
sub EVENT_ENTERZONE {

if(!defined $qglobals{PvPState}) {

if($client->GetPVP() == 1) {
quest::setglobal("PvPState", $PvP, 4, "F");
$client->Message(15, "pvp saved!");

	if($zonesn =~ /^mischiefplane$/) {
	$client->SetPVP(1);
	$client->Message(15, "It's time for some Mischief, kill or be killed");
	}

	elsif ($PvP == $client->GetPVP(1)) {
	$client->SetPVP(1);
	$client->Message(15, "pvp on!");
	}
	else {
	$client->SetPVP(0);
	$client->Message(15, "pvp off!");
	}

}

}

}
__________________
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:39 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 - 2026, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3