Page 1 of 1

Bypass commands from npc to my class

Posted: Sun Oct 05, 2014 1:09 am
by HappyLDE
Hello,

Revisions:
DP: 10449
Server: 6652

I am trying to pass my commands from a npc to enter my instanced zone:

Code: Select all

<a action="bypass -h Quest PvpInstanceManager pvpzone_enter">PVP Instance</a><br>
But nothing happends, nor in console.

My class has the following:

Code: Select all

 public final class PvpInstanceManager extends AbstractNpcAI implements IBypassHandler, IVoicedCommandHandler{        private static final String[] VCOMMANDS = { "pvp_enter", "pvp_leave" };    private static final String[] BCOMMANDS = { "pvpzone_enter", "pvpzone_leave" }; PvpInstanceManager()    {        super(PvpInstanceManager.class.getSimpleName(), PvpInstanceManager.class.getSimpleName());         VoicedCommandHandler.getInstance().registerHandler(this);        BypassHandler.getInstance().registerHandler(this);    } @Override    public boolean useVoicedCommand(final String command, final L2PcInstance activeChar, final String target)    {        // enter (teleport to instance)        if (command.equalsIgnoreCase(PvpInstanceManager.VCOMMANDS[0])) {            teleportPlayerToInstance(activeChar);        }        // leave pvp instance zone        else if (command.equalsIgnoreCase(PvpInstanceManager.VCOMMANDS[1])) {            teleportPlayerOutOfInstance(activeChar);        }                return true;    }     @Override    public boolean useBypass(final String command, final L2PcInstance activeChar, final L2Character target)    {        // enter (teleport to instance)        if (command.equalsIgnoreCase(PvpInstanceManager.BCOMMANDS[0])) {            teleportPlayerToInstance(activeChar);        }        // leave pvp instance zone        else if (command.equalsIgnoreCase(PvpInstanceManager.BCOMMANDS[1])) {            teleportPlayerOutOfInstance(activeChar);        }         return true;    }        @Override    public String[] getVoicedCommandList() {        PvpInstanceManager._log.info(" > Registering voiced commands handlers.");        return PvpInstanceManager.VCOMMANDS;    }     @Override    public String[] getBypassList() {        PvpInstanceManager._log.info(" > Registering bypass handlers.");        return PvpInstanceManager.BCOMMANDS;    }}
The voiced commands work but not the bypass from npc. Any tips?

Re: Bypass commands from npc to my class

Posted: Sun Oct 05, 2014 8:42 am
by Zealar

Code: Select all

<a action="bypass -h npc_%objectId%_PvpInstanceManager pvpzone_enter">PVP Instance</a><br>
Also guess you need to substring the command. Put one System print to see what is comming.

Re: Bypass commands from npc to my class

Posted: Sun Oct 05, 2014 10:41 am
by Sdw
Better leave the link as they are and use onAdvEvent

Re: Bypass commands from npc to my class

Posted: Sun Oct 05, 2014 11:17 am
by HappyLDE
Zealar wrote:

Code: Select all

<a action="bypass -h npc_%objectId%_PvpInstanceManager pvpzone_enter">PVP Instance</a><br>
Also guess you need to substring the command. Put one System print to see what is comming.
Yeah the substring will be a happy step but not yet there :lol:

With your link i get this in console:

Code: Select all

[05/10 11:16:30] L2NpcInstance: Unknown NPC bypass: "PvpInstanceManager pvpzone_enter" NpcId: 10000
I will take a look at onAdvEvent.

Edit: I also added this log output to see if the function gets passed and it is not.

Code: Select all

@Override    public boolean useBypass(final String command, final L2PcInstance activeChar, final L2Character target)    {        PvpInstanceManager._log.info("pvpzone bypass command called");        ...         return true;    }

Re: Bypass commands from npc to my class

Posted: Sun Oct 05, 2014 11:25 am
by UnAfraid
its 'bypass -h npc_%objectId%_Quest scriptName event'

Re: Bypass commands from npc to my class

Posted: Sun Oct 05, 2014 11:32 am
by HappyLDE
UnAfraid wrote:its 'bypass -h npc_%objectId%_Quest scriptName event'
Thanks, i have both and none of them are doing anything:
<a action="bypass -h Quest PvpInstanceManager pvpzone_leave">Teleport Outside</a>
<a action="bypass -h Quest PvpInstanceManager pvpzone_enter">Teleport Inside</a>
<a action="bypass -h npc_%objectId%_Quest PvpInstanceManager pvpzone_leave">PVP leave</a><br>
<a action="bypass -h npc_%objectId%_Quest PvpInstanceManager pvpzone_enter">PVP enter</a>

Edit: Also onAdvEvent is never called either:

Code: Select all

@Override    public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)    {        PvpInstanceManager._log.info("onAdvEvent command called");        ...                return super.onAdvEvent(event, npc, player);    }