Jump to content
  • 0

Question

Posted

I need an NPC with a list of respawn remaining time from Grand Bosses. Can someone help me to make it ?

I have a starting code ready but i need help on npc delegation code.

Recommended Posts

  • 0
Posted

heres an attempt. Dunno if is correct (writted it down with notepad)

class BossDelay extends Quest {

private static final int NPC_ID = 0;
private static final int[] BOSSES = {
	//fill by yourself
}

public BossDelay(int questid, Stirng name, String descr) {
	super(questid, name, descr);
	addFirstTalkId(NPC_ID);
}

public String onFirstTalk(L2Npc npc, L2PcInstance pc) {
	if(npc == null || pc == null)
		return null;

	if(npc.getNpcId() == NPC_ID) {
		sendInfo(pc);
	}
}

private void sendInfo(L2PcInstance activeChar) {
	TextBuilder tb = new TextBuilder();
	tb.append("<html><body><center><br>");

	GrandBossManager manager = GrandBossManager.getInstance();

	for(int boss : BOSSES) {
		String name = manager.getBoss(boss).getName();
		long delay = manager.getStatsSet(boss).getLong("respawn_time");
		String time = new Timestampt(delay).toString();
		tb.append(name + ": "+time+"<br1>");
	}

	tb.append("</center></body></html>");

	NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
	msg.setHtml(tb.toString());
	activeChar.sendPacket(msg);
}
}

  • 0
Posted

Hello BB. Sorry for the delay but just arrived at my home from a work trip.

First of all i want to THANK you verry mutch for everything you do for ALL of us !

Its verry nice attempt to solve the problem and i try to use it tomorow and i give

you the results. Btw as i see with my first meet you have two typos.

First public BossDelay(int questid, Stirng name, String descr) on String and second

String time = new Timestampt(delay).toString(); on Timestamp... (I think the Import is sql part right ?)

Btw we will talk again tomorow about results..

 

Thanks again !

  • 0
Posted

I have some problems with script.... Pls take a look:

package custom.BossRespawn;

import java.sql.Timestamp;

import javolution.text.TextBuilder;

import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;

public class BossRespawn extends Quest {

private static final int NPC_ID = 93000;
private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045, 29066};

public BossRespawn(int questid, String name, String descr) {
	super(questid, name, descr);
	addFirstTalkId(NPC_ID);
}

public String onFirstTalk(L2Npc npc, L2PcInstance pc) {
	if(npc == null || pc == null)
		return null;

	if(npc.getNpcId() == NPC_ID) {
		sendInfo(pc);
	}
	return null;
}

private void sendInfo(L2PcInstance activeChar) {
	TextBuilder tb = new TextBuilder();
	tb.append("<html><body><center><br>");

	GrandBossManager manager = GrandBossManager.getInstance();

	for(int boss : BOSSES) {
		String name = manager.getBoss(boss).getName();
		long delay = manager.getStatsSet(boss).getLong("respawn_time");
		String time = new Timestamp(delay).toString();
		tb.append(name + ": "+time+"<br1>");
	}

	tb.append("</center></body></html>");

	NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
	msg.setHtml(tb.toString());
	activeChar.sendPacket(msg);
}
}

 

And here is what i got when i run it:

Failed executing script: C:\l2jserverTEST\gameserver\data\scripts\custom\BossRespawn\BossRespawn.java. See BossRespawn.java.error.log for details.

 

and here is what i got from error.log:

Error on: C:\l2jserverTEST\gameserver\data\scripts\custom\BossRespawn\BossRespawn.java.error.log

Line: -1 - Column: -1

 

no main method in custom.BossRespawn.BossRespawn

 

What is going on ?

  • 0
Posted

Ok i add main void at the end of script and now is running:

public static void main(String[] args)
{
	new BossRespawn(-1, "BossRespawn", "custom");
}

 

But now i have error on first talk

Here is the error:

