Jump to content
  • 0

Some Java Help


Rio

Question

I want to add this code: http://www.maxcheaters.com/topic/49498-sharehero-reward-for-pvps/?hl=%2Bhero+%2Breward+%2Bpvps

Its about giving hero at x pvp's.
 

+public void increasePvpKills(L2PcInstance activeChar)

+if (activeChar.getPvpKills() >= 5000)
        {
       activeChar.sendMessage ("Congratz , you are now a hero ");
        activeChar.setHero(true);
        }

I wonder if there is a way of keeping 

- public void increasePvpKills()

beacause when i change the public void to

public void increasePvpKills(L2PcInstance activeChar) 

  i get erros in some other codes.

Link to comment
Share on other sites

Recommended Posts

  • 0

I want to add this code: http://www.maxcheaters.com/topic/49498-sharehero-reward-for-pvps/?hl=%2Bhero+%2Breward+%2Bpvps

 

Its about giving hero at x pvp's.

 

+public void increasePvpKills(L2PcInstance activeChar)

+if (activeChar.getPvpKills() >= 5000)
        {
       activeChar.sendMessage ("Congratz , you are now a hero ");
        activeChar.setHero(true);
        }

I wonder if there is a way of keeping 

- public void increasePvpKills()

beacause when i change the public void to

public void increasePvpKills(L2PcInstance activeChar) 

  i get erros in some other codes.

bad code but... ok 

 

 

increasePvpKills(L2PcInstance activeChar

 

if (activeChar.getPvpKills() >= 5000)

{

activeChar.sendMessage ("Congratz , you are now a hero ");

activeChar.setHero(true);

}

remove red letters  no need since we are already inside L2PcInstance class.

Edited by AbSoLuTePoWeR
Link to comment
Share on other sites

  • 0

bad code but... ok 

 

 

increasePvpKills(L2PcInstance activeChar

 

if (activeChar.getPvpKills() >= 5000)

{

activeChar.sendMessage ("Congratz , you are now a hero ");

activeChar.setHero(true);

}

remove red letters  no need since we are already inside L2PcInstance class.

well i did not find any better version of this code so i guess i have to deal with it.

 

Thanks again for your answer it worked.

How can i make it to give hero forever? After restarting hero was gone.

Edited by Rio
Link to comment
Share on other sites

  • 0

well i did not find any better version of this code so i guess i have to deal with it.

 

Thanks again for your answer it worked.

How can i make it to give hero forever? After restarting hero was gone.

pack? in gameserver.model.entity.Hero.java there is a method activatehero or puthero look this method and you can make your own like this.

Link to comment
Share on other sites

  • 0

Im using l2jfrozen.

im a bit confused should i post this code

in gamserver.model.entity.hero.java?

no. read the code. and try to understand how is working.

i am not talking about the whole hero.java. i am talking about the methods-voids inside hero.java about the void puthero or activehero.

 

this void will help you to understand how to make your char hero with out gone in restart.

Link to comment
Share on other sites

  • 0

Here is the code 

public void putHero(L2PcInstance player, boolean isComplete)
    {
        try
        {
            if (Config.DEBUG)
            {
                System.out.println("Adding new hero");
                System.out.println("Name:" + player.getName());
                System.out.println("ClassId:" + player.getClassId().getId());
            }
            StatsSet newHero = new StatsSet();
            newHero.set(Olympiad.CHAR_NAME, player.getName());
            newHero.set(Olympiad.CLASS_ID, player.getClassId().getId());
            newHero.set(COUNT, 1);
            newHero.set(PLAYED, 1);
            _heroes.put(player.getObjectId(),newHero);
            if (isComplete)
                _completeHeroes.put(player.getObjectId(),newHero);
        }
        catch (Exception e)
        {
            /*   */
        }
    }

but i have not idea how to modify it.

Link to comment
Share on other sites

  • 0

Here is the code 

You can go with tessa's way OR you can add putHero anywhere in L2PcInstance.java

public void putHero(L2PcInstance player, boolean isComplete)
    {
        try
        {
            StatsSet newHero = new StatsSet();
            newHero.set(Olympiad.CHAR_NAME, player.getName());
            newHero.set(Olympiad.CLASS_ID, player.getClassId().getId());
            newHero.set(COUNT, 1);
            newHero.set(PLAYED, 1);
            _heroes.put(player.getObjectId(),newHero);
            if (isComplete)
                _completeHeroes.put(player.getObjectId(),newHero);
        }
        catch (Exception e)
        {

        }
    }

and then find the method increasePvPKills()  at L2PcInstance.java

and add a check if (player.getPvPkills() == XX && !_completeHeroes.contains(player.getObjectId))

 

 

which basicaly will make the player hero if he reach the proper pvp kills and no contained in the list.

Even tho u need to save and load it somewhere and this way suck.. but is kinda an idea on how to make it.

Link to comment
Share on other sites

  • 0

OR you can add putHero anywhere in L2PcInstance.java

 

Nonnonnonononononnonononnnonono sir. Leave Britney the method alone (and where it belongs) !

 

All in one it's a terrible idea to put it permanent, you will probably mess Olympiads system.

Edited by Tryskell
Link to comment
Share on other sites

  • 0

Nonnonnonononononnonononnnonono sir. Leave Britney the method alone (and where it belongs) !

 

All in one it's a terrible idea to put it permanent, you will probably mess Olympiads system.

Wait the "will probably mess olympiad system" ok but he ask about the code, normally he should make a row in characters "isHero" and store it as int there even tho again it wont appear in olympiad manager.

 

So about the code, open your navicat and characters find isNoble row and also find it inside L2PcInstance at the 2 sql

RESTORE_CHARACTER, UPDATE_CHARACTER      and add a new one and call it  isHero and basicaly do the same as isNoble does.. add the line at statement and where it loads, store values

and make two methods isPermaHero() that return the boolean _isPermaHero  and another one setPermaHero(boolean h) that set value at _isPermaHero = h;

 

and then find the method increasePvPKills(L2PcInstance activeChar) at L2PcInstance and add your check

 

if (activeChar.getPvPKills() == 1000 && !activeChar.isPermaHero())

{

    activeChar.setPermaHero(true); //set var as true so it can be stored

    activeChar.setHero(true); //set current hero

    activeChar.sendMessage("Congrats, you reached 1000 pvp's, you earned hero's status!");

}

 

even if server shutdown or character logs out, it will store at characters as if it was noble or vip or whatever.

 

Ps. tryskell first time you write a comment without being 333 lines, im proud of you honey <3

Edited by AccessDenied
Link to comment
Share on other sites

  • 0

I write big posts only when there is a need to argue or to explain, nothing more, nothing less.

 

And my disease seems to spread, as you act like that. My machiavelic plan works !

Link to comment
Share on other sites

  • 0

You have to add only on l2pcinstance.java all the code..

There is some better quake pvp systems and add your own effects/hero/annoounce

Link to comment
Share on other sites

  • 0

I write big posts only when there is a need to argue or to explain, nothing more, nothing less.

 

And my disease seems to spread, as you act like that. My machiavelic plan works !

to be honest i love it when u do it :3

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...