Jump to content

Question

7 answers to this question

Recommended Posts

  • 0
Posted

If you speak about the event, and then it's a script, on "advanced" (maybe on older version, I don't rem) script engine you got addSpawn, which holds a parameter to auto despawn the spawned npc.

  • 0
Posted (edited)

im talking for this item large squash seed

big_seed.jpg

where they spawn this mob Large Young Squash

 

i dont use any script i have add them to droplist but i want to make them have limit becouse when someone spawn 100-200 they make lag.

 

i think is this script for it

/*
 * L2jFrozen Project - www.l2jfrozen.com 
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

package com.l2jfrozen.gameserver.model.actor.instance;

import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.taskmanager.DecayTaskManager;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;

public final class L2GourdInstance extends L2MonsterInstance
{
	// private static Logger LOGGER = Logger.getLogger(L2GourdInstance.class);
	
	private String _name;
	private byte _nectar = 0;
	private byte _good = 0;
	
	public L2GourdInstance(final int objectId, final L2NpcTemplate template)
	{
		super(objectId, template);
		DecayTaskManager.getInstance().addDecayTask(this, 180000);
	}
	
	public void setOwner(final String name)
	{
		_name = name;
	}
	
	public String getOwner()
	{
		return _name;
	}
	
	public void addNectar()
	{
		_nectar++;
	}
	
	public byte getNectar()
	{
		return _nectar;
	}
	
	public void addGood()
	{
		_good++;
	}
	
	public byte getGood()
	{
		return _good;
	}
	
	@Override
	public void reduceCurrentHp(double damage, final L2Character attacker, final boolean awake)
	{
		if (!attacker.getName().equalsIgnoreCase(getOwner()))
		{
			damage = 0;
		}
		if (getTemplate().npcId == 12778 || getTemplate().npcId == 12779)
			if (attacker.getActiveWeaponInstance().getItemId() == 4202 || attacker.getActiveWeaponInstance().getItemId() == 5133 || attacker.getActiveWeaponInstance().getItemId() == 5817 || attacker.getActiveWeaponInstance().getItemId() == 7058)
			{
				super.reduceCurrentHp(damage, attacker, awake);
			}
			else if (damage > 0)
			{
				damage = 0;
			}
		super.reduceCurrentHp(damage, attacker, awake);
	}
}

Edited by haskovo
  • 0
Posted (edited)

Well as I said it's supposed to be an event type. Dunno why on L2JFrozen they're implemented like that. And that instance doesn't control that aspect. Search for the event or the itemhandler/skillhandler which spawns such L2GourdInstance.

Edited by Tryskell
  • 0
Posted

i found only this but i think is not what we looking :C 

/*
 * L2jFrozen Project - www.l2jfrozen.com 
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */

package com.l2jfrozen.gameserver.handler.itemhandlers;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.datatables.csv.SummonItemsData;
import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
import com.l2jfrozen.gameserver.handler.IItemHandler;
import com.l2jfrozen.gameserver.idfactory.IdFactory;
import com.l2jfrozen.gameserver.model.L2Skill;
import com.l2jfrozen.gameserver.model.L2SummonItem;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance.SkillDat;
import com.l2jfrozen.gameserver.model.actor.instance.L2PetInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
import com.l2jfrozen.gameserver.model.entity.event.CTF;
import com.l2jfrozen.gameserver.model.entity.event.DM;
import com.l2jfrozen.gameserver.model.entity.event.TvT;
import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillLaunched;
import com.l2jfrozen.gameserver.network.serverpackets.PetInfo;
import com.l2jfrozen.gameserver.network.serverpackets.Ride;
import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;

public class SummonItems implements IItemHandler
{
	@Override
	public void useItem(final L2PlayableInstance playable, final L2ItemInstance item)
	{
		if (!(playable instanceof L2PcInstance))
			return;
		
		L2PcInstance activeChar = (L2PcInstance) playable;
		
		if (!activeChar.getFloodProtectors().getItemPetSummon().tryPerformAction("summon pet"))
		{
			playable.sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
		
		// if(activeChar._inEventTvT && TvT._started && !Config.TVT_ALLOW_SUMMON)
		if (activeChar._inEventTvT && TvT.is_started() && !Config.TVT_ALLOW_SUMMON)
		{
			final ActionFailed af = ActionFailed.STATIC_PACKET;
			activeChar.sendPacket(af);
			return;
		}
		
		// if(activeChar._inEventDM && DM._started && !Config.DM_ALLOW_SUMMON)
		if (activeChar._inEventDM && DM.is_started() && !Config.DM_ALLOW_SUMMON)
		{
			final ActionFailed af = ActionFailed.STATIC_PACKET;
			activeChar.sendPacket(af);
			return;
		}
		
		// if(activeChar._inEventCTF && CTF._started && !Config.CTF_ALLOW_SUMMON)
		if (activeChar._inEventCTF && CTF.is_started() && !Config.CTF_ALLOW_SUMMON)
		{
			final ActionFailed af = ActionFailed.STATIC_PACKET;
			activeChar.sendPacket(af);
			return;
		}
		
		if (activeChar.isSitting())
		{
			activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_MOVE_SITTING));
			return;
		}
		
