Jump to content
  • 0

Help Unsummon a NPC


Question

Recommended Posts

  • 0
Posted

as i told check the exist one.... from the dwarf (maestro) "Summon Merchant Golem"

 

<skill id="831" levels="1" name="Summon Merchant Golem">
	<set name="itemConsumeId" val="1458" />
	<set name="itemConsumeCount" val="5" />
	<set name="mpConsume" val="122" />
	<set name="target" val="TARGET_SELF" />
	<set name="hitTime" val="15000" />
	<set name="reuseDelay" val="75000" />
	<set name="skillType" val="SUMMON" />
	<set name="operateType" val="OP_ACTIVE" />
	<!-- Summon-specific -->
	<set name="summonTotalLifeTime" val="180000" />
	<set name="summonTimeLostIdle" val="1000" />
	<set name="summonTimeLostActive" val="1000" />
	<set name="npcId" val="13128" />
</skill>

 

NPC: \gameserver\data\html\merchant\13128

 

 

u can also use this npc/skill for all classes just add them to all auto learn and edit the html as u want...

 

or u check this codes and learn how its working and do your own one... HF

  • 0
Posted
  On 9/10/2010 at 11:04 PM, SkyNet said:

as i told check the exist one.... from the dwarf (maestro) "Summon Merchant Golem"

 

<skill id="831" levels="1" name="Summon Merchant Golem">
	<set name="itemConsumeId" val="1458" />
	<set name="itemConsumeCount" val="5" />
	<set name="mpConsume" val="122" />
	<set name="target" val="TARGET_SELF" />
	<set name="hitTime" val="15000" />
	<set name="reuseDelay" val="75000" />
	<set name="skillType" val="SUMMON" />
	<set name="operateType" val="OP_ACTIVE" />
	<!-- Summon-specific -->
	<set name="summonTotalLifeTime" val="180000" />
	<set name="summonTimeLostIdle" val="1000" />
	<set name="summonTimeLostActive" val="1000" />
	<set name="npcId" val="13128" />
</skill>

 

NPC: \gameserver\data\html\merchant\13128

 

 

u can also use this npc/skill for all classes just add them to all auto learn and edit the html as u want...

 

or u check this codes and learn how its working and do your own one... HF

 

thank you i think that what i need

 

I will test it soon

 

Best Regards

  • 0
Posted

Skynet all thank to your help  I test this way but I cant show any htm which i need when summon NPC (when press on it show me a pet menu)

How i change it to show Htm file and how make it in Constant location without follow a player 

  • 0
Posted

well i just try to give u some hints i never tested anything with it so i dunno...

but since its and "npc/summoner" its should have anywhere stats about run spd etc...

 

maybe u should try to contact B1ggBoss so he can explain you his way which he gave u here...

  • 0
Posted
  On 9/13/2010 at 8:36 AM, B1ggBoss said:

then you may schedule it in the SummonItems class (itemhandlers)

 

Thank you so much

I make as you said and add it inside case like bellow code

 

case 5: // Static Temp Summons   (like christmas tree)
		final L2Spawn TempSpwan = new L2Spawn(npcTemplate);

		TempSpwan.setId(IdFactory.getInstance().getNextId());
		TempSpwan.setLocx(activeChar.getX());
		TempSpwan.setLocy(activeChar.getY());
		TempSpwan.setLocz(activeChar.getZ());
		L2World.getInstance().storeObject(TempSpwan.spawnOne(true));
		activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
		activeChar.sendMessage("Created " + npcTemplate.getName() + " at x: " + TempSpwan.getLocx() + " y: " + TempSpwan.getLocy() + " z: " + TempSpwan.getLocz());

		ThreadPoolManager.getInstance().scheduleGeneral(new UnSpawn(yourNpc), 90000);
		break;

The above code is same as Static Summons (like christmas tree) But with your cade Make me add custom Temp summon that Unspawn after 90 seconds

 

When I add

ThreadPoolManager.getInstance().scheduleGeneral(new UnSpawn(yourNpc), 90000);

yourNpc is deference than other type of summon = L2Spawn that make class Unspwan you give me deference Can you give me new class make my above code work perfect

 

Best regards

 

  • 0
Posted

I relay use this method on the unspwan class

 

package com.l2jfree.gameserver.handler.itemhandlers;

import com.l2jfree.gameserver.datatables.SpawnTable;
import com.l2jfree.gameserver.model.actor.L2Npc;

public class UnSpawn implements Runnable {

private final L2Npc npc;

public UnSpawn(final L2Npc npc)
{
	this.npc = npc;
}

@Override
public void run()
{
	if(npc != null)
	{
		SpawnTable.getInstance().deleteSpawn(npc.getSpawn(), false);
		npc.deleteMe();
	}
}

}


