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

    • Fresh off my private server for inspiration.
    • Custom High Five server L2insolence will open 2026-06-17 21:00 GMT+2 ! ! ! Web: http://www.l2insolence.eu/ Discord: https://discord.gg/duMjnj3y9A We have custom: 10 diferent looking custom armor sets. 8 weapon sets, 2 weapons sets are upgradable. 6 jewel sets. ----------------------------------- All custom tatto, masks, cloaks, agathions, belts, bracelest, talismans and more. Everi single item have own custom stats like: +p.atk% , +m.atk% , +p/m.def% and mutch more. All items in game have own stats. With custom looks. Glowing etc. ----------------------------------- Rates XP, SP: 25x Spoil and Drop: 10x Server Hard Farm ----------------------------------- Enchantment Safe enchant: +20099 Max enchant: +20099 All scrolls: 100% ----------------------------------- You can use scrolls or item enchant NPC to make +++ abd life beter. NPC Buffer There's an NPC buffer in all of our main towns. We have custom self buffs learned with npc with custom stats. Global Gatekeeper. GM Shop with normal items and custom ones, Event NPC, item upgrader NPC. Raid Bosses, every zone have its own boss and drops for rare mats, respawn every 10 seconds.. Olympiad The olympiad is ongoing every two weeks.
    • I agree that kernel-level protection offers much deeper visibility and control, especially when it comes to advanced bots and bypass techniques. That said, I'm not trying to claim that a usermode solution is impossible to bypass. My goal is simply to increase the cost and complexity of bypassing the protection while keeping deployment simple, stable, and compatible for server owners. A lot of Interlude server operators don't want to install kernel drivers or deal with the risks and maintenance that come with them. That's why I'm currently focusing on a layered approach: secure launcher architecture, HWID licensing, session validation, anti-debugging, injection detection, integrity checks, replay protection, and heartbeat monitoring. I'm not ruling out kernel support in the future. Right now, my priority is gathering real-world feedback, improving the product, and learning how people attempt to bypass different protection layers. I appreciate the feedback and the discussion.
    • not true, you can change any bot program name so the ones that are injecting aint a problem any more, you can aswell bypass everything in a dll so his way of thinking isnt bad at all
  • 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..