Jump to content
  • 0

[HELP]Methods,Work,Create


Question

Posted

i will post it here because in greek section, i dont see any move:(.ok lets start!!!

for example the method:

public void setInvisible()
{
	_invisible = true;
}

for example when we write setInvisible....a player becomes invisble. but how thats happen....since in setInvisible method we dont tell a player to become invisble..i cant undertand...what? _invisible = true; means that a player will be invisible? but where is the "source code" of this? i want for example to make a method setSucker that will do the same work as setInvisible....how will i do it from the begin? i dont know if you catch me...but more generally:

how methods work?

how i create new methods from the beggin?....(like what i said above but from the beggining, )

Plz help ia m very confused

15 answers to this question

Recommended Posts

  • 0
Posted

Hmm, i can understand what you mean. I had the same/almost same "problem". There are other methods, that will make checks if the (boolean) variable _invisible is true(this _invisible is just a variable name, you can name it as sh1t, there won't be a problem, since you rename it to sh1t everywhere else the system calls/checks it), and if it is, make the character invisible(by calling other methods, adding effects/abnormal effects to the character). Don't ask me where are these methods, maybe in the same class as setInvisible() method, or in other skills methods(?). If i find an example i will post it here, so you can understand better. GL.

 

 

Btw if you want to understand a specific code, just tell us which one, so we can be more specific.

  • 0
Posted

For example, i wanna make a method aurasethero() for interlude(dont know if there is already aura hero method) form the beggining. and if there is i dont want to copy anything..just to do it from the begin. and when i call setaurahero the player will take only aura hero.

  • 0
Posted

For example, i wanna make a method aurasethero() for interlude(dont know if there is already aura hero method) form the beggining. and if there is i dont want to copy anything..just to do it from the begin. and when i call setaurahero the player will take only aura hero.

Well look, first of all this exists and has been shared before, but anyway. With hero aura, thinks are a bit more complicated, because it works like an effect(but the character has it always and it doesn't get removed). It's not the best example to do it, but since you picked it i will tell you how. There 2 ways. The simple one:

Index: java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java	(revision 71)
+++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java	(working copy)
@@ -326,7 +326,7 @@

			writeD(_activeChar.getClanCrestLargeId());
			writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
-			writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); // Hero Aura
+			writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ADD YOUR CONDITION HERE);

			writeC(_activeChar.isFishing() ? 1 : 0); //0x01: Fishing Mode (Cant be undone by setting back to 0)
			writeD(_activeChar.getFishx());

Where i say ADD YOUR CONDITION HERE, you should add your condition, when do you want the character to have hero aura. Example:

_activeChar.isNoble(). If you add this after all the other conditions, when the character is noble, he will have hero aura.

You have to do the same here too, so it will be 'seeable' not only by you or only by the others, but and for you and for the others:

Index: java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java	(revision 71)
+++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java	(working copy)
@@ -294,7 +294,7 @@

        writeD(_activeChar.getClanCrestLargeId());
        writeC(_activeChar.isNoble() ? 1 : 0); //0x01: symbol on char menu ctrl+I
-        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); //0x01: Hero Aura
+        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ADD YOUR CONDITION HERE); //0x01: Hero Aura

        writeC(_activeChar.isFishing() ? 1 : 0); //Fishing Mode
        writeD(_activeChar.getFishx()); //fishing x

 

Now the more tricky way(i will just post you the link of the shared one, because the more complicated way is not created by me): http://maxcheaters.com/forum/index.php?topic=34044.0 . Just check the code in L2PcInstance. Also i forgot to mention that it's not possible(if i have understood well) to create 1 seperate method for hero aura, you need more than 1. GL.

 

But if you are newbie dev, i suggest you work on pvp custom stuff, they are really easy. That's where i started too. For example try to think of an existing/new idea, simple not complicated, and try to make it true. Try to rework stuff as pvp color system, killing spree, make them better for admins and for users, with more configs, use FastLists(more difficult) to create 'array' configs(ex. Reward: 57,1;3470,5) etc. GL.

  • 0
