HitTask System Error

Find the proper support area, Saga-Version.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

HitTask System Error

Post 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
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: HitTask System Error

Post by janiii »

so, what code is at L2PcInstance.java:5381 ?
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

Re: HitTask System Error

Post by moooo »

This

Code: Select all

if (getPvpFlag() == 0 && !pk.isGM())
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

Re: HitTask System Error

Post 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);					}				}
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

Re: HitTask System Error

Post by moooo »

Any idea how I could disable this displaying from TvT kills/deaths?
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: HitTask System Error

Post by Stake »

moooo wrote:Any idea how I could disable this displaying from TvT kills/deaths?
What way does it belong to TvT announce?
Image
Image
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

Re: HitTask System Error

Post by moooo »

It announces all the kills in a TvT event. And I would like it if it wouldn't :)
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: HitTask System Error

Post 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. :)
Image
Image
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

Re: HitTask System Error

Post 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?
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: HitTask System Error

Post 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.
Image
Image
adamss
Posts: 71
Joined: Mon Sep 28, 2009 4:51 am

Re: HitTask System Error

Post 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!!!!
moooo
Posts: 130
Joined: Wed Dec 23, 2009 7:25 am

Re: HitTask System Error

Post 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.
Post Reply