L2JMobius

Interlude How to create custom Pet Collar ?

Harda · 7 · 1752

Offline Harda

  • Vassal
  • *
    • Posts: 9
Hello everyone!
I would need your expertise on an issue I'm facing.
I want to create a "mercenary" pet. So, I created the NPC type="pet" ID=90100, I also created the item that should summon it ID=65050, and the file Stat/pet/900100_Mercenaryng.xml.

Unfortunately, the item refuses to appear. I think I missed some information, could you point me in the right direction?

Other than that, here is what I would like to achieve with these items: 5 mercenaries, one for each grade, with a one-time use (time-limited, for example 45 minutes), that does not consume XP from the player, and available from a certain level onward.

Here are the files I’ve already created:
Custom NPC :

Code: [Select]
<!--PET MERCENAIRE 90100, 90101, 90102, 90103, 90104, 90105-->
<npc id="90100" displayId="35031" level="15" type="Pet" name="Recrue" usingServerSideName="true">
<parameters>
<skill name="HealMagic" id="4025" level="1" /> <!-- Master Recharge -->
<param name="step1_action01" value="45" />
</parameters>
<race>HUMAN</race>
<sex>MALE</sex>
<stats str="20" int="15" dex="20" wit="15" con="25" men="10">
<vitals hp="800" hpRegen="2" mp="200" mpRegen="1" />
<attack physical="150" magical="100" random="20" critical="2" accuracy="3" attackSpeed="250" type="SWORD" range="40" distance="80" width="120" />
<defence physical="100" magical="80" />
<speed>
<walk ground="60" />
<run ground="100" />
</speed>
<hitTime>700</hitTime>
</stats>
<status undying="false" />
<skillList>
<skill id="4025" level="1" /> <!-- Master Recharge -->
<skill id="4121" level="1" /> <!-- Summoned Monster Magic Protection -->
</skillList>
<shots soul="3" spirit="1" />
<exCrtEffect>false</exCrtEffect>
<sNpcPropHpRate>1.1</sNpcPropHpRate>
<collision>
<radius normal="9" />
<height normal="16" />
</collision>
</npc>