C:\l2jserverTEST\gameserver\data\scripts\custom\BossRespawn\BossRespawn.java

java.lang.NullPointerException

        at custom.BossRespawn.BossRespawn.sendInfo(BossRespawn.java:59)

        at custom.BossRespawn.BossRespawn.onFirstTalk(BossRespawn.java:45)

        at com.l2jserver.gameserver.model.quest.Quest.notifyFirstTalk(Quest.java:464)

        at handlers.actionhandlers.L2NpcAction.action(L2NpcAction.java:137)

        at com.l2jserver.gameserver.model.actor.L2Character.onAction(L2Character.java:2445)

        at com.l2jserver.gameserver.model.L2Object.onAction(L2Object.java:264)

        at com.l2jserver.gameserver.network.clientpackets.Action.runImpl(Action.java:126)

        at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:92)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        at java.lang.Thread.run(Unknown Source)

 

Any idea ?

  • 0
Posted

RaidBossSpawnManager manager = RaidBossSpawnManager.getInstance();

 

String name = manager.getBossInstance(boss).getName();

 

lol wrong

RaidBossSpawnManager take data from raidboss_spawnlist, grand bosses are not added into that table

  • 0
Posted

Well finaly i change some things and almost working...

private void sendInfo(L2PcInstance activeChar)
{
	TextBuilder tb = new TextBuilder();
	tb.append("<html><body><center><br>");

	for(int boss : BOSSES)
	{
		String name = NpcTable.getInstance().getTemplate(boss).getName();
		long delay = GrandBossManager.getInstance().getStatsSet(boss).getLong("respawn_time");
		String time = new Timestamp(delay).toString();
		tb.append(name + ": "+time+"<br1>");
	}

	tb.append("</center></body></html>");

	NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
	msg.setHtml(tb.toString());
	activeChar.sendPacket(msg);
}

 

So we are in good way to complete it...

So now we need a check and if its allready spawned to say "Alive"

Also this script is show when the boss become alive and we need i think the remaining time

to be alive

So lets complete it guys !

  • 0
Posted

L2NpcInstance npcul = RaidBossSpawnManager.getInstance().getBosses().get(npcId);

if (npcul == null) //means DEAD

{

    //yourcode

}

Guest
This topic is now closed to further replies.


  • Posts

    • you can use my share Dress me item  
    • I haven't played L2 in many years but was recently talking to some old friends from back in the day (supreme / azure, paradise) and we thought we would try playing together again. Checked out official and it has went full on P2W and bot infested, not interested. Private servers seem to be pretty volatile and the community fragmented, we have not been able to find a server or community that has the right vibe.   So us old farts decided why the hell not build our own server and see if we can pull in some of those old day vibes and magic, maybe get a good community built. Maybe that magic is gone forever, that comraderie that we shared in the old days. But I think it is likely there is a lot of players out there just like our little group from the old days that made lifelong friendships in all those 100s and 1000s of hours we spent together in the game together.   I have reached out to some developer friends from back in the day and have one that has come on board, probably one of the most OG OFF devs out there, pretty stoked about that, he never stopped L2 developing for all these years, wild. I can't think of too many other games that evoke such loyalty and love of the game.   So, the choice has been made, and the journey begins. We have really solid and battle tested H5 files so we will roll with those. We are not using any pack with locked down extender, we have all the flexibility we need to make changes, fixes, add features, etc. Also have a great antibot and box limiting system as well as active GMs so bots impact should be pretty min imal. Do have some features that we will be adding but I'll keep those under my hat.      What do you guys think, you think there is enough of that old-school magic left out there to have a server and community of the old days?
    • We create legends in the dark, leading the light into the worlds Base - l2jmobius Chronicles HIGH-FIVE     https://gitea.com/Debug/ShadowCraftCore
    • We create legends in the dark, leading the light into the worlds Base - l2jmobius Chronicles HIGH-FIVE     https://gitea.com/Debug/ShadowCraftCore
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
  • 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