		if (activeChar.isParalyzed())
		{
			activeChar.sendMessage("You Cannot Use This While You Are Paralyzed");
			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
		
		if (activeChar.inObserverMode())
			return;
		
		if (activeChar.isInOlympiadMode())
		{
			activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
			return;
		}
		
		L2SummonItem sitem = SummonItemsData.getInstance().getSummonItem(item.getItemId());
		
		if ((activeChar.getPet() != null || activeChar.isMounted()) && sitem.isPetSummon())
		{
			activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ALREADY_HAVE_A_PET));
			return;
		}
		
		// Like L2OFF you can't summon pet in combat
		if (activeChar.isAttackingNow() || activeChar.isInCombat())
		{
			activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_SUMMON_IN_COMBAT));
			return;
		}
		
		if (activeChar.isCursedWeaponEquiped() && sitem.isPetSummon())
		{
			activeChar.sendPacket(new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE));
			return;
		}
		
		final int npcID = sitem.getNpcId();
		
		if (npcID == 0)
			return;
		
		L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(npcID);
		
		if (npcTemplate == null)
			return;
		
		switch (sitem.getType())
		{
			case 0: // static summons (like christmas tree)
				try
				{
					L2Spawn spawn = new L2Spawn(npcTemplate);
					
					// if(spawn == null)
					// return;
					
					spawn.setId(IdFactory.getInstance().getNextId());
					spawn.setLocx(activeChar.getX());
					spawn.setLocy(activeChar.getY());
					spawn.setLocz(activeChar.getZ());
					L2World.getInstance().storeObject(spawn.spawnOne());
					activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
					activeChar.sendMessage("Created " + npcTemplate.name + " at x: " + spawn.getLocx() + " y: " + spawn.getLocy() + " z: " + spawn.getLocz());
					spawn = null;
				}
				catch (final Exception e)
				{
					if (Config.ENABLE_ALL_EXCEPTIONS)
						e.printStackTrace();
					
					activeChar.sendMessage("Target is not ingame.");
				}
				
				break;
			case 1: // pet summons
				activeChar.setTarget(activeChar);
				// Skill 2046 used only for animation
				final L2Skill skill = SkillTable.getInstance().getInfo(2046, 1);
				activeChar.useMagic(skill, true, true);
				activeChar.sendPacket(new SystemMessage(SystemMessageId.SUMMON_A_PET));
				ThreadPoolManager.getInstance().scheduleGeneral(new PetSummonFinalizer(activeChar, npcTemplate, item), 4800);
				
				break;
			case 2: // wyvern
				if (!activeChar.disarmWeapons())
					return;
				
				final Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, sitem.getNpcId());
				activeChar.sendPacket(mount);
				activeChar.broadcastPacket(mount);
				activeChar.setMountType(mount.getMountType());
				activeChar.setMountObjectID(item.getObjectId());
		}
		
		activeChar = null;
		sitem = null;
		npcTemplate = null;
	}
	
	static class PetSummonFeedWait implements Runnable
	{
		private final L2PcInstance _activeChar;
		private final L2PetInstance _petSummon;
		
		PetSummonFeedWait(final L2PcInstance activeChar, final L2PetInstance petSummon)
		{
			_activeChar = activeChar;
			_petSummon = petSummon;
		}
		
		@Override
		public void run()
		{
			try
			{
				if (_petSummon.getCurrentFed() <= 0)
				{
					_petSummon.unSummon(_activeChar);
				}
				else
				{
					_petSummon.startFeed(false);
				}
			}
			catch (final Throwable e)
			{
				if (Config.ENABLE_ALL_EXCEPTIONS)
					e.printStackTrace();
			}
		}
	}
	
	static class PetSummonFinalizer implements Runnable
	{
		private final L2PcInstance _activeChar;
		private final L2ItemInstance _item;
		private final L2NpcTemplate _npcTemplate;
		
		PetSummonFinalizer(final L2PcInstance activeChar, final L2NpcTemplate npcTemplate, final L2ItemInstance item)
		{
			_activeChar = activeChar;
			_npcTemplate = npcTemplate;
			_item = item;
		}
		
		@Override
		public void run()
		{
			try
			{
				final SkillDat skilldat = _activeChar.getCurrentSkill();
				
				if (!_activeChar.isCastingNow() || (skilldat != null && skilldat.getSkillId() != 2046))
					return;
				
				_activeChar.sendPacket(new MagicSkillLaunched(_activeChar, 2046, 1));
				
				// check for summon item validity
				if (_item == null || _item.getOwnerId() != _activeChar.getObjectId() || _item.getLocation() != L2ItemInstance.ItemLocation.INVENTORY)
					return;
				
				final L2PetInstance petSummon = L2PetInstance.spawnPet(_npcTemplate, _activeChar, _item);
				
				if (petSummon == null)
					return;
				
				petSummon.setTitle(_activeChar.getName());
				
				if (!petSummon.isRespawned())
				{
					petSummon.setCurrentHp(petSummon.getMaxHp());
					petSummon.setCurrentMp(petSummon.getMaxMp());
					petSummon.getStat().setExp(petSummon.getExpForThisLevel());
					petSummon.setCurrentFed(petSummon.getMaxFed());
				}
				
				petSummon.setRunning();
				
				if (!petSummon.isRespawned())
				{
					petSummon.store();
				}
				
				_activeChar.setPet(petSummon);
				
				L2World.getInstance().storeObject(petSummon);
				petSummon.spawnMe(_activeChar.getX() + 50, _activeChar.getY() + 100, _activeChar.getZ());
				_activeChar.sendPacket(new PetInfo(petSummon));
				petSummon.startFeed(false);
				_item.setEnchantLevel(petSummon.getLevel());
				
				if (petSummon.getCurrentFed() <= 0)
				{
					ThreadPoolManager.getInstance().scheduleGeneral(new PetSummonFeedWait(_activeChar, petSummon), 60000);
				}
				else
				{
					petSummon.startFeed(false);
				}
				
				petSummon.setFollowStatus(true);
				petSummon.setShowSummonAnimation(false);
				petSummon.broadcastStatusUpdate();
			}
			catch (final Throwable e)
			{
				if (Config.ENABLE_ALL_EXCEPTIONS)
					e.printStackTrace();
			}
		}
	}
	
	@Override
	public int[] getItemIds()
	{
		return SummonItemsData.getInstance().itemIDs();
	}
}
  • 0
