'Baggos' Posted August 28, 2012 Posted August 28, 2012 I want a code where when a player gets 20 level ie make him automatically teleport to a another area. I have create this, but nothing. if (activeChar.getLevel() == 20) _activeChar.teleToLocation(-84318,244579,-3730, true); Then what you need to work?
0 Fanky Posted August 28, 2012 Posted August 28, 2012 well,you'll need to find the method in l2pcinstance which is responsible for lvl increase. I'll help you. public void increaseLevel() { // } now put inside,this. if (getLevel() == 20) { teleToLocation(-84318,244579,-3730); }
0 'Baggos' Posted August 28, 2012 Author Posted August 28, 2012 It's ok like that? L2PcInstance + public void increaseLevel() + { + if (getLevel() == 20) + teleToLocation(-84318,244579,-3730); + }
0 Fanky Posted August 28, 2012 Posted August 28, 2012 It's ok like that? L2PcInstance + public void increaseLevel() + { + if (getLevel() == 20) + teleToLocation(-84318,244579,-3730); + } yep but,be aware. this method already exist in l2pcinstance and contains few more methods. don't mess them up
0 'Baggos' Posted August 28, 2012 Author Posted August 28, 2012 yep but,be aware. this method already exist in l2pcinstance and contains few more methods. don't mess them up Yeah... i have error on public void increaseLevel() but with public void increaseLevel1() is ok... what i can to do with this?
0 Fanky Posted August 28, 2012 Posted August 28, 2012 Yeah... i have error on public void increaseLevel() but with public void increaseLevel1() is ok... what i can to do with this? because by making increaselevel you duplicate the one which already exist. I told you that this method already exist. ctrl + f and insert this into the search 'public void increaseLevel()' after that you 'll see this public void increaseLevel() { // Set the current HP and MP of the L2Character, Launch/Stop a HP/MP/CP Regeneration Task and send StatusUpdate packet to all other L2PcInstance to inform (exclusive broadcast) setCurrentHpMp(getMaxHp(), getMaxMp()); setCurrentCp(getMaxCp()); } then do it, public void increaseLevel() { // Set the current HP and MP of the L2Character, Launch/Stop a HP/MP/CP Regeneration Task and send StatusUpdate packet to all other L2PcInstance to inform (exclusive broadcast) setCurrentHpMp(getMaxHp(), getMaxMp()); setCurrentCp(getMaxCp()); if (getLevel() == 20) teleToLocation(-84318,244579,-3730); }
0 'Baggos' Posted August 28, 2012 Author Posted August 28, 2012 Is it work? public void increaseLevel() { // Set the current HP and MP of the L2Character, Launch/Stop a HP/MP/CP Regeneration Task and send StatusUpdate packet to all other L2PcInstance to inform (exclusive broadcast) setCurrentHpMp(getMaxHp(), getMaxMp()); setCurrentCp(getMaxCp()); + if(Config.LEVEL_TELEPORT_ALLOWED) + + if (getLevel() == Config.LEVEL_COUNT) + teleToLocation(-84318,244579,-3730); + sendMessage("You will be teleporting on bla bla"); }
0 Fanky Posted August 28, 2012 Posted August 28, 2012 public void increaseLevel() { // Set the current HP and MP of the L2Character, Launch/Stop a HP/MP/CP Regeneration Task and send StatusUpdate packet to all other L2PcInstance to inform (exclusive broadcast) setCurrentHpMp(getMaxHp(), getMaxMp()); setCurrentCp(getMaxCp()); + if(Config.LEVEL_TELEPORT_ALLOWED) + { + if (getLevel() == Config.LEVEL_COUNT) + teleToLocation(-84318,244579,-3730); + sendMessage("You will be teleporting on bla bla"); + } } better. btw you 'll need to register the config @config.java aswell.
0 'Baggos' Posted August 28, 2012 Author Posted August 28, 2012 I know. haha. many thanks for the help. Lock it.
Question
'Baggos'
I want a code where when a player gets 20 level ie make him automatically teleport to a another area.
I have create this, but nothing.
if (activeChar.getLevel() == 20)
_activeChar.teleToLocation(-84318,244579,-3730, true);
Then what you need to work?
10 answers to this question
Recommended Posts