Jump to content

Recommended Posts

Posted

Hi, a while ago I made a mini code, which will reduce or increase NPC respawn delay according to how many players are online, for example if the people online in a server is too high we want farming to be fair for all the a-beep-t of players... Also if the server has low population that momment the respawn will get increased cause farm that momment is too op for those players... If you didnt understand just read the code its so simple.

 

find: Gameserver/model/L2Spawn.java and add

		//ClientScheduler.getInstance().scheduleLow(new SpawnTask(npcId), _respawnDelay);
+			int count=L2World.getInstance().getAllPlayersCount();
+			if (count<=100)
+				_respawnDelay*=1.15;//+15% re-spawn delay
+			else if (count<=250)
+				_respawnDelay*=1;//actual re-spawn delay
+			else if (count<=400)
+				_respawnDelay*=0.90;//-10% re-spawn delay
+			else if (count<=600)
+				_respawnDelay*=0.80;//-20% re-spawn delay
+		
		ThreadPoolManager.getInstance().scheduleGeneral(new SpawnTask(oldNpc), _respawnDelay);
	}

 

Additionally if you want to add some additional respawn which will be random to confuse campers/bots etc, you can add:

+				_respawnDelay+=Rnd.get(0, 10);//adds an aditional 0-10 seconds respawn delay
+
		ThreadPoolManager.getInstance().scheduleGeneral(new SpawnTask(oldNpc), _respawnDelay);
	}

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock