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

    • Vouch for @Ave i can say im very statisfied with the order I've made he was fast and reliable i totally recommend him to anyone who wants a decent updater with high quality design.
    • What can I say other than that I’m satisfied with the order I made. The guy is reliable and very good at what he does. I recommend him 100%.
    • Lineage2 Freya High Five @ Reshade with fog and rain etc @ Gracia final epilogue atmosphere   this reshade will eat lots of GPU power 50% or more of an RTX 3060 so be carefull depending on what effects are activated and their settings will eat even more GPU recomended 60hz monitor settings and via nvidia panel in Lineage2 game profile vsync settings to on effects are set up till film deck and the rest are not used but still working again this can eat alot of GPU Don't overheat GPU this is for freya high five but might work on others too copy in the  System  folder the folder  reshade-shaders  and the files  d3d9.dll  ReShade.ini  ReShadePreset.ini  ReShade.log  CccDddCcc.ini insert opens the menu and delete is on and of some settings need  ctrl + left click  to be changed   making another profile will reset the not activated effects to their default values so just copy the profile  CccDddCcc  and rename if needed also something needs to be closed from settings in game menu, the blur at distance and advanced shaders but keeping the advanced water effects all reflections   for those that don't like the h5 look of the sky and the red fog and rain and ambien red at night on all maps well if we want the cool gracia final epilogue back then we need to do this rename the  Maps  folder to Mapsretail or whatever copy the  Maps  folder from gracia final epilogue to h5 also we need the  L2_Skies.utx  from gracia final epilogue  Textures  folder to be replaced and also we need to do the same to the files  timeenv0.int  timeenv1.int  timeenv2.int  timeenv3.int  found in  system  folder   another setting that will probably be needed but not really tested out is to open file  option.ini  from  system  folder and add cachesize like this   [FirstRun] FirstRun=2   [Engine.GameEngine] CacheSizeMegs=512   also maybe is good to change those to 4.000000   [ClippingRange] Terrain=4.000000 Actor=4.000000 StaticMesh=4.000000 StaticMeshLod=4.000000 Pawn=4.000000       sorry bad english   https://mega.nz/file/aRNXxDrQ#mbxrNERBtW0XEEezK6w8-86oZWuX1k6NgtR6RZWKRVM   the compression on the video is kinda bad but meh    
  • 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..