Posted

maybe can u ...find a good method to create for starting and explain me? as you said,yes it is complicated

Sorry i modified my post after my reply, check the last part:

But if you are newbie dev, i suggest you work on pvp custom stuff, they are really easy. That's where i started too. For example try to think of an existing/new idea, simple not complicated, and try to make it true. Try to rework stuff as pvp color system, killing spree, make them better for admins and for users, with more configs, use FastLists(more difficult) to create 'array' configs(ex. Reward: 57,1;3470,5) etc. GL.

 

  • 0
Posted

Sorry i modified my post after my reply, check the last part:

yes i catch it ...actually i know to make that but i have months to work with them.At this time i need to understand the methods (i have looked too many guides but nothing,still not all .) ....for example lets see maybe ....hmm create a method named: setpvps(int x, int y)/ that will set pvps for x value and pks for y value..can u explain ? how will create that/ in which java file..e.g?
  • 0
Posted

Hmm, not difficult. You can make it anywhere you like, this is not the point, you can make a different class too with it. But in L2PcInstance it should be more easy. Look:

public void setPvpPkKills(int x, int y)
{
	setPvpKills(x); // Set the pvp kills of the character to x.
	setPkKills(y); // Set the pk kills of the character to y.

	sendPacket(new UserInfo(this)); // Just make the changes 'seeable' to the user.
}

 

This is our method. If you want to call it, do it like that:

setPvpPkKills(500, 1500);

This will set the pvp kills of the character to 500, and the pk kills to 1500. If you want it more complicated, i will show you a method, that will set the pvp kills of the character to current pvp kills + x and current pk kills + y:

public void setPvpPkKills(int x, int y)
{
	setPvpKills(getPvpKills() + x); // Set the pvp kills of the character to current + x.
	setPkKills(getPkKills() + y); // Set the pk kills of the character to current + y..

	sendPacket(new UserInfo(this)); // Just make the changes 'seeable' to the user.
}

  • 0
Posted

Hmm, not difficult. You can make it anywhere you like, this is not the point, you can make a different class too with it. But in L2PcInstance it should be more easy. Look:

public void setPvpPkKills(int x, int y)
{
	setPvpKills(x); // Set the pvp kills of the character to x.
	setPkKills(y); // Set the pk kills of the character to y.

	sendPacket(new UserInfo(this)); // Just make the changes 'seeable' to the user.
}

 

This is our method. If you want to call it, do it like that:

setPvpPkKills(500, 1500);

This will set the pvp kills of the character to 500, and the pk kills to 1500. If you want it more complicated, i will show you a method, that will set the pvp kills of the character to current pvp kills + x and current pk kills + y:

public void setPvpPkKills(int x, int y)
{
	setPvpKills(getPvpKills() + x); // Set the pvp kills of the character to current + x.
	setPkKills(getPkKills() + y); // Set the pk kills of the character to current + y..

	sendPacket(new UserInfo(this)); // Just make the changes 'seeable' to the user.
}

and then...how can i use it ...for example to tell if a character is hero to call this method(example) ....when he logs? we defined this method in L2PcInstance,how will we use it in other java file like enterworld?

 

if (activeChar.isHero())

{

setpvppkkills(2,3);

}

 

but setpvpkills(); will not be found right? because it is in other java file...so how will do it?

L2PcInstance.setpvppkkills(); .? or how?:P

  • 0
Posted

:), first of all i have to tell you that activeChar is an object of L2PcInstance. That means that you can call ANY public method/variable from L2PcInstance. Here is how you use it in EnterWorld.java:

	if (activeChar.isHero())
	{
		activeChar.setPvpPkKills(500, 1500);
	}

 

Just add it after:

	L2PcInstance activeChar = getClient().getActiveChar();

 