<npc id="90101" displayId="35031" level="35" type="Pet" name="Garde" usingServerSideName="true">
<parameters>
<skill name="HealMagic" id="4025" level="3" /> <!-- Master Recharge -->
<param name="step1_action01" value="45" />
</parameters>
<race>HUMAN</race>
<sex>MALE</sex>
<stats str="30" int="20" dex="25" wit="18" con="35" men="15">
<vitals hp="1500" hpRegen="4" mp="400" mpRegen="2" />
<attack physical="250" magical="150" random="25" critical="3" accuracy="4" attackSpeed="240" type="SWORD" range="40" distance="80" width="120" />
<defence physical="150" magical="100" />
<speed>
<walk ground="80" />
<run ground="120" />
</speed>
<hitTime>650</hitTime>
</stats>
<status undying="false" />
<skillList>
<skill id="4025" level="3" /> <!-- Master Recharge -->
<skill id="4121" level="1" /> <!-- Summoned Monster Magic Protection -->
</skillList>
<shots soul="4" spirit="2" />
<exCrtEffect>false</exCrtEffect>
<sNpcPropHpRate>1.2</sNpcPropHpRate>
<collision>
<radius normal="9" />
<height normal="16" />
</collision>
</npc>
<npc id="90102" displayId="35031" level="50" type="Pet" name="Soldat" usingServerSideName="true">
<parameters>
<skill name="HealMagic" id="4025" level="5" /> <!-- Master Recharge -->
<param name="step1_action01" value="45" />
</parameters>
<race>HUMAN</race>
<sex>MALE</sex>
<stats str="40" int="25" dex="30" wit="20" con="40" men="20">
<vitals hp="2500" hpRegen="6" mp="600" mpRegen="3" />
<attack physical="450" magical="300" random="30" critical="4" accuracy="4.5" attackSpeed="230" type="SWORD" range="40" distance="80" width="120" />
<defence physical="200" magical="150" />
<speed>
<walk ground="90" />
<run ground="130" />
</speed>
<hitTime>620</hitTime>
</stats>
<status undying="false" />
<skillList>
<skill id="4025" level="5" /> <!-- Master Recharge -->
<skill id="4121" level="2" /> <!-- Summoned Monster Magic Protection -->
</skillList>
<shots soul="5" spirit="3" />
<exCrtEffect>false</exCrtEffect>
<sNpcPropHpRate>1.3</sNpcPropHpRate>
<collision>
<radius normal="9" />
<height normal="16" />
</collision>
</npc>
<npc id="90103" displayId="35031" level="60" type="Pet" name="Mercenaire" usingServerSideName="true">
<parameters>
<skill name="HealMagic" id="4025" level="7" /> <!-- Master Recharge -->
<param name="step1_action01" value="45" />
</parameters>
<race>HUMAN</race>
<sex>MALE</sex>
<stats str="50" int="30" dex="35" wit="25" con="45" men="25">
<vitals hp="3500" hpRegen="7" mp="800" mpRegen="4" />
<attack physical="600" magical="400" random="35" critical="5" accuracy="5" attackSpeed="220" type="SWORD" range="40" distance="80" width="120" />
<defence physical="250" magical="200" />
<speed>
<walk ground="100" />
<run ground="150" />
</speed>
<hitTime>600</hitTime>
</stats>
<status undying="false" />
<skillList>
<skill id="4025" level="7" /> <!-- Master Recharge -->
<skill id="4121" level="3" /> <!-- Summoned Monster Magic Protection -->
</skillList>
<shots soul="6" spirit="4" />
<exCrtEffect>false</exCrtEffect>
<sNpcPropHpRate>1.4</sNpcPropHpRate>
<collision>
<radius normal="9" />
<height normal="16" />
</collision>
</npc>
<npc id="90104" displayId="35031" level="76" type="Pet" name="Veteran" usingServerSideName="true">
<parameters>
<skill name="HealMagic" id="4025" level="9" /> <!-- Master Recharge -->
<param name="step1_action01" value="45" />
</parameters>
<race>HUMAN</race>
<sex>MALE</sex>
<stats str="60" int="35" dex="40" wit="30" con="50" men="30">
<vitals hp="5000" hpRegen="9" mp="1000" mpRegen="5" />
<attack physical="750" magical="500" random="40" critical="6" accuracy="6" attackSpeed="210" type="SWORD" range="40" distance="80" width="120" />
<defence physical="300" magical="250" />
<speed>
<walk ground="110" />
<run ground="160" />
</speed>
<hitTime>590</hitTime>
</stats>
<status undying="false" />
<skillList>
<skill id="4025" level="9" /> <!-- Master Recharge -->
<skill id="4121" level="4" /> <!-- Summoned Monster Magic Protection -->
</skillList>
<shots soul="7" spirit="5" />
<exCrtEffect>false</exCrtEffect>
<sNpcPropHpRate>1.5</sNpcPropHpRate>
<collision>
<radius normal="9" />
<height normal="16" />
</collision>
</npc>
<npc id="90105" displayId="35031" level="80" type="Pet" name="Elite" usingServerSideName="true">
<parameters>
<skill name="HealMagic" id="4025" level="10" /> <!-- Master Recharge -->
<param name="step1_action01" value="45" />
</parameters>
<race>HUMAN</race>
<sex>MALE</sex>
<stats str="70" int="40" dex="45" wit="35" con="60" men="35">
<vitals hp="6000" hpRegen="10" mp="1200" mpRegen="6" />
<attack physical="900" magical="600" random="50" critical="8" accuracy="7" attackSpeed="200" type="SWORD" range="40" distance="80" width="120" />
<defence physical="350" magical="300" />
<speed>
<walk ground="120" />
<run ground="170" />
</speed>
<hitTime>580</hitTime>
</stats>
<status undying="false" />
<skillList>
<skill id="4025" level="10" /> <!-- Master Recharge -->
<skill id="4121" level="5" /> <!-- Summoned Monster Magic Protection -->
</skillList>
<shots soul="8" spirit="6" />
<exCrtEffect>false</exCrtEffect>
<sNpcPropHpRate>1.6</sNpcPropHpRate>
<collision>
<radius normal="9" />
<height normal="16" />
</collision>
</npc>

