Jump to content
  • 0

Random Skill in XML


Question

Posted

Hi. I want to little modifications in L2j server. I need a something for randomize skill.

generally...

I need a for example book, which can random skill and add this for player.

eq. I use book and i get to my skills,skill: PowerStrike.

I use same book and i get eq. Acumen skill.

HOw i can make it?

 

 

This option randomize item, but i want change it for skill.

 


<skill id="26075" levels="3" name="Book Skill">
	<!-- Confirmed CT2.5 -->
	<table name="#extractableItems">
		1049,2,30;1401,2,30;1042,1,20;1043,1,20
		1044,2,10;1098,2,20;1090,1,35;1396,1,35
		4930,1,20;1943,2,20;7661,2,20;7651,1,40
	</table>
	<set name="capsuled_items_skill" val="#extractableItems" />
	<set name="itemConsumeCount" val="1" />
	<set name="operateType" val="OP_ACTIVE" />
	<set name="skillType" val="EXTRACTABLE" />
	<set name="target" val="TARGET_SELF" />
	<cond msgId="129">
		<and>
			<player invSize="10" />
			<player weight="80" />
		</and>
	</cond>
</skill>

 

 

Thanks for any help.

6 answers to this question

Recommended Posts

  • 0
Posted

You have to choose :

- new itemhandler where you register your book on, and then you do your business on it (either reading parameters from item xml, or use a internal static array you Rnd.get(_skill[_skill.length]) on it in order to retrieve a skill). Example : dice, map, etc...

- new skillhandler and a new skill than your book must register the associated skill (example, bandage / haste potion calls a skill, the item itself only launches the skill).

 

Both solutions are almost identical, both in code and theory. The second is perhaps more longer to code.

 

You can't directly use extractable items for what you need. You would need to edit it. At least, from my L2 knowledge which is limited to IL... Post IL, you perhaps have already such items.

  • 0
Posted

So, How i can change it (dice) for the skill random and add to skill players?

I change it, change and not worked ; /

 




package handlers.itemhandlers;

import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.item.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.Dice;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Broadcast;
import com.l2jserver.util.Rnd;

/**
* This class ...
*
* @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:07 $
*/

public class RollingDice implements IItemHandler
{
/**
 * 
 * @see com.l2jserver.gameserver.handler.IItemHandler#useItem(com.l2jserver.gameserver.model.actor.L2Playable, com.l2jserver.gameserver.model.item.instance.L2ItemInstance, boolean)
 */
@Override
public void useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
{
	if (!(playable instanceof L2PcInstance))
		return;

	L2PcInstance activeChar = (L2PcInstance) playable;
	int itemId = item.getItemId();

	if (activeChar.isInOlympiadMode())
	{
		activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
		return;
	}

	if (itemId == 4625 || itemId == 4626 || itemId == 4627 || itemId == 4628)
	{
		int number = rollDice(activeChar);
		if (number == 0)
		{
			activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_THROW_THE_DICE_AT_THIS_TIME_TRY_AGAIN_LATER);
			return;
		}

		Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), item.getItemId(), number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ()));

		SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ROLLED_S2);
		sm.addString(activeChar.getName());
		sm.addNumber(number);

		activeChar.sendPacket(sm);
		if (activeChar.isInsideZone(L2Character.ZONE_PEACE))
			Broadcast.toKnownPlayers(activeChar, sm);
		else if (activeChar.isInParty())
			activeChar.getParty().broadcastToPartyMembers(activeChar, sm);
	}
}

/**
 * 
 * @param player
 * @return
 */
private int rollDice(L2PcInstance player)
{
	// Check if the dice is ready
	if (!player.getFloodProtectors().getRollDice().
			tryPerformAction("roll dice"))
	{
		return 0;
	}
	return Rnd.get(1, 6);
}
}





  • 0
Posted

You musn't edit dice itemhandler... But copy paste one of those itemhandler, rename it, link that handler with your item on XML.

 

See how an itemhandler is supposed to work before wanting to make one.

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


  • Posts

    • We are officially opening! Grand Opening: Saturday, 19 September at 16:00 (Greek time — server time). Server is now in TEST/BETA phase → everything will be alive & complete at opening. == WHY YOU SHOULD BE THERE AT 16:00 ==  Rates 9300x EXP / 3000x SP / 5500x Adena — fast start, non-stop action Gracia Final — the real, nostalgic line-up. Like L2 Pride, but fresh & stable No wipe, no close, 24/7 with AntiDoss protection  Safe Enchant +3 · Max Enchant +25 Drop 1x — epic drops feel EPIC == AT OPENING (19/9, 16:00) == - Full server live ceremony: everyone starts in the world together - Community events & giveaways announced LIVE on Discord - Forum + support fully active == GET READY ==  Download the client: https://l2aquila.com/downloads.html Install guide (3 steps, 2 minutes): https://l2aquila.com/install-guide.html  Join Discord to be there at launch: https://discord.gg/5ZyBRvG4k == Countdown is running on the site: https://l2aquila.com == Be part of L2Aquila from the very first minute. 
    • support for new protocols https://imgur.com/PhwtEEX https://imgur.com/Dyul5wt
    • TOPSERVERS200 is a platform for promoting Lineage 2 projects and helping players discover new servers. Add your server, announce your upcoming launch, and compete in the TOP 200 rankings. ━━━━━━━━━━━━━ ◆ ━━━━━━━━━━━━━ TOPSERVERS200 FEATURES   📅 Launch Announcements - announce your new server and attract players both before and after its launch. 🏆 TOP 200 - earn votes from players and climb the Lineage 2 server rankings. 🌐 Server Page - chronicles, rates, launch dates, descriptions, reviews, and other key information about your server. 📺 Lineage 2 Streams - player streams from Twitch, YouTube, and Kick collected in a dedicated section of the platform. 📢 Promotion - VIP placement, banner advertising, and additional options to increase your project's visibility.   ━━━━━━━━━━━━━ ◆ ━━━━━━━━━━━━━ AVAILABLE GAMES   Lineage 2 • Minecraft • World of Warcraft • GTA 5 • MuOnline • SAMP • Perfect World   ━━━━━━━━━━━━━ ◆ ━━━━━━━━━━━━━ LINEAGE 2 ON TOPSERVERS200   Current servers, upcoming launches, rankings, and player reviews - all gathered in one section. VIEW LINEAGE 2 SERVER RANKINGS
    • L2Elite is still around fortunately or unfortunately, Archon I don't remember, RaceSupremacy was such a cool server, I really enjoyed my time there I was playing Grand Khavatary there, Core i've played also but I have no memory of it, one other server I really enjoyed was L2Total I remember a glitch/bug I found there where before clicking ok on exchanging goldbars to adena you would spam screenshot and it would duplicate the item, loved it.
    • 🔥 Daily restock across all tools! Get your favorite AI subscriptions at unbeatable prices.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..