Problem with L2PcInstance.setInsideZone

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Bretonnian
Posts: 24
Joined: Fri Apr 07, 2006 6:39 pm

Problem with L2PcInstance.setInsideZone

Post by Bretonnian »

Hi.
I have a problem with the following code:
File: TvTEventTeleporter.java
Function: Runnable.Run().

Code: Select all

 if (TvTEvent.isStarted()){    player.setInsideZone(L2Character.ZONE_PVP, true);} // Event finished, back to an normal zoneelse {    player.setInsideZone(L2Character.ZONE_PVP, false);}
Don't know why the above code doesn't set the correct zone to the teleported player, sometimes works and sometimes not (i've tried doing thread synchronization, setting this after/before/both teleportto function and still nothing).

PS:I just want to set the player zone using it directly instead making the zones on the xml to do that (or to create a new zone type and just set the area as PVP if the event is active).
User avatar
Tryskell
Posts: 256
Joined: Wed Nov 25, 2009 5:57 pm
Location: France :)

Re: Problem with L2PcInstance.setInsideZone

Post by Tryskell »

Complete error ?

I think there's a reason why setInsideZone(blabla, true) methods are only used in zones types.

The only exception is in HandyBlock, which only remove the zone without add one.

Your error happens at begin, and not at end ?
Bretonnian
Posts: 24
Joined: Fri Apr 07, 2006 6:39 pm

Re: Problem with L2PcInstance.setInsideZone

Post by Bretonnian »

Tryskell wrote:Your error happens at begin, and not at end ?
At the end.
User avatar
Tryskell
Posts: 256
Joined: Wed Nov 25, 2009 5:57 pm
Location: France :)

Re: Problem with L2PcInstance.setInsideZone

Post by Tryskell »

Tryskell wrote:Complete error ?
Bretonnian
Posts: 24
Joined: Fri Apr 07, 2006 6:39 pm

Re: Problem with L2PcInstance.setInsideZone

Post by Bretonnian »

Tryskell wrote:
Tryskell wrote:Complete error ?
There is no "error" here, just calling setInsideZone function directly sometimes work and sometimes not :/.

BTW I finally used the .xml method:

Code: Select all

 public class L2EventZone extends L2ZoneType... @Override    protected void onEnter(L2Character character)    {        if (character instanceof L2PcInstance)        {            if (character.getActingPlayer().isAtEvent)            {                if (_eventType.equals("CTFEvent"))                {                    if (CTFEvent.isStarted())                    {                        character.setInsideZone(L2Character.ZONE_PVP, true);                        character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);                        if (!character.isInsideZone(L2Character.ZONE_PVP))                            ((L2PcInstance) character).sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));                    }                }                                 else if (_eventType.equals("DMEvent"))                {                    if (DMEvent.isStarted())                    {                        character.setInsideZone(L2Character.ZONE_PVP, true);                        character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);                        if (!character.isInsideZone(L2Character.ZONE_PVP))                            ((L2PcInstance) character).sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));                    }                }            }        }    }
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Problem with L2PcInstance.setInsideZone

Post by UnAfraid »

lol ?
why u dont activate event in instance the instance is pvp at all
Image
Post Reply