But the problem On l2jfree  The method getLastSpawn() is undefined for the type L2Npc

and there are efferent between he constructor UnSpawn(L2Spawn) and constructor UnSpawn(L2NPC) each of them in efferent way any other solution to use it PLz

 

  • 0
Posted

i said to use the method getLastSpawn() for TempSpawn (L2Spawn).

L2Npc myNpc = TempSpawn.getLastSpawn();
ThreadPoolManager.getInstance().scheduleGeneral(new UnSpawn(myNpc), 600000);

  • 0
Posted

thank you so mach abit help from you to finish that :)

 

Ok we change type  of myNpc from L2Spawn to the L2Npc to use getLastSpawn() Method

that good no error in the SummonItems

 

But :(

 

in the Unspawn Class there are error in the

 


		SpawnTable.getInstance().deleteSpawn(npc, false);
		npc.deleteMe();

 

The method deleteSpawn(L2Spawn, boolean) in the type SpawnTable is not applicable for the arguments (L2Npc, boolean)

 

I apologize for the inconvenience  ;)

 

  • 0
Posted

Try this:

Index: src/main/java/com/l2jfree/gameserver/handler/itemhandlers/SummonItems.java
===================================================================
--- src/main/java/com/l2jfree/gameserver/handler/itemhandlers/SummonItems.java	(revision 8804)
+++ src/main/java/com/l2jfree/gameserver/handler/itemhandlers/SummonItems.java	(working copy)
@@ -18,6 +18,7 @@
import com.l2jfree.gameserver.ThreadPoolManager;
import com.l2jfree.gameserver.datatables.NpcTable;
import com.l2jfree.gameserver.datatables.SummonItemsData;
+import com.l2jfree.gameserver.datatables.SpawnTable;
import com.l2jfree.gameserver.handler.IItemHandler;
import com.l2jfree.gameserver.idfactory.IdFactory;
import com.l2jfree.gameserver.instancemanager.ClanHallManager;
@@ -134,6 +135,8 @@
			spawn.setLocx(activeChar.getX());
			spawn.setLocy(activeChar.getY());
			spawn.setLocz(activeChar.getZ());
+			UnSpawn unSpawn = new UnSpawn(spawn);
+			ThreadPoolManager.getInstance().scheduleGeneral(unSpawn, 600000);
			L2World.getInstance().storeObject(spawn.spawnOne(true));
			activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
			activeChar.sendMessage("Created " + npcTemplate.getName() + " at x: " + spawn.getLocx() + " y: " + spawn.getLocy() + " z: " + spawn.getLocz());
@@ -285,6 +288,23 @@
			petSummon.broadcastStatusUpdate();
		}
	}
+	
+	private class UnSummon implements Runnable
+	{
+		private L2Spawn spawn;
+		
+		private UnSummon(L2Spawn spawn)
+		{
+			this.spawn = spawn;
+		}
+		
+		@Override
+		public void run()
+		{
+			SpawnTable.getInstance().deleteSpawn(spawn, false);
+			spawn.getLastSpawn().deleteMe();
+		}
+	}

	@Override
	public int[] getItemIds()

  • 0
Posted

Hello amazing code i change some of it

 

New patch is

 

#P l2jfree-core
Index: src/main/java/com/l2jfree/gameserver/handler/itemhandlers/SummonItems.java
===================================================================
--- src/main/java/com/l2jfree/gameserver/handler/itemhandlers/SummonItems.java	(revision 8802)
+++ src/main/java/com/l2jfree/gameserver/handler/itemhandlers/SummonItems.java	(working copy)
@@ -19,6 +19,7 @@
import com.l2jfree.gameserver.datatables.NpcTable;
import com.l2jfree.gameserver.datatables.SummonItemsData;
import com.l2jfree.gameserver.handler.IItemHandler;
+import com.l2jfree.gameserver.datatables.SpawnTable;
import com.l2jfree.gameserver.idfactory.IdFactory;
import com.l2jfree.gameserver.instancemanager.ClanHallManager;
import com.l2jfree.gameserver.model.L2ItemInstance;
@@ -153,6 +154,23 @@
		case 4: // Light Purple Maned Horse
			activeChar.mount(sitem.getNpcId(), item.getObjectId(), false);
			break;
