View Single Post
  #17  
Old 05-09-2011, 09:48 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 965
Default

Thanks for all your help. I learned some good information about the quest process here.

Here is the final solution I posted over on the PEQ forums.
bothunder/player.pl
Code:
sub EVENT_CLICKDOOR {
  if ($status < 80) { # make sure not to excute if it is a GM clicking
    my $count;
    my $raid; 
    my $group;
    if($doorid == 51) { #Agnarr Tower
      if(plugin::check_hasitem($client, 9433) || $client->KeyRingCheck(9433)) { #Symbol of Torden
	    if (!$client->KeyRingCheck(9433)) {
	      $client->KeyRingAdd(9433);
        }
        $raid = $entity_list->GetRaidByClient($client);
        $group = $entity_list->GetGroupByClient($client);
	    if ($raid) {
          for ($count = 0; $count < $raid->RaidCount(); $count++) {
            if ($client->GetName() ne $raid->GetMember($count)->GetName()) {
              $pc = $raid->GetMember($count);
			  if ($pc->CalculateDistance(170.329,11.3461,-647.998) <= 100) { # only move players within 100 units of door
                $pc->MovePC(209,-765,-1735,1270,128);
              }
            }
          }
        }
	    elsif ($group) {
          for ($count = 0; $count < $group->GroupCount(); $count++) {
            if ($client->GetName() ne $group->GetMember($count)->GetName()) {
              $pc = $group->GetMember($count);
			  if ($pc->CalculateDistance(170.329,11.3461,-647.998) <= 100) { # only move players within 100 units of door
                $pc->MovePC(209,-765,-1735,1270,128);
              }
            }
          }
	    }
      }
      else { #Send gargoyles to attack
        my @npc_list = $entity_list->GetNPCList();
        foreach $npc (@npc_list) {
          if($npc->GetNPCTypeID() == 209024 & $npc->CalculateDistance(170.329,11.3461,-647.998) <= 100) { # only send in the 4 close gargoyles
            $npc->AddToHateList($client, 1);
          }
        }
      }
    } #end of agnarr tower

    if($doorid == 61 || $doorid == 63 || $doorid == 65 || $doorid == 67) { #Tower Doors
      if(plugin::check_hasitem($client, 9425) || $client->KeyRingCheck(9425)) { #Symbol of Torden
	    if (!$client->KeyRingCheck(9425)) {
	      $client->KeyRingAdd(9425);
        }
        $raid = $entity_list->GetRaidByClient($client);
        $group = $entity_list->GetGroupByClient($client);
	    if ($raid) {
          for ($count = 0; $count < $raid->RaidCount(); $count++) {
            #do not port the cliker or someone not in the clicker's raid group.
            if ($client->GetName() ne $raid->GetMember($count)->GetName() && $raid->GetGroup($client->GetName()) == $raid->GetGroup($raid->GetMember($count)->GetName())) {
              $pc = $raid->GetMember($count);
              if ($doorid == 61 && $pc->CalculateDistance(-169.512,-384.93,-639.696) <= 50) { # SE Tower only move players within 50 units of door
                $pc->MovePC(209,85,145,635,128);
              }
              elsif ($doorid == 63 && $pc->CalculateDistance(562.407,-331.488,-639.291) <= 50) { # SW Tower only move players within 50 units of door
                $pc->MovePC(209,-830,-865,1375,128);
              }
              elsif ($doorid == 65 && $pc->CalculateDistance(501.435,417.583,-638.755) <= 50) { # NW Tower only move players within 50 units of door
                $pc->MovePC(209,-350,-2200,-1955,0);
              }
              elsif ($doorid == 67 && $pc->CalculateDistance(-230.36,355.3,-638.154) <= 50) { # NE Tower only move players within 50 units of door
                $pc->MovePC(209,150,-1220,1120,128);
              }
            }
          }
        }
	    elsif ($group) {
          for ($count = 0; $count < $group->GroupCount(); $count++) {
            #do not port the cliker
            if ($client->GetName() ne $group->GetMember($count)->GetName()) {
              $pc = $group->GetMember($count);
              if ($doorid == 61 && $pc->CalculateDistance(-169.512,-384.93,-639.696) <= 50) { # SE Tower only move players within 50 units of door
                $pc->MovePC(209,85,145,635,128);
              }
              elsif ($doorid == 63 && $pc->CalculateDistance(562.407,-331.488,-639.291) <= 50) { # SW Tower only move players within 50 units of door
                $pc->MovePC(209,-830,-865,1375,128);
              }
              elsif ($doorid == 65 && $pc->CalculateDistance(501.435,417.583,-638.755) <= 50) { # NW Tower only move players within 50 units of door
                $pc->MovePC(209,-350,-2200,-1955,0);
              }
              elsif ($doorid == 67 && $pc->CalculateDistance(-230.36,355.3,-638.154) <= 50) { # NE Tower only move players within 50 units of door
                $pc->MovePC(209,150,-1220,1120,128);
              }
            }
          }
        }
      }
      else { #Send gargoyles to attack
        my @npc_list = $entity_list->GetNPCList();
        foreach $npc (@npc_list) {
          if ($doorid == 61) {
            if($npc->GetNPCTypeID() == 209024 & $npc->CalculateDistance(-169.512,-384.93,-639.696) <= 150) { # only send in the 2 close gargoyles
              $npc->AddToHateList($client, 1);
            }
          }
          elsif ($doorid == 63) {
            if($npc->GetNPCTypeID() == 209024 & $npc->CalculateDistance(562.407,-331.488,-639.291) <= 150) { # only send in the 2 close gargoyles
              $npc->AddToHateList($client, 1);
            }
          }
          elsif ($doorid == 65) {
            if($npc->GetNPCTypeID() == 209024 & $npc->CalculateDistance(501.435,417.583,-638.755) <= 150) { # only send in the 2 close gargoyles
              $npc->AddToHateList($client, 1);
            }
          }
          elsif ($doorid == 67) {
            if($npc->GetNPCTypeID() == 209024 & $npc->CalculateDistance(-230.36,355.3,-638.154) <= 150) { # only send in the 2 close gargoyles
              $npc->AddToHateList($client, 1);
            }
          }
        }
      }
    } #end 4 Towers
  } #end GM check
}
Reply With Quote