Item 65000-65099.xml
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/items.xsd">
<item id="65050" type="EtcItem" name="Mercenary No Grade Contract">
<!-- Parchemin d'appel de mercenaire -->
<set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
<set name="default_action" val="SKILL_MAINTAIN" />
<set name="etcitem_type" val="PET_COLLAR" />
<set name="material" val="PAPER" />
<set name="weight" val="1" />
<set name="price" val="1000" />
<set name="is_oly_restricted" val="true" />
<set name="handler" val="SummonItems" />
<set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
<set name="use_condition" val="{{uc_transmode_exclude;{tt_pure_stat}}}" />
</item>
<item id="65051" type="EtcItem" name="Mercenary D Grade Contract">
<!-- Parchemin d'appel de mercenaire -->
<set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
<set name="default_action" val="SKILL_MAINTAIN" />
<set name="etcitem_type" val="PET_COLLAR" />
<set name="material" val="PAPER" />
<set name="weight" val="1" />
<set name="price" val="1000" />
<set name="is_oly_restricted" val="true" />
<set name="handler" val="SummonItems" />
<set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
<set name="use_condition" val="{{uc_transmode_exclude;{tt_pure_stat}}}" />
</item>
<item id="65052" type="EtcItem" name="Mercenary C Grade Contract">
<!-- Parchemin d'appel de mercenaire -->
<set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
<set name="default_action" val="SKILL_MAINTAIN" />
<set name="etcitem_type" val="PET_COLLAR" />
<set name="material" val="PAPER" />
<set name="weight" val="1" />
<set name="price" val="1000" />
<set name="is_oly_restricted" val="true" />
<set name="handler" val="SummonItems" />
<set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
<set name="use_condition" val="{{uc_transmode_exclude;{tt_pure_stat}}}" />
</item>
<item id="65053" type="EtcItem" name="Mercenary B Grade Contract">
<!-- Parchemin d'appel de mercenaire -->
<set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
<set name="default_action" val="SKILL_MAINTAIN" />
<set name="etcitem_type" val="PET_COLLAR" />
<set name="material" val="PAPER" />
<set name="weight" val="10" />
<set name="price" val="1000" />
<set name="handler" val="SummonItems" />
<set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
</item>
<item id="65054" type="EtcItem" name="Mercenary A Grade Contract">
<!-- Parchemin d'appel de mercenaire -->
<set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
<set name="default_action" val="SKILL_MAINTAIN" />
<set name="etcitem_type" val="PET_COLLAR" />
<set name="material" val="PAPER" />
<set name="weight" val="1" />
<set name="price" val="1000" />
<set name="is_oly_restricted" val="true" />
<set name="handler" val="SummonItems" />
<set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
<set name="use_condition" val="{{uc_transmode_exclude;{tt_pure_stat}}}" />
</item>
<item id="65055" type="EtcItem" name="Mercenary S Grade Contract">
<!-- Parchemin d'appel de mercenaire -->
<set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
<set name="default_action" val="SKILL_MAINTAIN" />
<set name="etcitem_type" val="PET_COLLAR" />
<set name="material" val="PAPER" />
<set name="weight" val="1" />
<set name="price" val="1000" />
<set name="is_oly_restricted" val="true" />
<set name="handler" val="SummonItems" />
<set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
<set name="use_condition" val="{{uc_transmode_exclude;{tt_pure_stat}}}" />
</item>
</list>

