Jump to content

Question

Posted (edited)

Hi friends.
I'm doing a method where when the item expires teleport the player to another site.

 

	public void onItemExpire(L2Item item)
	{
		L2PcInstance player = null;
		if (item.getId() == ITEM_NAME)
		{
			if (item.getId() == -1)
			{
				player.teleToLocation(DIMENSIONAL_CRACK);
			}
		}

	}

some developer colleague can give me some suggestion?
thx :alone:

Edited by Sabrent

11 answers to this question

Recommended Posts

  • 0
Posted (edited)
7 hours ago, Sabrent said:

...

I can tell you many reasons why this code will not work:

  • - L2PcInstance player = null; (and its always null so will never work)
  • - if (item.getId() == ITEM_NAME) (looks wrong if "ITEM_NAME" its not int or Integer)
  • - if (item.getId() == -1) (i think lineage client do not support negative item ID)
  • - player.teleToLocation(DIMENSIONAL_CRACK) (player can not been found "its null" also "DIMENSIONAL_CRACK" have to been "Location DIMENSIONAL_CRACK = new Location(x,y,z);"

You have double check on Item ID and and if "ITEM_NAME" isn't "-1" then the check will always return to "false", but its not the only problem as you can read above.

Better tell us how you will use this Item and there will be better way for that.

Edited by StinkyMadness
  • 0
Posted

By "expired item", I suppose you speak about Shadow Weapon. PostIL chronicles probably uses the same timer/engine anyway.

 

On aCis, it would be located into ShadowItemTaskManager#run() method, in the following "if" block :

if (mana == -1)

If you use another pack, simply search for S1S_REMAINING_MANA_IS_NOW_0 which is the destruction of the item when mana reached 0.

 

If it's another system, simply check which message is sent when item is destroyed or when time expires, and put your teleToLocation in the block.

  • Like 1
  • 0
Posted (edited)
19 hours ago, Sabrent said:

Hi friends.
I'm doing a method where when the item expires teleport the player to another site.

 


	public void onItemExpire(L2Item item)
	{
		L2PcInstance player = null;
		if (item.getId() == ITEM_NAME)
		{
			if (item.getId() == -1)
			{
				player.teleToLocation(DIMENSIONAL_CRACK);
			}
		}

	}

some developer colleague can give me some suggestion?
thx :alone:



you can achieve such thing by making a custom item / custom skill
why you want to use script ?

suggestion / example
 

<set name="duration" val="600" />


<set name="targetType" val="SELF" />

    <effects>
            <effect name="Escape">
                <param escapeType="TOWN" />
            </effect>
        </effects>
    </skill>


************************************************

the only pathetic here is you Kara'
get a transformation into a fem  you rly need it.


 

Edited by etherian
  • 0
Posted (edited)

oh btw here is something you can use Kara`  it will suit you very well

<skill id="9065432" levels="1" name="retarded Kara">
        <set name="operateType" val="A2" />
        <set name="reuseDelay" val="1" />
        <set name="targetType" val="SELF" />
        <set name="trait" val="STUPIDITY" />
       <cond msgId="113" addName="1">      
             <using kind="FORUM" />
        </cond>
        <effects>
            <effect name="Buff">
                <param power="100" />
                <add stat="retarded" val="40" />
            </effect>    
    </effects>
    </skill>

Edited by etherian
  • Upvote 1
  • 0
Posted
12 hours ago, Tryskell said:

By "expired item", I suppose you speak about Shadow Weapon. PostIL chronicles probably uses the same timer/engine anyway.

 

On aCis, it would be located into ShadowItemTaskManager#run() method, in the following "if" block :


if (mana == -1)

If you use another pack, simply search for S1S_REMAINING_MANA_IS_NOW_0 which is the destruction of the item when mana reached 0.

 

If it's another system, simply check which message is sent when item is destroyed or when time expires, and put your teleToLocation in the block.

Yeah! :cheer:

I was observing the examples in L2ItemInstance and L2Item on the getTime and getDuration of the mana, I also observed the behavior of the shadows weapons and cursed weapons, try to do a method, but I am not an expert in Java but I am a student and I am not ashamed to ask.

 

1 hour ago, etherian said:



you can achieve such thing by making a custom item / custom skill
why you want to use script ?

suggestion / example
 

<set name="duration" val="600" />


<set name="targetType" val="SELF" />

    <effects>
            <effect name="Escape">
                <param escapeType="TOWN" />
            </effect>
        </effects>
    </skill>


************************************************

the only pathetic here is you Kara'
get a transformation into a fem  you rly need it.


 

Thx friend :cheer:

  • 0
Posted

What I want is that when the item is finished, the player is teleport to another site.

 

my script

/**
 * MyNpc AI.
 */
public final class MyNpc extends AbstractNpcAI
{
	// NPC
	private static final int NPC1 = 36655;
	private static final int NPC2 = 36656;
	// Item
	private static final int ITEM_NAME = 47811;

	private static final Location DIMENSIONAL = new Location(-190313, -112464, -7752);

	private MyNpc()
	{
		addStartNpc(NPC1, NPC2);
		addTalkId(NPC1, NPC2);
		addFirstTalkId(NPC1, NPC2);
	}

	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		String htmltext = null;
		if (npc.getId() == NPC1)
		{
			switch (event)
			{
				case "36655.htm":
				{
					htmltext = event;
					break;
				}
				case "give_coin":
				{
					if (hasQuestItems(player, ITEM_NAME))
					{
						return "haveitem_b.htm";
					}else
					{
						giveItems(player, ITEM_NAME, 1);
						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
					}
				}
			}
			break;
		}
	}
	if (npc.getId() == NPC2)
	{
		switch (event)
		{
			case "36656.htm":
			{
				htmltext = event;
				break;
			}
			case "give_coin":
			{
				if (hasQuestItems(player, ITEM_NAME))
				{
					return "haveitem_s.htm";
				}
				else
				{
					giveItems(player, ITEM_NAME, 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
			}
		}
		break;
	}

}
return htmltext;

}

@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player) {
	String htmltext = null;
	switch (npc.getId())
	{
		case NPC1:
		{
			htmltext = "36655.htm";
			break;
		}
		case NPC2:
		{
			htmltext = "36656.htm";
			break;
		}
	}
	return htmltext;
}

public void onItemExpire(L2Item item)
{
	L2PcInstance player = null;
	if (item.getId() == ITEM_NAME)
	{
		if (item.getId() == -1)
		{
			player.teleToLocation(DIMENSIONAL);
		}
	}

}


public static void main(String[] args) { new MyNpc(); }
}

try custom item and skill and it not work

	<skill id="55032" displayId="770" toLevel="1" name="Dimensional">
		<magicLvl>1</magicLvl>
		<operateType>P</operateType>
		<targetType>SELF</targetType>
		<affectScope>SINGLE</affectScope>
		<conditions>
			<condition name="OpCanEscape" />
		</conditions>
		<effects>
			<effect name="Teleport">
				<x>-120313</x>
				<y>-182464</y>
				<z>-6752</z>
			</effect>
		</effects>
	</skill>

	<item id="47811" name="Dimensional" type="EtcItem">
		<set name="is_tradable" val="false" />
		<set name="immediate_effect" val="true" />
		<set name="is_oly_restricted" val="true" />
		<set name="handler" val="ItemSkills" />
		<set name="is_dropable" val="false" />
		<set name="is_destroyable" val="false" />
		<set name="is_depositable" val="false" />
		<set name="is_sellable" val="false" />
		<set name="is_clan_depositable" val="false" />
		<set name="is_mailable" val="false" />
		<set name="is_commissionable" val="false" />
		<set name="is_private_storeable" val="false" />
		<set name="is_stackable" val="false" />
		<set name="time" val="60" /><!-- Mints -->
		<skills>
			<skill id="55032" level="1" /> <!-- Dimensional -->
		</skills>
	</item>

 

  • 0
Posted (edited)
7 hours ago, Sabrent said:

try custom item and skill and it not work


	<skill id="55032" displayId="770" toLevel="1" name="Dimensional">
		<magicLvl>1</magicLvl>
		<operateType>P</operateType>
		<targetType>SELF</targetType>
		<affectScope>SINGLE</affectScope>
		<conditions>
			<condition name="OpCanEscape" />
		</conditions>
		<effects>
			<effect name="Teleport">
				<x>-120313</x>
				<y>-182464</y>
				<z>-6752</z>
			</effect>
		</effects>
	</skill>

	<item id="47811" name="Dimensional" type="EtcItem">
		<set name="is_tradable" val="false" />
		<set name="immediate_effect" val="true" />
		<set name="is_oly_restricted" val="true" />
		<set name="handler" val="ItemSkills" />
		<set name="is_dropable" val="false" />
		<set name="is_destroyable" val="false" />
		<set name="is_depositable" val="false" />
		<set name="is_sellable" val="false" />
		<set name="is_clan_depositable" val="false" />
		<set name="is_mailable" val="false" />
		<set name="is_commissionable" val="false" />
		<set name="is_private_storeable" val="false" />
		<set name="is_stackable" val="false" />
		<set name="time" val="60" /><!-- Mints -->
		<skills>
			<skill id="55032" level="1" /> <!-- Dimensional -->
		</skills>
	</item>

 



taking as example bsoe



<item id="1538" type="EtcItem" name="Blessed Scroll of Escape">
        <set name="icon" val="icon.etc_scroll_of_return_i01" />
        <set name="default_action" val="SKILL_REDUCE" />
        <set name="etcitem_type" val="SCROLL" />
        <set name="material" val="PAPER" />
        <set name="weight" val="120" />
        <set name="price" val="150000" />
        <set name="is_stackable" val="true" />
        <set name="is_oly_restricted" val="true" />
        <set name="handler" val="ItemSkills" />
        <set name="item_skill" val="2036-1" />
    </item>


<skill id="2036" levels="2" name="Blessed Scroll of Escape">
         <table name="#itemConsumeId"> 1538 3958 </table>
        <set name="hitTime" val="200" />
        <set name="isMagic" val="2" /> <!-- Static Skill -->
        <set name="itemConsumeCount" val="1" />
        <set name="itemConsumeId" val="#itemConsumeId" />
        <set name="magicLvl" val="1" />
        <set name="operateType" val="A1" />
        <set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
        <set name="targetType" val="SELF" />
        <cond msgId="113" addName="1">
            <and>
                <player canEscape="true" />
                <not>
                    <player insideZoneId="10501, 10502, 10503, 10504, 10505, 10506, 10507, 10508" />
                </not>
            </and>
        </cond>
        <for>
            <effect name="Escape">
                <param escapeType="TOWN" />
            </effect>
        </for>
    </skill>

the item must have its decay

<set name="duration" val="600" />
i guess time  must be that


 

lets see in the operate type i dont think pasive will do the trick

must be immediate effect when the item is destroyed
or in this case consumed or depleted

what happens when you pick up a herb?  it bestows immediate effect on the char


    <item id="8600" type="EtcItem" name="Herb of Life">
        <set name="immediate_effect" val="true" />
        <set name="ex_immediate_effect" val="true" />
        <set name="material" val="PAPER" />
        <set name="is_depositable" val="false" />
        <set name="handler" val="ItemSkills" />
        <set name="item_skill" val="2278-1" />
        <set name="for_npc" val="true" />


<skill id="2278" levels="3" name="Herb of Life">
        <!-- Confirmed CT2.5 -->
        <table name="#amount"> 15 25 100 </table>
        <set name="effectPoint" val="100" />
        <set name="hitTime" val="100" />
        <set name="isMagic" val="2" /> <!-- Static Skill -->
        <set name="magicLvl" val="1" />
        <set name="operateType" val="A1" />
        <set name="reuseDelay" val="2000" />
        <set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
        <set name="targetType" val="SELF" />
        <set name="isRecoveryHerb" val="true" />
        <cond msgId="113" addName="1">
            <player flyMounted="false" />
        </cond>
        <for>
            <effect name="HealPercent">
                <param power="#amount" />
            </effect>
        </for>
    </skill>

 

 



well i will search more later but i think this tips might give you a more clear idea of what you must create as custom  

im looking if i can make something like  BlowSound.Java  to fix the mortal blow thing

i saw fixes posted in other topics  but they dont work
laters!

Edited by etherian
  • Like 1

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

    • Hola Fissban , che queria preguntarte algo estoy tratando de hacer que el testserver ande pro que cuando logeo y voy a elejir el servidor no aparece y he estado con la ia incluso buscando que puede ser pero no e logrado decifrarlo me darias una mano o alguien ?  
    • The Return of L2Elixir – A Legacy Reborn in 2025 Read more features: https://l2elixir.org/features/ It’s time to relive the magic. Many of you remember L2Elixir, first launched in 2008 – a server that brought players together, created friendships, rivalries, and unforgettable memories. For two+ incredible years, until its closure in 2010, Elixir was more than just a server… it was home. In 2018, a fake project borrowed the name and damaged that legacy, but the true memories of L2Elixir never died. Today, in 2025, we are proud to announce that a new dedicated team has taken up the mantle to bring L2Elixir back to life – with respect for the past and a fresh vision for the future.   What to Expect We’re not here to be “just another server.” Our mission is to bring back nostalgia with innovation, offering a unique progression experience: Interlude-Like start, capturing that classic old-school feeling. A natural evolution into Gracia Final. Followed by Gracia Epilogue, keeping the journey alive without losing balance. This is not a copy-paste server – it’s a carefully crafted world designed to honor the spirit of Lineage II while introducing fresh ideas to keep the gameplay alive and rewarding. Why L2Elixir? A balanced environment where community comes first. A project built with passion, not profit. A server that values longevity, fairness, and nostalgia.   📅 Launch Date & Details Closed Beta: Online. Open Beta & Rewards: November 15 & 21:00 UTC +2 Launch: November 28 & 21:00 UTC +2   🔗 Join the Community Be part of history once again. Follow our Discord, join the discussion, and prepare to step back into the world where legends were made.   https://l2elixir.org/ https://discord.gg/5ydPHvhbxs L2Elixir 2025 – Honoring the Past. Building the Future.
    • 10-24-2025 - OUR TOPIC IS RELEVANT! CONTACT US BY THE CONTACTS BELOW
    • Can someone decompile in classes this LineageSkilleffect.u ? I am willing to pay if needed,  protocol god any. https://wormhole.app/BEj0pr#osVXtnL9Q-AmmVmxOcEZfw
    • I didn't have the key for the cache too i just writen random things, then the second time i opened it i didn't need to use the serial key again
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock