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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • https://prnt.sc/Bkkc0ShGXv9m https://prnt.sc/-JFLvZXsn27A
    • Hello guys want to sell adena in L2 Reborn Signature x1  Stock =14kk good price 
    • Hi guys, I have the following problem, I want to set up two servers on the same dedicated server and I can't.   L2jacis 409 Linux Server. The first gameserver has the following configuration: # ================================================================ # Gameserver setting # ================================================================ # This is transmitted to the clients, so it has to be an IP or resolvable hostname. If this ip is resolvable by Login just leave * Hostname = 190.25.103.103 # Bind ip of the gameserver, use * to bind on all available IPs. GameserverHostname = * GameserverPort = 7777 # The Loginserver host and port. LoginHost = 127.0.0.1 LoginPort = 9014 # This is the server id that the gameserver will request. RequestServerID = 1 # If set to true, the login will give an other id to the server (if the requested id is already reserved). AcceptAlternateID = True UseBlowfishCipher = True # ================================================================ # Database informations # ================================================================ URL = jdbc:mariadb://localhost/server1 Login = server1 Password = server1 I configured the second gameserver like this:   # ================================================================ # Gameserver setting # ================================================================ # This is transmitted to the clients, so it has to be an IP or resolvable hostname. If this ip is resolvable by Login just leave * Hostname = 0.0.0.0 # Bind ip of the gameserver, use * to bind on all available IPs. GameserverHostname = * GameserverPort = 7788 # The Loginserver host and port. LoginHost = 127.0.0.1 LoginPort = 9014 # This is the server id that the gameserver will request. RequestServerID = 2 # If set to true, the login will give an other id to the server (if the requested id is already reserved). AcceptAlternateID = True UseBlowfishCipher = True # ================================================================ # Database informations # ================================================================ URL = jdbc:mariadb://localhost/server2 Login = server2 Password = server2 apart from having tested 0.0.0.0 on the second gameserver I also tried 127.0.0.1 In both cases I see the two servers in the login when I log in, but I try to enter the one with the lowest ping and it kicks me out. The other server always appears with ping 9999 and I try to enter but it doesn't do anything and it freezes the login so I have to log in again. The hexids are in their respective folders. For server 1, it has its hexid inside the gameserver config folder, and I checked that the hexid id is the same id, for example id 1 in the gameserver is also id1 for server 1, and hexid 2 has its hexid 2 for server 2. The server ports are open and listening when I turn on both gameservers. I really don't know what could be wrong. If you could give me some help I would appreciate it. Excuse my English.
    • We have both old channels from 2006-2009 with the 3rd verification function enabled, and new ones.   For availability, please contact us below: Link - Telegram Link - Facebook WhatsApp - Click here to go to WhatsApp chat
    • You can contact me on skype: niedziolek50
  • Topics

×
×
  • Create New...