And for example stat/pet/90101_mercenaryd.xml
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<pets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/PetData.xsd">
    <pet id="90101" itemId="65051" index="13">
        <set name="load" val="54510" />
        <stats>
            <stat level="35">
                <set name="org_pattack" val="25" />
                <set name="org_pdefend" val="30" />
                <set name="org_mattack" val="15" />
                <set name="org_mdefend" val="22" />
                <set name="org_hp" val="500" />
                <set name="org_mp" val="200" />
                <set name="org_hp_regen" val="10" />
                <set name="org_mp_regen" val="4" />
            </stat>
        </stats>
    </pet>
</pets>



Offline Harda

  • Vassal
  • *
    • Posts: 9
Thanks Mobius!
I've changed the item IDs to 9300, 9301, 9302, 9303, 9304, 9305 in the 09300-09399.xml files.
I've also modified the .dat files on the client side.

Now the item appears in my inventory and in the multisell, but when I click on it, nothing happens.
I have no idea where the problem could be.


Online BazookaRpm

  • Count
  • *****
    • Posts: 444
  • Lineage II - lover - Heirophant
Support for client edition is not provided here, but what you can do is follow the structure of the wolf pet, ID npc,Itemname,npcgrp,etcitemgrp and to the object put time type shadow item, and level limiter as a restriction. uses is mechanical.
It's very easy, to replied
Atte BazooKa.RPM

Lineage II Lovers


Online Mobius

  • Distinguished King
  • *****
    • Posts: 19656
You can cerate a custom item on server side by just adding the displayId parameter to the XML.


Offline Harda

  • Vassal
  • *
    • Posts: 9
Thanks for your response! I feel a bit dumb now... ^^' I can't figure out what's wrong. The logic seems clear, but I just don't understand why it's not working.

I created a new item by copying the Wolf Necklace in stat/item/custom/09300-09399.xml:


Code: [Select]
<item id="9301" type="EtcItem" name="Mercenary D Grade Contract">
    <set name="icon" val="icon.etc_blesscharm_ward_val_i00" />
    <set name="default_action" val="SKILL_MAINTAIN" />
    <set name="etcitem_type" val="PET_COLLAR" />
    <set name="material" val="LEATHER" />
    <set name="weight" val="10" />
    <set name="is_oly_restricted" val="true" />
    <set name="handler" val="SummonItems" />
    <set name="item_skill" val="2046-1" /> <!-- Wolves' Necklace -->
    <set name="use_condition" val="{{uc_transmode_exclude;{tt_pure_stat}}}" />
</item>

Then, I created a Pet NPC in stat/npc/custom/custom.xml:

Code: [Select]
<npc id="90101" displayId="35031" level="35" type="Pet" name="Garde" usingServerSideName="true">
    <parameters>
        <skill name="HealMagic" id="4025" level="3" /> <!-- Master Recharge -->
        <param name="step1_action01" value="45" />
    </parameters>
    <race>HUMAN</race>
    <sex>MALE</sex>
    <stats str="30" int="20" dex="25" wit="18" con="35" men="15">
        <vitals hp="1500" hpRegen="4" mp="400" mpRegen="2" />
        <attack physical="250" magical="150" random="25" critical="3" accuracy="4" attackSpeed="240" type="SWORD" range="40" distance="80" width="120" />
        <defence physical="150" magical="100" />
        <speed>
            <walk ground="80" />
            <run ground="120" />
        </speed>
        <hitTime>650</hitTime>
    </stats>
    <status undying="false" />
    <skillList>
        <skill id="4025" level="3" /> <!-- Master Recharge -->
        <skill id="4121" level="1" /> <!-- Summoned Monster Magic Protection -->
    </skillList>
    <shots soul="4" spirit="2" />
    <exCrtEffect>false</exCrtEffect>
    <sNpcPropHpRate>1.2</sNpcPropHpRate>
    <collision>
        <radius normal="9" />
        <height normal="16" />
    </collision>
</npc>

