Page 1 of 1

HitTask System Error

Posted: Tue Feb 02, 2010 8:16 am
by moooo
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number: 3837
L2JDP Revision Number: 6876

So I've added this PVP/PK announce system in my L2PcInstance.java

Code: Select all

if (killer != null)		{			L2PcInstance pk = killer.getActingPlayer(); 			TvTEvent.onKill(killer, this); 			if (atEvent && pk != null)			{				pk.kills.add(getName());			} 			 [color=#80BF00]//announce pvp/pk[/color]			if (Config.ANNOUNCE_PK_PVP)			{				String msg = "";				if (getPvpFlag() == 0 && !pk.isGM())				{					msg = pk.getName() + " has slaughtered " + getName()+ " somewhere around " + MapRegionTable.getInstance().getClosestTownName(this);					if (Config.ANNOUNCE_PK_PVP_NORMAL_MESSAGE)					{						SystemMessage sm = new SystemMessage(SystemMessageId.S1);						sm.addString(msg);						Announcements.getInstance().announceToAll(sm);					}					else							Announcements.getInstance().announceToAll(msg);				}				else if (getPvpFlag() != 0 && !pk.isGM())				{					msg = pk.getName() + " has defeated " + getName();					if (Config.ANNOUNCE_PK_PVP_NORMAL_MESSAGE)					{						SystemMessage sm = new SystemMessage(SystemMessageId.S1);						sm.addString(msg);						Announcements.getInstance().announceToAll(sm);					}					else						Announcements.getInstance().announceToAll(msg);				}			} 			// Clear resurrect xp calculation			setExpBeforeDeath(0); 

And now I'm getting these errors popping up constantly. Any idea what I did incorrectly?

Code: Select all

Failed executing HitTask.java.lang.NullPointerException        at net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.doDie(L2PcInstance.java:5381)        at net.sf.l2j.gameserver.model.actor.status.PcStatus.reduceHp(PcStatus.java:218)        at net.sf.l2j.gameserver.model.actor.status.PcStatus.reduceHp(PcStatus.java:56)        at net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.reduceCurrentHp(L2PcInstance.java:11123)        at net.sf.l2j.gameserver.model.actor.L2Character.onHitTimer(L2Character.java:5237)        at net.sf.l2j.gameserver.model.actor.L2Character$HitTask.run(L2Character.java:2499)        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)        at java.util.concurrent.FutureTask.run(Unknown Source)        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)        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)  java.lang.NullPointerException        at net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.doDie(L2PcInstance.java:5381)        at net.sf.l2j.gameserver.model.actor.status.PcStatus.reduceHp(PcStatus.java:218)        at net.sf.l2j.gameserver.model.actor.status.PcStatus.reduceHp(PcStatus.java:56)        at net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.reduceCurrentHp(L2PcInstance.java:11123)        at handlers.skillhandlers.Mdam.useSkill(Unknown Source)        at net.sf.l2j.gameserver.model.actor.L2Character.callSkill(L2Character.java:6453)        at net.sf.l2j.gameserver.model.actor.L2Character.onMagicHitTimer(L2Character.java:6160)        at net.sf.l2j.gameserver.model.actor.L2Character$MagicUseTask.run(L2Character.java:2536)        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)        at java.util.concurrent.FutureTask.run(Unknown Source)        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)        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 help is appreciated! Thanks

Re: HitTask System Error

Posted: Tue Feb 02, 2010 8:20 am
by janiii
so, what code is at L2PcInstance.java:5381 ?

Re: HitTask System Error

Posted: Tue Feb 02, 2010 8:29 am
by moooo
This

Code: Select all

if (getPvpFlag() == 0 && !pk.isGM())

Re: HitTask System Error

Posted: Tue Feb 02, 2010 9:35 am
by moooo
This seemed to do the trick. Thanks for responding so hastily however janiii :)

Code: Select all

//announce pvp/pk			if (Config.ANNOUNCE_PK_PVP && pk != null && !pk.isGM())			{				String msg = "";				if (getPvpFlag() == 0)				{					msg = Config.ANNOUNCE_PK_MSG.replace("$killer", pk.getName()).replace("$target", getName()).replace("$region", MapRegionTable.getInstance().getClosestTownName(this));					if (Config.ANNOUNCE_PK_PVP_NORMAL_MESSAGE)					{						SystemMessage sm = new SystemMessage(SystemMessageId.S1);						sm.addString(msg);						Announcements.getInstance().announceToAll(sm);					}					else							Announcements.getInstance().announceToAll(msg);				}				else if (getPvpFlag() != 0)				{					msg = Config.ANNOUNCE_PVP_MSG.replace("$killer", pk.getName()).replace("$target", getName());					if (Config.ANNOUNCE_PK_PVP_NORMAL_MESSAGE)					{						SystemMessage sm = new SystemMessage(SystemMessageId.S1);						sm.addString(msg);						Announcements.getInstance().announceToAll(sm);					}					else						Announcements.getInstance().announceToAll(msg);					}				}

Re: HitTask System Error

Posted: Wed Feb 03, 2010 12:14 am
by moooo
Any idea how I could disable this displaying from TvT kills/deaths?

Re: HitTask System Error

Posted: Wed Feb 03, 2010 2:05 am
by Stake
moooo wrote:Any idea how I could disable this displaying from TvT kills/deaths?
What way does it belong to TvT announce?

Re: HitTask System Error

Posted: Wed Feb 03, 2010 2:11 am
by moooo
It announces all the kills in a TvT event. And I would like it if it wouldn't :)

Re: HitTask System Error

Posted: Wed Feb 03, 2010 3:03 am
by Stake
moooo wrote:It announces all the kills in a TvT event. And I would like it if it wouldn't :)
So you're talking not about PVP/PK announce, but only about TvT. :)
You can modify the calculateRewards() at line 269 in com/l2jserver/gameserver/model/entity/TvTEvent.java. calculateRewards() returns a String containing the announcement text, so you just add a config for that. :)

Re: HitTask System Error

Posted: Wed Feb 03, 2010 3:48 am
by moooo
Hmm, but I'm not wanting it to announce. It already does that. I don't want the TvT event to announce it's kills globally as the script does. Or am I confused?

Re: HitTask System Error

Posted: Wed Feb 03, 2010 3:58 am
by Stake
moooo wrote:Hmm, but I'm not wanting it to announce. It already does that. I don't want the TvT event to announce it's kills globally as the script does. Or am I confused?
I mean you just add an if condition at the bottom of calculateRewards to switch off (make it return null) the announce, then you find the place the calculateRewards is used, and also add a line to check if it's null. If so, then don't let the announce function to do its stuff.

Re: HitTask System Error

Posted: Wed Feb 03, 2010 4:06 am
by adamss
If you dont want to announce the kills at the end of TvT event, go to TvTEvent.java, search the CalculateRewards() and simply delete the messages from the returns.

if you dont want to announce if a player kill another player, than delete this line:

CreatureSay cs = new CreatureSay(killerPlayerInstance.getObjectId(), Say2.TELL, killerPlayerInstance.getName(), "Megoltem " + killedPlayerInstance.getName() + "-t!"); //the language of message is hungarian!!!!

Re: HitTask System Error

Posted: Wed Feb 03, 2010 6:17 am
by moooo
I guess I'm confused.
@adamss: I'm talking about the script I'm using above, it announces all pvps/pks to all players globally. However, it also spams the TvT event kills to everyone. I don't want it to.

I guess this this is too advanced for me.