[Help] Peace Zone Issue

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
rychoo84
Posts: 58
Joined: Fri Jan 01, 2010 11:26 am
Location: Breslau

[Help] Peace Zone Issue

Post by rychoo84 »

L2J Revision n/a
L2JDP Revision n/a

Hi everyone,
I have a question regarding peace zones. Before I write down my queries I'll explain in short what I'm willing to do:
Peace zones on various locations (rectangular) The part with DP is not a problem, all I need is to make sure where is the core part responsible for player's behaviour inside the PZ.
I already found class PeaceZone in com.l2jserver.gameserver.model.zone.type and method OnEnter
but if I edit it like this:

Code: Select all

 protected void onEnter(L2Character character)	{		L2PcInstance player = (L2PcInstance)character;		if(player.getPvpFlag() > 0)		{			character.setInsideZone(L2Character.ZONE_PEACE, false);			character.isAutoAttackable(character);		}		else			character.setInsideZone(L2Character.ZONE_PEACE, true);       } 
If I'm not wrong this should work partially - I mean if a flagged player will be inside the PZ others inside the PZ won't be able to hit him and not sure, but after the flag is away he'd be still vulnerable to attacks

I'd be grateful if somebody could direct me into the right path...
Best Regards
Tom
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: [Help] Peace Zone Issue

Post by JIV »

this is for something else :

Code: Select all

character.isAutoAttackable(character);
if you set as character not in peace zone he will be able to attack only player which are not in PZ also - flagged only.
User avatar
rychoo84
Posts: 58
Joined: Fri Jan 01, 2010 11:26 am
Location: Breslau

Re: [Help] Peace Zone Issue

Post by rychoo84 »

Trying to do it that way:
In the L2Character class added this to the boolean isInsidePeaceZone(L2Object attacker, L2Object target) method:

Code: Select all

 // allows flagged players to be attacked and red to attack flagged playersif (target.getActingPlayer() != null && target.getActingPlayer().getPvpFlag() > 0)	return false;if (attacker.getActingPlayer() != null && attacker.getActingPlayer().getKarma() > 0 && target.getActingPlayer() != null && target.getActingPlayer().getPvpFlag() > 0)	return false; 
Still not working, what did I forget? Do I have to check for the attacker and target inside the OnEnter method in L2PeaceZone class? If yes, could someone give me a hint how to define attacker and target there and how to check their action?
Thx in advance
Tom
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: [Help] Peace Zone Issue

Post by JIV »

well, isInPeaceZone() is used in many places, on most of them not needed. best way to find them all is add breakpoint to sending ActionFailed packet to get stack from where is attack canceled and simulate your situation.
User avatar
rychoo84
Posts: 58
Joined: Fri Jan 01, 2010 11:26 am
Location: Breslau

Re: [Help] Peace Zone Issue

Post by rychoo84 »

hmmm
Look at this code please (that above one is analogous with that one from l2j core, only concerns karma players)

Code: Select all

 if (Config.ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE){	// allows red to be attacked and red to attack flagged players	if (target.getActingPlayer() != null && target.getActingPlayer().getKarma() > 0)		return false;	if (attacker.getActingPlayer() != null && attacker.getActingPlayer().getKarma() > 0	&& target.getActingPlayer() != null && target.getActingPlayer().getPvpFlag() > 0)		return false; 	if (attacker instanceof L2Character && target instanceof L2Character)	{		return (((L2Character)target).isInsideZone(ZONE_PEACE) ||    ((L2Character)attacker).isInsideZone(ZONE_PEACE));	}	if (attacker instanceof L2Character)	{		return (TownManager.getTown(target.getX(), target.getY(), target.getZ()) != null || ((L2Character)attacker).isInsideZone(ZONE_PEACE));	}} 
I'm wondering why the same stuff doesn't work when i check for pvp Flag (instead of karma)

EDIT

OK, It's working now, there was an issue with some (useless) configs, thx for your help, JIV
Post Reply