View Single Post
  #2  
Old 01-14-2009, 05:58 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

The only way I have found to be able to check all clients in the zone is using a script that checks all entities in the whole zone and checks if they are clients or not. The custom script I posted for my Thanksgiving event would work just fine for this if you can figure out how to use it. Here is a quick edit that would find each client:

Code:
sub EVENT_SPAWN {

  quest::settimer("runaway",5);

}


sub EVENT_TIMER {

  if ($timer eq "runaway") {
    quest::stoptimer("runaway");
        
    my $list_check = 0;

    #Variable to check if more than 1 player is in zone
    my $multiple_clients = undef;

    #You may need to increase 2000 below if you have alot of mobs in the zone
    for ($list_check = 0; $list_check < 2000; $list_check++) { 

      $client_search = $entity_list->GetClientByID($list_check);
     
      if ($client_search) {
#        quest::say("I found client $client_search");
          $multiple_clients = $multiple_clients + 1;

            if($multiple_clients <= 6) { #Full group or less in the zone
               quest::settimer("runaway",60); #run this check every minute
            }

            if($multiple_clients > 6) { #more than a full group
              #Run this check every 5 seconds until someone is picked
               
              my $clientpick = quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10);
              if($clientpick == 1) { #we got a winner!
                quest::settimer("runaway",60);
                $client->MoveGroup(152,0,0,-31)
              }
              if($clientpick > 1) {
                #More than 6 players are in zone.  Need to keep running this check until a player is picked and removed
                quest::settimer("runaway",5);
              }
            }

      }
    }

  }
}
I haven't tested this yet, but it should be close to something that would do what you are wanting to do.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote