Jump to content
  • 0

some help with code


Question

Posted

i want create if player kill champion after spawn champion set lv2 this code set him but after spawn he don't be simple mob he  is anyway champion lv2 some ideas?

 

L2Attackable.java

public boolean doDie(L2Character killer)
          {
                if(Config.L2JMOD_CHAMPION_ENABLE)
	{
		if(isChampion())
		{
			setChampionlv2(true);
			return true;
		}
	}

                    setChampion(false);
	    setChampionlv2(false);

	//TODO
	if(Config.L2JMOD_CHAMPION_ENABLE)
	{
		//Set champion on next spawn
		if(!(this instanceof L2GrandBossInstance) 
		&& !(this instanceof L2RaidBossInstance)
		&& !isChampionlv2()
		&& this instanceof L2MonsterInstance
		&& Config.L2JMOD_CHAMPION_FREQUENCY > 0 
		&& getLevel() >= Config.L2JMOD_CHAMP_MIN_LVL 
		&& getLevel() <= Config.L2JMOD_CHAMP_MAX_LVL)
		{
			int random = Rnd.get(100);
			if(random < Config.L2JMOD_CHAMPION_FREQUENCY)
			{
				setChampion(true);
			}
		}
	}return true;
}

1 answer to this question

Recommended Posts

  • 0
Posted

the first error i see is, after you set him champ lvl 2, whenever it is a champion or not, you always revoke his lvl 2 status (after fist if block). So, try using a else

 

public boolean doDie(L2Character killer)
          {
                if(Config.L2JMOD_CHAMPION_ENABLE)
	{
		if(isChampion())
		{
			setChampionlv2(true);
			return true;
		}
	} else {
                    setChampion(false);
	    setChampionlv2(false);
	}

	//TODO
	if(Config.L2JMOD_CHAMPION_ENABLE)
	{
		//Set champion on next spawn
		if(!(this instanceof L2GrandBossInstance) 
		&& !(this instanceof L2RaidBossInstance)
		&& !isChampionlv2()
		&& this instanceof L2MonsterInstance
		&& Config.L2JMOD_CHAMPION_FREQUENCY > 0 
		&& getLevel() >= Config.L2JMOD_CHAMP_MIN_LVL 
		&& getLevel() <= Config.L2JMOD_CHAMP_MAX_LVL)
		{
			int random = Rnd.get(100);
			if(random < Config.L2JMOD_CHAMPION_FREQUENCY)
			{
				setChampion(true);
			}
		}
	}return true;
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock