View Single Post
  #1  
Old 02-23-2018, 04:36 PM
Aardil
Fire Beetle
 
Join Date: Jan 2018
Location: Mississippi
Posts: 27
Default Player.pl question

I an working on an event that covers several zones.
I am using Player.pl to detect the player level.

Through signals (determined by the player level)
A signal is sent to a zone controller.

Zone controller depops a few NPC's and spawns NPC's of the correct level.

All the above works as it should.

Now he question.

Since this happens in several zones, I am unsure of what to do with the player .pl

Should I take all signals from every zone and place them all in a single player.pl? ( it would end up being about 5000 lines of code ( 100 lines of code per zone and there are 50 effected zones).

If it all needs to go in one player.pl is there a way to sub devide the code by zone so it wont be looking through 5000 lines to find a match?
Maybe something like this?
Code:
sub EVENT_ZONE {
  if(zonen == "butcher"){
     if($ulevel <= 5 && $ulevel >= 1) {
    quest::signalwith(51,22,0);
	quest::signalwith(51,12,10);
	}
	elsif($ulevel <= 10 && $ulevel >= 6) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,13,10);
	}
	elsif($ulevel <= 15 && $ulevel >= 11) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,14,10);
	}
	elsif($ulevel <= 20 && $ulevel >= 16) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,15,10);
	}
	elsif($ulevel <= 25 && $ulevel >= 21) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,16,10);
	}
	elsif($ulevel <= 30 && $ulevel >= 26) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,17,10);
	}
	elsif($ulevel <= 35 && $ulevel >= 31) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,18,10);
	}
	elsif($ulevel <= 40 && $ulevel >= 36) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,19,10);
	}
	elsif($ulevel <= 45 && $ulevel >= 41) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,20,10);
	}
	elsif($ulevel <= 49 && $ulevel >= 46) {
	quest::signalwith(51,22,0);
	quest::signalwith(51,21,10);
	}
	else {
	quest::signalwith(50,22,0);
	}
	}
	}
The above code is not tested as written. It does what it should without the
if (zonen == "butcher") { line

Or can each zone have a specific player.pl that only effects that zone?
Reply With Quote