+		case 5: // Static Temp Summons   (like christmas tree)
+			final L2Spawn TempSpwan = new L2Spawn(npcTemplate);
+			
+			TempSpwan.setId(IdFactory.getInstance().getNextId());
+			TempSpwan.setLocx(activeChar.getX());
+			TempSpwan.setLocy(activeChar.getY());
+			TempSpwan.setLocz(activeChar.getZ());
+			UnSummon unSpawn = new UnSummon(TempSpwan);
+			ThreadPoolManager.getInstance().scheduleGeneral(unSpawn, 900000);
+			L2World.getInstance().storeObject(TempSpwan.spawnOne(true));
+			activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
+			activeChar.sendMessage("Created " + npcTemplate.getName() + " at x: " + TempSpwan.getLocx() + " y: " + TempSpwan.getLocy() + " z: " + TempSpwan.getLocz());
+			//L2Spawn yourNpc = TempSpwan;
+			//L2Npc myNpc = TempSpwan.getLastSpawn();
+			//ThreadPoolManager.getInstance().scheduleGeneral(new UnSpawn(TempSpwan), 90000);
+			//ThreadPoolManager.getInstance().scheduleGeneral(new UnSpawn(myNpc), 90000);
+			break;
		}
	}

@@ -282,7 +300,22 @@
			petSummon.broadcastStatusUpdate();
		}
	}
-
+private class UnSummon implements Runnable
+{
+		private L2Spawn spawn;
+		
+		private UnSummon(L2Spawn spawn)
+		{
+			this.spawn = spawn;
+		}
+		
+		@Override
+		public void run()
+		{
+			SpawnTable.getInstance().deleteSpawn(spawn, false);
+			spawn.getLastSpawn().deleteMe();
+		}
+	}
	public int[] getItemIds()
	{
		return SummonItemsData.getInstance().itemIDs();


 

I will test it after compile to see result soon

 

 

  • 0
Posted

[move] :D yes :D [/move]

 

It's work perfect thank you to help me

 

code is very good that give anyone add a custom summon in specific time

 

All thank to B1ggBoss   ;) and Skynet  ;)

 

Best regards to you my friends

 

 

 

 

Guest
This topic is now closed to further replies.



  • Posts

    • Thank you for the reply. I know that this issue is due to L2 being so old. I was just wondering if there was an external way to fix the UI scaling. Like a patch or some settings.
    • Bro the game is so old it doesn't have a native option to scale the UI like in modern MMOs
    • Dear players, From April 19 to April 27 inc., the Bonus Start event will be active. It’s designed to help new and low-level characters get started more easily.   All characters that meet one of the following conditions: — created less than 3 days ago (regardless of level), — currently level 20 or below, — created during the event period, will receive upon login: — 10 sets of buff scrolls (phys or mage, depending on class), — 10 packs of +50% Drop/Spoil runes (2 hours each), — 10 packs of +50% Exp runes (2 hours each). Characters between level 21 and 30 will receive upon login: — 6 sets of buff scrolls, — 6 packs of +50% Drop/Spoil runes (2h each), — 6 packs of +50% Exp runes (2h each).   Event items will be removed approx. 09.05.2025 Server rates will be increased to x2.25. Take this chance to start your journey with ease or bring an old hero back into the fight — it’s the perfect time to test your strength! Open Beta Test is started!  Helper cats are waiting in towns — talk to them to receive the necessary equipment and level up your character. Siege Schedule:  - April 13 at 16:00 (GMT+2) – Innadrile Castle - April 14 at 20:00 (GMT+2) – Bandit Stronghold - April 15 at 20:00 (GMT+2) – Devastated Castle 📌 During the OBT, players who report bugs will receive CoL:   - 1 CoL for each reported staticmeshes bug (e.g., walking through textures, stairs, etc.) - 2 CoL or more for server-related issues (depending on severity) You can report bugs on the forum. The Open Beta Test will run approximately until April 15 at 23:00 (GMT+2). Your activity and feedback will help us improve the game.   Download links: Download client | Download updater 
    • begin if (user.dead) then begin delay(555); Engine.GoHome(rtCastle); print('User dead, going to castle..') end; end.  
    • Hello everyone. Long time no see. I've been trying to play L2 on my 4k monitor, however the UI is extremely small.  I checked around the internet and couldn't find a guide on how to keep the resolution high and the UI size a bit bigger. I either get small UI + full resolution (correct resolution of monitor), or normal sized UI but resolution set to full HD (which doesn't really look good on a 4k screen). Adjusting scaling on display settings doesn't change the UI just the text on L2. Does anyone know a way to increase the UI size only and keeping the screens resolution same (4k) ? I'll share a screenshot as an example, and it 's not even full screen mode. https://freeimage.host/i/3cvPVnI  
  • Topics

×
×
  • Create New...