Jump to content
  • 0

Item Expire


Sabrent

Question

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
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0
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
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0
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:

Link to comment
Share on other sites

  • 0

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>

 

Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

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

    • So excited to announce 3x Telegram Premium (6 months)   Join our official TG and participate to win!   Asocks.com - trusted proxy service providing mobile and residential proxies with a single price of $3 per 1GB   A huge locations pool and high speed will help complete all tasks    
    • Well, sorry not sorry for resurrecting old topic, but I believe it's ultimately stupid to implement license checks like Vilmis did 🙂   private static String url = "jdbc:mysql://185.80.128.233/" + getData("Zm9ydW1fZGI="); private static String username = getData("bXJjb3B5cmlnaHQ="); private static String password = getData("Y29weXJpZ2h0XzEyMw=="); con = GlobalDB.getInstance().getConnection(); PreparedStatement statement; statement = con.prepareStatement("SELECT field_6 from core_pfields_content WHERE member_id = ?"); statement.setInt(1, Config.FORUM_USER_ID); ResultSet rset = statement.executeQuery();   This awesome way of coding things leaves us with base64-encoded credentials and DB exposed and accessible globally 😉 Btw he checks his licensing data from some plugin generated table his forum uses. Vilmis took action and ensured that mrcopyright user would have only needed accesses and rights for this operation. But he forgot to ensure that his INFORMATION_SCHEMA database would not be exposed and readable... That leads us to fully readable server variables like version used (10.1.26-MariaDB-0+deb9u1 - pretty ancient DB and OS, I'd assume). From here you can go south and do some kinky stuff, if you want and have knowledge for that. But who cares, right?   Ooh, table core_pfields_content field_6 is IP address which is checked by FORUM_USER_ID. Yep, you can query all IP addresses there (124 of them right now) and also do whatever you want with them! 🙂  The most fun part? Files source has been shared what, more than 2 years ago?  Vilmis still uses very same credentials and never changed it after sources exposure - who cares. Although, "sources" may be way too strong word here. If anyone still use paid Orion versions, I'd suggest packing your shit and leaving immediately, or at least fix this incompetent fool caused problems. It's obvious Vilmis don't care or maybe doesn't even know from the first place how to solve this problem (hint hint - tiny PHP Rest API microservice which would do absolutely the same but without exposing sensitive data?). By doing that, he exposes his infrastructure and YOUR data, and he does that for more than 2 years now 🙂 Developer of century!    
    • rename the l2.bin into l2.exe
    • L2LIVE.PRO- Dynamic Mid-rates Essence Seven Signs GRAND OPENING - July 5, 20:00 GMT+3 (EEST) TEST SERVER IS OPEN - COME AND CHECK IT OUT TODAY! Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu   Server description * EXP/SP: Dynamic (x1- x100 based on your level, *before* Sayha and EXP buffs * Adena: x50 / Item Drop: x10 / Fishing EXP increased / Attribute EXP increased * Simplified gameplay to stay in the loop while not spending hours and hours farming * Starter Pack containing very useful items for beginners * MP replenishing potions with auto-consumption * No overpowered donations L2LIVE shop * All spellbook coupons, pet spellbook coupons and master books are sold via Game Assistant * Additionally you can buy SP pouches, enchanted talismans, pet training guides and various other consumables for Adena and L-Coin * More items such as cloaks, more talismans, agathions, belts, pendants, enchantment scrolls of various grades, evolution stones, etc will be added! Shop server as a shortcut, and all retail-like ways of earning items are still here! L-Coins * Drops with small change and in random amounts from Lv60+ monsters  * All raidbosses drop random amount of L-Coin Pouches generating up to 420 Lcoin per unit. **Grand Olympiad and Events** * Grand Olympiad is held week day * Format is 1v1, unlimited weekly fights  * Heroes are declared weekly at Sunday * There are three automated events - TvT, CTF and Deathmatch, running at evenings * Orc Fortress, Battle with Balok, Keber Hunter, Archievements Box, Daily Gift Calendar provisional events are active too Custom user commands * .offlineplay command, your character will keep playing till death or server restart * .offlineshop command, keeps your shop sitting until all items are purchased * .apon / .apoff - enable/disable HP/MP autoconsume And lots of other small improvements are waiting for you!   Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu
  • Topics

×
×
  • Create New...