You have to understand objects so you can understand methods dude....

 

Also another note, not only for you, activeChar, is sth the creator of EnterWorld.java chose, you can name it as you want, even gayChar, or stupid.

Just change this:

L2PcInstance activeChar = getClient().getActiveChar();

To:

L2PcInstance HEREWHATYOUWANT = getClient().getActiveChar();

  • 0
Posted

:), first of all i have to tell you that activeChar is an object of L2PcInstance. That means that you can call ANY public method/variable from L2PcInstance. Here is how you use it in EnterWorld.java:

	if (activeChar.isHero())
	{
		activeChar.setPvpPkKills(500, 1500);
	}

 

Just add it after:

	L2PcInstance activeChar = getClient().getActiveChar();

 

You have to understand objects so you can understand methods dude....

yeap man i know what are they...ok you have right :P. and something else where you find ready methods?

like setPvpKills() above? and for example how exactly do you understand what ready methods do? there are some that are not understoond when you read the name, but where is thei source code? :D

  • 0
Posted

setPvpKills() method is in L2PcInstance. Hmm, if you want to find a method's source, you must search first of all in the class that you call the method(only if you have not created an object of another class and call it lol :P). If it is not in this class, search in it's superclass. You can locate the superclass here:

Ex:

public final class L2PcInstance extends L2Playable

In this case, L2Playable is the superclass of L2PcInstance, so you search in L2Playable. If it is not there too, search in L2Playable's superclass, in this case L2Character.java and keep going.

 

For example in EnterWorld.java, you call methods from L2PcInstance, with activeChar object. So you go search in L2PcInstance for their source. If it's not there, you go in L2PcInstance's superclass and keep going ;).

 

I hope i helped...

  • 0
Posted

setPvpKills() method is in L2PcInstance. Hmm, if you want to find a method's source, you must search first of all in the class that you call the method(only if you have not created an object of another class and call it lol :P). If it is not in this class, search in it's superclass. You can locate the superclass here:

Ex:

public final class L2PcInstance extends L2Playable

In this case, L2Playable is the superclass of L2PcInstance, so you search in L2Playable. If it is not there too, search in L2Playable's superclass, in this case L2Character.java and keep going.

 

For example in EnterWorld.java, you call methods from L2PcInstance, with activeChar object. So you go search in L2PcInstance for their source. If it's not there, you go in L2PcInstance's superclass and keep going ;).

 

I hope i helped...

well actually i hear 1st time the word superclass :P ....and superclass is the : extends Here name class? for example:

public final class L2PcInstance extends L2PlayableInstance

the superclass is L2PlayableInstance.?

  • 0
Posted

well actually i hear 1st time the word superclass :P ....and superclass is the : extends Here name class? for example:

public final class L2PcInstance extends L2PlayableInstance

the superclass is L2PlayableInstance.?

Yes.

[GR]superclass sta elinika einai iperklasi[/GR]

 

Also if L2PlayerInstance is L2PcInstance's superclass, L2PcInstance is a subclass of L2PlayableInstance :D

 

A class can only have 1 superclass (in java, because in c++ it can have more).

  • 0
Posted

Yes.

[GR]superclass sta elinika einai iperklasi[/GR]

 

Also if L2PlayerInstance is L2PcInstance's superclass, L2PcInstance is a subclass of L2PlayableInstance :D

 

A class can only have 1 superclass (in java, because in c++ it can have more).

ok ...Dont lock it any moderator :P i will post again here for soor xd.

 

[GR]Enow exw akousei tin leksi auti 1i fora stin java oxi sti zwi m :p[/gr]

  • 0
Posted

ok ...Dont lock it any moderator :P i will post again here for soor xd.

 

[GR]Enow exw akousei tin leksi auti 1i fora stin java oxi sti zwi m :p[/gr]

[GR]To katalaba lol :P[/GR]

Good luck again.

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
Answer this question...

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