removed_001 Posted July 15, 2010 Posted July 15, 2010 1st : i want to create a skill 2nd : i want an item that when u press it, it will automatically gives u that skill sb do that for me plz? and no do that just show me how or tell me the code plz!
0 eKo Posted July 15, 2010 Posted July 15, 2010 first : skill guides can be found if you use search second: you can use this code /** * @author eKo * */ public class ViP implements IItemHandler { private static final int[] ITEM_IDS = { itemID }; public void useItem(L2PlayableInstance playable, L2ItemInstance item) { if (!(playable instanceof L2PcInstance)) return; L2PcInstance activeChar = (L2PcInstance)playable; int itemId = item.getItemId(); if (itemId == itemID) { blabla add here skill code. } } public int[] getItemIds() { return ITEM_IDS; } } the code to add skills you should find out yourself.
0 removed_001 Posted July 15, 2010 Author Posted July 15, 2010 if (itemId == itemID) <----- look this its for items not for skills :/ plz if u can help me a little more cause i am new in java developing
0 eKo Posted July 15, 2010 Posted July 15, 2010 if (itemId == itemID) <----- look this its for items not for skills :/ plz if u can help me a little more cause i am new in java developing its for the item code if you use xy item you get skills....grr read some guides
0 adenaman Posted July 15, 2010 Posted July 15, 2010 to get the skill use L2Skill sk = SkillTable.getInstance().getInfo(/*skill id*/, /*skill lvl*/); activeChar.addSkill(sk, true); EDIT: btw eKo, isnt better to use for(i= 0; i< ITEM_IDS.length; i++) if (ITEM_IDS[i] == itemid) { blabla add here skill code. }
0 removed_001 Posted July 16, 2010 Author Posted July 16, 2010 /** * @author eKo * */ public class ViP implements IItemHandler { private static final int[] ITEM_IDS = { itemID }; public void useItem(L2PlayableInstance playable, L2ItemInstance item) { if (!(playable instanceof L2PcInstance)) return; L2PcInstance activeChar = (L2PcInstance)playable; int itemId = item.getItemId(); if (itemId == itemID) { L2Skill sk = SkillTable.getInstance().getInfo(/*skill id*/, /*skill lvl*/); activeChar.addSkill(sk, true); } } public int[] getItemIds() { return ITEM_IDS; } } so it would be like this... (if correct say it and lock the topic.) also (where do i put that code?)
0 adenaman Posted July 16, 2010 Posted July 16, 2010 first of all create the skill go to data/stats/skills and create a file named "10100-10199.xml" if it doesnt exist edit it using http://www.l2jserver.com/wiki/Skills if you dont have time or dont want to read that all, just copy any skill done b4, and edit it BTW use skill id 10100 coz i hope its not used yet so change in the itemhandler's code " /*skill id*/ " with the skill id (10100) and " /*skill lvl*/ " with 1 if you just want to make 1 lvl of the skill
0 removed_001 Posted July 16, 2010 Author Posted July 16, 2010 ok thanx in advance lock this topic SOLVED*
Question
removed_001
1st : i want to create a skill
2nd : i want an item that when u press it, it will automatically gives u that skill
sb do that for me plz?
and no do that just show me how or tell me the code plz!
8 answers to this question
Recommended Posts