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.

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

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

    • UPDATE M63 Introduced the first major Party Logic system: Bots can join and operate under a real-player party leader. Party members: follow the real player, assist the leader in combat, coordinate around the party leader, support party combat instead of behaving purely as independent farmers. Added initial party formation/follow behavior. Added party-aware PvP assisting.   Expanded Party Support / Party Combat behavior: Improved party coordination across different bot classes. Added broader healer/support participation. Expanded combat equipment/ammunition support, including all six arrow grades. Party members became more coordinated in PvP and group combat. Added improved bot reaction to resurrection situations. Added compatible resurrection-answer handling. Refined party formation behavior. Party combat became more persistent when members were attacked. Party members maintain combat participation more reliably instead of immediately dropping engagement.     Major Party Logic expansion:   Changed party travel formation Added temporary main assister leadership: if the real-player leader dies, a random living damage dealer becomes combat leader, other bots assist that damage dealer, if the assister dies, another DD can take over. Added special Bishop/Cardinal real-player leader logic: bots continue following the real player, a damage-dealer bot becomes the party’s combat assister. Added 5-second idle Party Logic: if the real-player leader stops moving/actively controlling combat for 5 seconds, bots can resume autonomous farming around the leader. Temporary main assisters use the bot’s already configured PvP mode instead of a separate Party Logic PvP system. Existing modes remain authoritative: Idle AttackFlagged AttackEveryone Temporary main assister can independently acquire PvP targets according to its configured mode. Other party bots assist that selected combat leader. Made Party Logic target acquisition party-location aware. While operating in a party, autonomous PvE/PvP searches can be centered around the real player’s current location rather than only the bot’s original farming position. Existing bot farmRadius remains the effective acquisition radius. This allows parties to travel away from their original farming areas while continuing to operate dynamically.     Expanded Bishop/Cardinal Party Logic behavior:   Bishop/Cardinal parties now use the same 5-second activity/idle model as normal real-player-led parties. While the Bishop/Cardinal leader is moving or active: bots prioritize staying with the real player, maintain the ~70–100 unit random formation. After the Bishop/Cardinal remains idle for 5 seconds: party bots may return to autonomous farming around the leader. When the Bishop/Cardinal starts moving again: party members transition back to following the leader. PvP remains independent of the PvE idle condition: valid PvP targets can still trigger combat according to each bot’s configured PvP mode.     Optional Hero System: Added a new hero_enabled option for Autobots. Bot creation gained Hero appearance: No / Yes. Existing bots default to hero_enabled = 0. Bots with hero_enabled = 1 spawn with native Lucera Hero status/aura/appearance through Player.setHero(true). Hero weapons configured through the existing Autobots item system can be equipped normally. This is intentionally visual/status Hero only: no Hero skill injection, no automatic native Hero skills, no changes to combat AI or targeting. Hero state can also be changed directly in the database and takes effect after respawning the bot.     DOWNLOAD
    • Throw a free cloudflare SSL cert in there. 😄
    • Nextarget was a LT international clan in Dawn and  Evoke and other servers, playing most in Interlude, so dunno if you try use this name to atrack the players or smth.
    • Server Specs ChapterInterlude Classic EXP / SP Ratex50 Adena Ratex30 Drop Ratex20 Spoil Ratex15 Max Level78 Website https://l2nextarget.com/ Start On Today At 22:00
    • Since last forums fail, I decided to introduce a little website over PTS server holder - just to make basic informations more reachable. You can discover it over http://anothercrappyinterludeserver.com/   Discord channels ACCESS TO SOURCES and SERVER INSTALLATION were also reworked to be easier to handle.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..