Page 1 of 1

Problem with L2PcInstance.setInsideZone

Posted: Mon Feb 21, 2011 7:08 pm
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).

Re: Problem with L2PcInstance.setInsideZone

Posted: Sun Feb 27, 2011 4:55 pm
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 ?

Re: Problem with L2PcInstance.setInsideZone

Posted: Mon Feb 28, 2011 2:04 pm
by Bretonnian
Tryskell wrote:Your error happens at begin, and not at end ?
At the end.

Re: Problem with L2PcInstance.setInsideZone

Posted: Tue Mar 01, 2011 8:15 am
by Tryskell
Tryskell wrote:Complete error ?

Re: Problem with L2PcInstance.setInsideZone

Posted: Tue Mar 08, 2011 8:46 pm
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));                    }                }            }        }    }

Re: Problem with L2PcInstance.setInsideZone

Posted: Wed Mar 09, 2011 10:56 pm
by UnAfraid
lol ?
why u dont activate event in instance the instance is pvp at all