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

    • Website: https://l2aurum.com/ Discord: https://discord.gg/ngaD9DJRjE   Dear Players, We are excited to announce that the x300 Summer Season Beta server will open on 19‑06‑2026 at 20:00 GMT+2. As previously mentioned, there will be no wipe and no account deletion. All accounts, characters, items, and progress from Season 1 will remain completely safe. To ensure a fair and competitive start for new players, all Season 1 accounts will be temporarily locked. The official Summer Season launch will take place on 26‑06‑2026 at 20:00 GMT+2. A few weeks after the official launch, Season 1 accounts will be unlocked so previous players can access their characters and continue their journey. This approach allows new players to enjoy a fresh start while preserving the progress and achievements of our long-term community. Thank you for your continued support, and we look forward to welcoming everyone to the new Summer Season. L2Aurum Team   Explore L2 Aurum Features Discover the Enhancements that set us apart!   Information Server Version: Interlude - PvP Server Client Interface: Unique Interface   Rates     Additional Features and changes When you create a new character, you will start in Giran Harbor at Level 1, equipped with full No-Grade items. Auto Farm is available for free for 2 hour daily without VIP. VIP players receive 4 hours of Auto Farm per day. The Auto Farm time resets with the server restart at 5:30 AM. Status Noblesse: Last hit Barakiel. Player Spawn Protection: 7 seconds. Geodata + Pathnodes: Enabled. All commands are available in the Community Board. Maximum 3 Bishops Per Party: Enabled. Boss Protect - Anti-Zerg: Enabled. Shift + click on monsters to see the droplist. Offline shop. Mana Potion Restores 1000 MP with a cooldown of 8 seconds. Inventory Slots: 250.   Weapon Information Lv1 Black Chaotic Weapons. Lv2 Aurum Weapons.   Armor Information Lv1 Blue Apella Armor. Lv2 Aurum Apella Armor. Misc additions Accessories +50 and +150 pdef|mdef. Tattoos: Resolve | Soul | Avadon. Agathions: Cosmetic only (no stats).   Buffs / Dances / Songs / Prophecies Duration: 2 hours. Total Buff Slots: 32 + 4 (Divine Inspiration). Vote Buff: You must vote on 3 of 6 vote sites to get the vote buff blessing. Castle Reward Every clan that captures a castle receives the castle owner clan blessing buff. To receive it, the clan leader must be online.   Events   Raid Bosses Epic Bosses Final Bosses     For full server information please visit website PvP: Server Features   Website: https://l2aurum.com/ Discord: https://discord.gg/ngaD9DJRjE      
  • 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..