I also created a pet data file (90101_mercenaryd.xml) in stat/pet/ to link the NPC ID with the Item ID:


Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<pets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/PetData.xsd">
    <pet id="90101" itemId="9301" index="13">
        <set name="load" val="54510" />
        <stats>
            <stat level="35">
                <set name="org_pattack" val="25" />
                <set name="org_pdefend" val="30" />
                <set name="org_mattack" val="15" />
                <set name="org_mdefend" val="22" />
                <set name="org_hp" val="500" />
                <set name="org_mp" val="200" />
                <set name="org_hp_regen" val="10" />
                <set name="org_mp_regen" val="4" />
            </stat>
        </stats>
    </pet>
</pets>

That's all I did. It should work, right?
However, when I try to use the item, nothing happens—no error, no summon, just nothing.
I really don't get what's wrong...

Any help would be greatly appreciated! :)



Online Mobius

  • Distinguished King
  • *****
    • Posts: 19656
A little taste of what is going on the subscriber version.

https://bitbucket.org/MobiusDev/l2j_mobius/commits/14e042699f18ea26c9e1f1e5f674631e73a73644
Code: (diff) [Select]
Index: dist/game/data/scripts/handlers/EffectMasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/EffectMasterHandler.java (revision 17297)
+++ dist/game/data/scripts/handlers/EffectMasterHandler.java (working copy)
@@ -141,6 +141,7 @@
  RestorationRandom.class,
  Resurrection.class,
  ResurrectionSpecial.class,
+ Ride.class,
  Root.class,
  RunAway.class,
  ServitorShare.class,
Index: dist/game/data/scripts/handlers/effecthandlers/Ride.java
===================================================================
--- dist/game/data/scripts/handlers/effecthandlers/Ride.java (nonexistent)
+++ dist/game/data/scripts/handlers/effecthandlers/Ride.java (working copy)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013 L2jMobius
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+package handlers.effecthandlers;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.conditions.Condition;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Liamxroy
+ */
+public class Ride extends AbstractEffect
+{
+ private final int _npcId;
+
+ public Ride(Condition attachCond, Condition applyCond, StatSet set, StatSet params)
+ {
+ super(attachCond, applyCond, set, params);
+
+ _npcId = params.getInt("npcId", 0);
+ }
+
+ [member=79]override[/member]
+ public boolean isInstant()
+ {
+ return true;
+ }
+
+ [member=79]override[/member]
+ public void onStart(Creature effector, Creature effected, Skill skill)
+ {
+ if (!effected.isPlayer())
+ {
+ return;
+ }
+
+ effected.asPlayer().mount(_npcId, 0, false);
+ }
+}
Index: dist/game/data/stats/items/custom/wyvern_item.xml
===================================================================
--- dist/game/data/stats/items/custom/wyvern_item.xml (nonexistent)
+++ dist/game/data/stats/items/custom/wyvern_item.xml (working copy)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/items.xsd">
+ <item id="50000" type="EtcItem" name="Gold Wyvern">
+ <set name="icon" val="icon.etc_magic_coin_gold_i00" />
+ <set name="displayId" val="3482" />
+ <set name="is_oly_restricted" val="true" />
+ <set name="reuse_delay" val="3000" />
+ <set name="handler" val="ItemSkills" />
+ <set name="item_skill" val="49900-1" />
+ </item>
+</list>
Index: dist/game/data/stats/skills/custom/wyvern_item.xml
===================================================================
--- dist/game/data/stats/skills/custom/wyvern_item.xml (nonexistent)
+++ dist/game/data/stats/skills/custom/wyvern_item.xml (working copy)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/skills.xsd">
+ <skill id="49900" levels="1" name="Gold Wyvern">
+ <set name="icon" val="icon.skill4289" />
+ <set name="displayId" val="4289" />
+ <set name="operateType" val="A1" />
+ <set name="targetType" val="SELF" />
+ <set name="reuseDelay" val="3000" />
+ <cond>
+ <player canSummon="true" />
+ </cond>
+ <for>
+ <effect name="Ride">
+ <param npcId="12621" />
+ </effect>
+ </for>
+ </skill>
+</list>