Jump to content

Dimensions System


Pauler

Recommended Posts

Hello there, this is the latest feature I coded for my open source project and it will be implemented, soon after some additions. This system, which is really close to the instance system in the newer chronicles, allows to spawn npc at different dimensions and travel there. This allows you to host multiple events at the same place at the same time, host multiple farm/pvp areas at the same place at the same time, and much more. Players and mobs cannot see another players and another mobs who exist at a different dimension.I am going to do some more modifications before I commit it. Here, you can leach an early version of it.

 

 

Here, you can find the diff patch for l2jpes and the modified .sql:

http://pastebin.com/TxGmtJUn

http://www.4shared.com/document/gobiNCor/spawnlist.html?

 

For those who are going to test this on a live server and they already have spawnlist installed, run this at your mysql command line:

alter table `spawnlist` add column `dimensionid` int(3) NOT NULL DEFAULT '1' ; 

 

It is pretty similar with http://maxcheaters.com/forum/index.php?topic=279639.0.

 

Regards.

Link to comment
Share on other sites

To spawn ingame a monster to a specific dimension just go to the dimension and use //spawn normally.

 

To spawn a monster in the coding part just set the selected dimension id to the l2spawn object.

Link to comment
Share on other sites

+       private static void changeDimension(L2PlayerInstance player, int dimensionId) {
+               player.setDimensionId(dimensionId);
+              
+               for (L2Object object:L2World.getInstance().getAllVisibleObjects().values()) {
+                       if (object.getDimensionId() == player.getDimensionId()) {
+                               if (!player.getKnownList().knowsObject(object) && player.getKnownList().getDistanceToWatchObject(object) < 1800)
+                                       player.getKnownList().addKnownObject(object);
+                              
+                               if (!object.getKnownList().knowsObject(player) && object.getKnownList().getDistanceToWatchObject(player) < 1800)
+                                       object.getKnownList().addKnownObject(player);
+                       }else{
+                               if (player.getKnownList().knowsObject(object))
+                                       player.getKnownList().removeKnownObject(object);
+                              
+                               if (object.getKnownList().knowsObject(player))
+                                       object.getKnownList().removeKnownObject(player);
+                       }      
+               }

 

or just:

 

 

at L2Character:

@Override
public void setInstanceId(int i)
{
	super.setInstanceId(i);
	teleToLocation(getX(), getY(), getZ(), 1);
}

 

Your code is bugged, too bad of you...

 

where are the skill checks, TARGET_PARTY etc, they need instanceId check too.

 

btw check the Action.java clientpacket, it will be buggy if you dont add:

	if (obj.getInstanceId() != activeChar.getInstanceId())
	{
		activeChar.sendPacket(ActionFailed.STATIC_PACKET);
		return;
	}

 

to avoid some bugs, like Itention.FOLLOW from an object of different instance...

 

Just add the checks you miss many

Link to comment
Share on other sites

+       private static void changeDimension(L2PlayerInstance player, int dimensionId) {
+               player.setDimensionId(dimensionId);
+              
+               for (L2Object object:L2World.getInstance().getAllVisibleObjects().values()) {
+                       if (object.getDimensionId() == player.getDimensionId()) {
+                               if (!player.getKnownList().knowsObject(object) && player.getKnownList().getDistanceToWatchObject(object) < 1800)
+                                       player.getKnownList().addKnownObject(object);
+                              
+                               if (!object.getKnownList().knowsObject(player) && object.getKnownList().getDistanceToWatchObject(player) < 1800)
+                                       object.getKnownList().addKnownObject(player);
+                       }else{
+                               if (player.getKnownList().knowsObject(object))
+                                       player.getKnownList().removeKnownObject(object);
+                              
+                               if (object.getKnownList().knowsObject(player))
+                                       object.getKnownList().removeKnownObject(player);
+                       }      
+               }

 

or just:

 

 

at L2Character:

@Override
public void setInstanceId(int i)
{
	super.setInstanceId(i);
	teleToLocation(getX(), getY(), getZ(), 1);
}

 

lol what?

 

Instance system is not implemented in interlude by default, where did you find setInstance?

 

About the other checks you are right, anyway it is an early version, that's why I haven't implement it yet.

Link to comment
Share on other sites

setInstance = setDimension just the name changes, when I made this about some months ago I named it instance cause it was instance, so thats why you see instance, but does it really matter ? its the same thing, you update the KnowList manually (the dump way) and I did it with teleport which is the ideal for the specific work

Link to comment
Share on other sites

setInstance = setDimension just the name changes, when I made this about some months ago I named it instance cause it was instance, so thats why you see instance, but does it really matter ? its the same thing, you update the KnowList manually (the dump way) and I did it with teleport which is the ideal for the specific work

 

In your code you use setinstance to change the player's instance, and then you reteleported him to the same position. Good, but how you tell the code that hey he has different instance id from the others, let's remove him from their knownlists.

 

In your code, teletolocation may need modification or else the instance id won't matter.

Link to comment
Share on other sites

In your code you use setinstance to change the player's instance, and then you reteleported him to the same position. Good, but how you tell the code that hey he has different instance id from the others, let's remove him from their knownlists.

 

In your code, teletolocation may need modification or else the instance id won't matter.

 

teleport not only revalidates, it updates KnowList too, lol. And since you re-update the instance there is where the check comes

 

updateKnowList()

if (obj1.dimensionId != obj2.dimensionId)

        continue;

 

this runs during the teleport KnowList update

Link to comment
Share on other sites

teleport not only revalidates, it updates KnowList too, lol

It does but in the terms of distance, visibility, etc not by instance id. You have to add the specific criteria by yourself to make it edit the knownlist by the instance id, too.

 

Who cares by the end, of the day, I am already working on the checks and a window to manage the dimensions.

Link to comment
Share on other sites

So, the second version is out.

  • Added missing checks. (ty xdem for mentioning)
  • Added a window where you can manage* the dimensions.
  • Added config to set max available dimensions.

 

*You can only check how many object each dimension includes.

 

Some checks are propably still missing, I will have one more look before commiting it.

Link to comment
Share on other sites

Update to Freya/h5?

Lol... instances already exist in freya/h5... try reading...

 

This system, which is really close to the instance system in the newer chronicles,

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...