Jump to content

Respawn Delay Edit


xdem

Recommended Posts

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...