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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...