Jump to content
  • 0

[Question]How i can to do this?


Question

Posted

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

  • 0
Posted

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
Posted

 

It's ok like that?

 

L2PcInstance

+	public void increaseLevel()
+	{
+	if (getLevel() == 20)
+		teleToLocation(-84318,244579,-3730);
+	}

  • 0
Posted

 

 

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
Posted

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
Posted

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
Posted

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
Posted

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.

Guest
This topic is now closed to further replies.


×
×
  • Create New...