Page 1 of 1

Creating Voicecommand

Posted: Thu Apr 05, 2012 11:03 am
by Asthena
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:

Ive built off the Clan Leader script here in forums,
And corrected as asked thru consul but now dont give me errors but wont load.
anyone give a hand?

Code: Select all

    package com.l2jserver.gameserver.handlers.voicedcommandhandlers;     import com.l2jserver.gameserver.handler.IVoicedCommandHandler;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;           public class Party implements IVoicedCommandHandler{         private static final String[]_voicedCommands = {"mypt"};                public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)        {            if (command.startsWith("mypt"))            {                    L2PcInstance leader = null;                    if (activeChar.getParty() != null)                    leader = activeChar.getParty().getLeader();                        else                         {                    activeChar.sendMessage("You don't have a Party..");                    return false;                }                     if (leader.isInOlympiadMode() || leader.isTeleporting() || leader.isInCombat() || leader.isInJail() || leader.isFlying() || leader.isIn7sDungeon())                {            activeChar.sendMessage("You cannot teleport to your leader now");                    return false;                }                     int leaderX = leader.getX();                int leaderY = leader.getY();                int leaderZ = leader.getZ();                     activeChar.sendMessage("You are teleporting to your Party leader");                activeChar.teleToLocation(leaderX, leaderY, leaderZ);                leader.sendMessage(activeChar.getName() + " is teleporting to you.");            }            return true;        }             public String[] getVoicedCommandList()        {            return _voicedCommands;        }}        

Re: Creating Voicecommand

Posted: Thu Apr 05, 2012 1:38 pm
by tukune
:evil: package com.l2jserver.gameserver.handlers.voicedcommandhandlers;
:D package handlers.voicedcommandhandlers;

Have you add to MasterHandler.java?

Re: Creating Voicecommand

Posted: Thu Apr 05, 2012 2:15 pm
by Asthena
Yes I have, I'm at work now but I've added to corresponding place.
***** party;

If I have it open on master on restart it won't load any handlers.
So ill void until loaded then unvoid and load thru server.

Re: Creating Voicecommand

Posted: Fri Apr 06, 2012 5:13 pm
by Starter

Re: Creating Voicecommand

Posted: Mon Nov 04, 2013 2:15 pm
by Asthena
Ok so Im Back to Playing Again,
I Have Reinstaed this Command But Its not consuming the item.

Code: Select all

package handlers.voicedcommandhandlers; import com.l2jserver.gameserver.datatables.ItemTable;   import com.l2jserver.gameserver.handler.IVoicedCommandHandler;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;           public class MyPt implements IVoicedCommandHandler{         private static final String[] _voicedCommands = {"mypt"};       @Override           public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)        {             final int neededItemId = 3484; // 3484 = gold giant            final int neededItemCount = 5;             if (command.startsWith("mypt"))            {                    L2PcInstance leader = null;                    if (activeChar.getParty() != null)                    leader = activeChar.getParty().getLeader();                       else                        {                    activeChar.sendMessage("You don't have a Party..");                    return false;                }                     if (leader.isInOlympiadMode() || leader.isTeleporting() || leader.isInJail() || leader.isFlying() || leader.isIn7sDungeon())                {            activeChar.sendMessage("You cannot teleport to your leader now");                    return false;                }                       if (activeChar.getInventory() != null)                       {                               if (activeChar.getInventory().getItemByItemId(neededItemId) == null)                               {                                       activeChar.sendMessage("You need at least " + neededItemCount + " " + ItemTable.getInstance().getTemplate(neededItemId).getName() + " to use this command.");                                       return false;                               }                     int leaderX = leader.getX();                int leaderY = leader.getY();                int leaderZ = leader.getZ();                 activeChar.destroyItem("Consume", neededItemId, 5, null, false);                activeChar.sendMessage("You are teleporting to your Party Leader");                activeChar.teleToLocation(leaderX, leaderY, leaderZ);                leader.sendMessage(activeChar.getName() + " is teleporting to you.");            }            }                return true;        }    @Override             public String[] getVoicedCommandList()        {            return _voicedCommands;        }}   
Please Help

Re: Creating Voicecommand

Posted: Tue Nov 05, 2013 11:16 pm
by tukune
:evil: activeChar.destroyItem("Consume", neededItemId, 5, null, false);
:D activeChar.destroyItemByItemId("Consume", neededItemId, 5, null, false);

Re: Creating Voicecommand

Posted: Wed Nov 06, 2013 12:21 pm
by Asthena
That did the trick, Ty JoJo
+100 For JoJo