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

    • You dont get it... do you now. - read again.
    • What happened to them? Why they are disabled.. Just noticed that they are gone    @Maxtor @Celestine
    • If you want to make your thread stand out a bit more, adding quick proof pics or a small stock update usually helps buyers feel safer. I’ve had smoother chats with traders after doing that. On a side note, when I’m taking a break from trading, I mess around with the security puzzles in ModsCraft, which has been a fun way to clear my head between deals.
    • ━━━━━━━━━━━━━━━━━━━━━━ L2-SCRIPTS UPDATE ━━━━━━━━━━━━━━━━━━━━━━ Dear MaxCheaters users, We have updated the prices in the first post. Specially for the MaxCheaters community, we significantly reduced prices on many of our old developments, archived projects and source packs. Most of our older Lineage 2 sources are now much more affordable than before, including many Classic and Essence projects. This is a great opportunity for smaller teams, startup servers and developers who always wanted to work with our projects but previously could not afford them. ━━━━━━━━━━━━━━━━━━━━━━ For the past years we were mostly absent from the public scene because our team was working privately on large projects and contract-based development. During this time we accumulated a huge amount of private materials, systems, source codes, client modifications, website solutions and infrastructure developments that were never publicly released. Now, according to completed agreements and partnerships, we finally have the ability to publish and offer part of these materials as our private services and developments. In the upcoming weeks we will also publish a list of our works and services from the last 5 years of private development. ━━━━━━━━━━━━━━━━━━━━━━ Upcoming publications will include: • Private server development • Custom gameplay systems • Client modifications • Websites & ACP systems • Protection solutions • Infrastructure solutions • MMO / Web projects ━━━━━━━━━━━━━━━━━━━━━━ Thank you to everyone who stayed with us all these years.   Telegram:  @L2scripts Websites:  L2-scripts.com    L2-scripts.ru    Mmore.dev Sguard site:  Sguard   Best Regards! ━━━━━━━━━━━━━━━━━━━━━━
  • 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..