Posted

1) Create a boolean property that handles the spawn status.

2) Create its getter and setter methods.

3) On spawn first check via the getter if the property isn't set to true... if it is - send an message for fail, if it's not - spawn it and use the setter to set the property to true, so when someone who already have a spawned egg, will get the fail message. When the owner kill the egg, use again the setter to set the property back to false.

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

    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server!  Create your free account here
    • PERFECT PERSPECTIVE IS ALMOST ALWAYS A DEATH SENTENCE ▪ Think if the document lies perfectly flat and everything is “level” it’ll be fine? Most of the time, that’s exactly what gives away the fake. Real smartphones, especially wide-angle cameras, always add natural distortions: - Slight warping at the edges of the document - Perspective distortions in the corners - Light curvature of the plane due to distance and shooting angle When everything is perfectly flat and geometrically flawless — algorithms and verifiers immediately recognize a “staged scene.” ▪ A genuine shot is never mathematically perfect. It’s these small lens distortions that make the frame look alive and believable.  Want perspective that won’t raise questions even from the most demanding verifiers? Write to us — we’ll create geometry that looks like it was shot with a real phone in real conditions. › TG: @mustang_service_ms ( https:// t.me/ mustang_service_ms ) › Channel: Mustang Service ( https:// t.me/ +JPpJCETg-xM1NjNl ) #documents #drawing #perspective #editing #geometry
    • Gemini Pro 18 Month Personal Gmail Upgrade Available We are now accepting new orders for Gemini Pro + Google One AI Pro 18 Month Plan.   Plan Details: ✅ 18 Months Validity ✅ Upgrade on Your Personal Gmail ✅ 5TB Google One Storage ✅ Gemini Pro / Google AI Pro Access ✅ Veo 3, NotebookLM, Google AI Features ✅ Family Sharing Support where available ✅ Fast Delivery: 10 minutes to 24 hours ✅ 24/7 KloudItem Support   Price: $15 One Time Payment   Important: Stock is limited, so please check availability before ordering.   Order & Support: Order from KloudItem or contact us through our official support channel. ------------------------------------------- CONTACT Order Here: BUY GEMINI PRO Email: support@klouditem.com Telegram Channel: @klouditemcom Telegram Support: klouditem All Contact: https://linktr.ee/klouditem Website: https://klouditem.com Hours: 24/7 -- Always online
    • Hello everyone,   A quick update from the Emerge team. The official launch of Emerge Eclipse x10 is just around the corner and we are currently finishing the final preparations to ensure a smooth and stable opening for all players. Our team has been working on performance improvements, network optimizations, and additional infrastructure to provide the best possible experience from day one.   🚀 Launch Date: 7 June 2026 🕕 Launch Time: 18:00 CET We would like to invite everyone to join our Discord community where all announcements, updates, events, and support information are posted first. 🌐 Website: https://l2emerge.com 💬 Discord: https://discord.gg/l2emerge Thank you for all the support and feedback during the preparation phase. We look forward to seeing both new and veteran Lineage II players on launch day. See you soon on Emerge!
  • 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..