Jump to content

[Share] Pres on a item and spawn a mob

Recommended Posts


* 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 net.sf.l2j.gameserver.handler.itemhandlers;


import net.sf.l2j.gameserver.ThreadPoolManager;

import net.sf.l2j.gameserver.datatables.NpcTable;

import net.sf.l2j.gameserver.handler.IItemHandler;

import net.sf.l2j.gameserver.idfactory.IdFactory;

import net.sf.l2j.gameserver.model.L2ItemInstance;

import net.sf.l2j.gameserver.model.L2Spawn;

import net.sf.l2j.gameserver.model.L2World;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;

import net.sf.l2j.gameserver.network.SystemMessageId;

import net.sf.l2j.gameserver.serverpackets.SystemMessage;

import net.sf.l2j.gameserver.templates.L2NpcTemplate;



* @author x.v3ndetta@yahoo.com



public class VendettaItem implements IItemHandler


public class DeSpawnScheduleTimerTask implements Runnable


L2Spawn spawnedPlant = null;


public DeSpawnScheduleTimerTask(L2Spawn spawn)


spawnedPlant = spawn;



public void run()





} catch (Throwable t)






private static int[] _itemIds = { 6391 };

private static int[] _npcIds = { 18342 };

private static int[] _npcLifeTime = { 20000 };


public void useItem(L2PlayableInstance playable, L2ItemInstance item)


L2PcInstance activeChar = (L2PcInstance) playable;

L2NpcTemplate template1 = null;

int lifeTime = 0;

int itemId = item.getItemId();

for (int i = 0; i < _itemIds.length; i++)


if (_itemIds == itemId)


template1 = NpcTable.getInstance().getTemplate(_npcIds);

lifeTime = _npcLifeTime;




if (template1 == null)




L2Spawn spawn = new L2Spawn(template1);






ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(spawn), lifeTime);

activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);

} catch (Exception e)


SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);

sm.addString("Exception in useItem() of VendettaItem.java");





public int[] getItemIds()


return _itemIds;




Credits: me !

Item: Pollen

Mob: Gremlin


Link to comment
Share on other sites

  • 5 months later...
This topic is now closed to further replies.

  • Posts

    • Probably this error occurred because of your game client.. use clean client and try it again.
    • 2023.6.1 17:12:40 OS : Windows Vista 6.2 (Build: 9200) CPU : AuthenticAMD Unknown processor @ 4404 MHz with 2047MB RAM Video : AMD Radeon RX 6700 XT (1012) General protection fault! History: UStruct::SerializeBin <- (Class Engine.ShadowBitmapMaterial ShadowActor[0]) <- UObject::Serialize <- (ShadowBitmapMaterial Transient.ShadowBitmapMaterial107) <- TestReach <- (ShadowBitmapMaterial Transient.ShadowBitmapMaterial107) <- UStruct::SerializeBin <- (Class Engine.ShadowProjector ShadowTexture[0]) <- UObject::Serialize <- (ShadowProjector 19_23.ShadowProjector267) <- AActor::Serialize <- TestReach <- (ShadowProjector 19_23.ShadowProjector267) <- ULevelBase::Serialize <- ULevel::Serialize <- TestReach <- (Level 19_23.myLevel) <- UStruct::SerializeBin <- (Class Engine.GameEngine GLevel[0]) <- UObject::Serialize <- (GameEngine Transient.GameEngine0) <- UGameEngine::Serialize <- (GameEngine Transient.GameEngine0) <- UGameEngine::Serialize <- (GameEngine Transient.GameEngine0) <- TestReach <- (GameEngine Transient.GameEngine0) <- TArray<< <- UGameEngine::L2SerializeRootSet <- UGameEngine::L2CollectGarbage <- UGameEngine::DetachLevel <- UGameEngine::CheckPurgeLevel <- Level_was_loaded <- UGameEngine::L2_Teleport <- UGameEngine::Tick <- UpdateWorld <- MainLoop   Hello, during the character respawn or teleport on my server, a critical error occurs in the 3rd or 4th try. What could be the main reason for this? I am sharing the error I got.
    • There's something special about sipping a hot beverage from a quality cup or glass. This is exactly the experience that https://mcdonaldpaper.com/coffee-tea-glasses . Their selection of coffee and tea glasses is both wide and impressive. Whether you're looking for something modern or something more traditional, there's something for everyone. The quality of their products and the user-friendly nature of the site make it a must-visit for any coffee or tea lover. 
    • Totally understood. You are right. I am not denying the time and the effort that you guys have poured in learning and developing yourselves as able devs. If I am not a learner then I would have bought a ready solution like korean client worked-out (not sure if there is. I have never tried to look for) Frankly, I have never bought any packs or some stuffs but just been working on a pure pack from l2j by myself. Actually I am not asking you guys to do everything for me. I just looked for a clue to solve my problem. (I am a korean and there is no korean community for l2j developing) I searched this forum for related articles and found some but all the instructions were just from normal users, not devs. They just shared their thoughts or opinions not apt informations. Namely, I could not get any clue for my problem.   Anyways, I already gave up to mod client due to lack of informations and knowleges. Have a good day brother.
  • Topics

  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock