Creating Voicecommand

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Asthena
Posts: 17
Joined: Mon Jan 02, 2012 4:24 am

Creating Voicecommand

Post 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;        }}        
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: Creating Voicecommand

Post by tukune »

:evil: package com.l2jserver.gameserver.handlers.voicedcommandhandlers;
:D package handlers.voicedcommandhandlers;

Have you add to MasterHandler.java?
Asthena
Posts: 17
Joined: Mon Jan 02, 2012 4:24 am

Re: Creating Voicecommand

Post 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.
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: Creating Voicecommand

Post by Starter »

I have promises to keep and miles to go before I sleep.
Asthena
Posts: 17
Joined: Mon Jan 02, 2012 4:24 am

Re: Creating Voicecommand

Post 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
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: Creating Voicecommand

Post by tukune »

:evil: activeChar.destroyItem("Consume", neededItemId, 5, null, false);
:D activeChar.destroyItemByItemId("Consume", neededItemId, 5, null, false);
Asthena
Posts: 17
Joined: Mon Jan 02, 2012 4:24 am

Re: Creating Voicecommand

Post by Asthena »

That did the trick, Ty JoJo
+100 For JoJo
Post Reply