Page 1 of 1

[Help] Peace Zone Issue

Posted: Thu Jun 17, 2010 9:37 pm
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

Re: [Help] Peace Zone Issue

Posted: Fri Jun 18, 2010 6:24 am
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.

Re: [Help] Peace Zone Issue

Posted: Sun Jun 20, 2010 2:22 pm
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

Re: [Help] Peace Zone Issue

Posted: Sun Jun 20, 2010 3:34 pm
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.

Re: [Help] Peace Zone Issue

Posted: Sun Jun 20, 2010 10:16 pm
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