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

    • 🛡 GoldRush — High Five x20   A fresh High Five server focused on active progression, fair competition, and a healthy player-driven economy.   GoldRush is built for players who want a fresh spin on our beloved game that is connected to today's world via Web3 marketplace.   🌍 Server Info   Chronicle: High Five Type: Mid Rate / PvP Craft Community: International Location: Europe Time Zone: GMT+3   ⚙️ Rates   EXP: x20 SP: x20 Adena: x10 Drop: x8 Spoil: x12 Raid Boss: x3 Quest Items: x5 Quest EXP / SP: x10 Quest Adena: x5   👑 Class Progression   1st Class: Free 2nd Class: Free 3rd Class: 5,000,000 Adena   1st and 2nd class transfers reward Shadow Weapons.   ✨ Main Features   No P2W as there is no donation currency in the game Web3 Marketplace Events with real rewards Rotating accessories shop Weekly Olympiad Clean and active mid-rate progression   🧩 Community Board Features   Buffer GM Shop Gatekeeper Drop Search Rankings   🔨 Enchant Info   Max Weapon Enchant: +16 Max Armor Enchant: +12 Olympiad Max Enchant: +6   Safe Enchant: Weapons / Armor: safe to +3 Full Body Armor: safe to +4   Enchant Chance: +4 to +6: 66% +7 to +9: 60% +10 to +12: 54% +13 to +14: 48% +15 to +16: 42%   🏪 GM Shop / Gear Progression   C-grade through Dynasty gear is available through the GM Shop.   Moirai+ progression is farm, craft and raid based.   There is no admin-created endgame gear selling.   🥇 Gold Rush Economy   GoldRush includes a server-wide Adena sink system.   Players contribute Adena to the Gold Rush Collector. When the server goal is reached, limited Gold Bar stock unlocks through the Gold Merchant.   Daily Gold Rush missions also allow active players to earn Gold Bars through gameplay.   🌐 Website Player-to-Player Marketplace   GoldRush includes a website-based Web3 marketplace where players can list and trade items with each other.   Items come from real players.   The marketplace is player-to-player only.   🏛 Olympiad   Weekly Olympiad cycle. Olympiad starts at 18:00 GMT+3. Olympiad max enchant: +6.   🏰 Sieges   Castle sieges take place on Sundays at 16:00 and 20:00 GMT+3.   The first siege will happen 2 weeks after launch.   🐉 Grand Boss Respawn   Queen Ant: 24h + 2h random Core: 30h + 2h random Orfen: 48h + 2h random Baium: 120h + 3h random Antharas: 120h + 24h random Valakas: 120h + 24h random Beleth: 120h + 24h random   🎉 Events   Manual GM events with real token or gold bar rewards.   ⚔️ Fair Play   Bots are strictly forbidden and will result in a ban without warning.   Dualbox is limited to 1 box.   GoldRush is built around a healthy player-to-player economy.   🚀 What to Expect   Active farming Meaningful PvP Meaningul Farming Player-driven economy No donation currency     🔗 Join Us   Website: www.goldrushpvp.xyz Discord: https://discord.gg/kg9WXxcAY   🏁 Expected Launch: July 18 2026     If you are looking for a fresh High Five x20 server with clean structure and strong long-term potential, GoldRush is almost ready.   See you in game.
    • Collisions is from client are no way to bypass from server. Can be done from client modification need to be moded a .dll I can do the work you can contact me by DM  P.D: I already have this job done on the past
    • I believe this can be achieved with a client mod actually. What client are you using?  
  • 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..