Skip to content

some help with code

Featured Replies

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

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.