Jump to content
  • 0

[HELP]Methods,Work,Create


Azumaril$

Question

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

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

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.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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.

 

Link to comment
Share on other sites

  • 0

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

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

:), 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();

Link to comment
Share on other sites

  • 0

:), 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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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]

Link to comment
Share on other sites

  • 0

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.

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



  • Posts

    • Good afternoon everyone, we’ll get a couple of strong players in the CP, more details can be found here https://mw2.community/topic/211276-awr-team/  
    • so i bought this crap of the server few years back and i just found it laying around on my pc and i thought i should share it, if i remember correctly this crap has a lot of bugs that people abuse 🙂   https://drive.google.com/file/d/13QWg8pi4BPbGbTmlygZ078LjL6Fb0J2a/view?usp=sharing source   https://drive.google.com/file/d/13QWg8pi4BPbGbTmlygZ078LjL6Fb0J2a/view?usp=sharing system    
    • Error: Unable to access jarfile libs\Geodata_Converter_v01.jar
    • Since last massive leak as explained as 07/09 (notably all development branches), I don't accept anymore financial newcomers that easily. People will have to contribute 100 cookies worth of contributions (bug reports/fixes) as a first step to be accepted as Donator. Free user can join after sharing over 200 cookies out of contributions, compared to 100 cookies before. You can say thanks to RusAcis, and notably his worthless leader, UnleashedForce. The size of users will continue to shrink if more leaks occur, until true helpers only will be left. New prices are as following : Joining price: 200€ + 100 cookies, or 200 cookies This fee has to be paid if you are joining aCis project. Next month, and all other months, you will have to donate only basic monthly donation. Monthly price: 10€ / 10 cookies This fee has to be paid every month. I won't accept any new join fee before the 100 cookies contribution. Your money will be instantly sent back. Also, in the same shape of idea, actual supporters/donators have to be active to stay in sources. It doesn't have to be a particular amount, you just have to share from time to time *anything*. I don't accept anymore silent ppl. Only useful people will be kept.
    • @Kenrix Hello. my friend bought from you the panel and he told me that he haven't recieved yet his product whats going on?.
  • Topics

×
×
  • Create New...