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.


×
×
  • Create New...