Jump to content
  • 0

[Help]Weapon Count?


Question

Posted

Hello everyone..

I created a voiced command doing something,and I want to allow it work when the player has in his inv just 1 weapon... I tried this but * , it can't work.. May getCount() works only for etcitem and not for armors - weapons       

 

Here...*

        if(activeChar.getInventory().getItemByItemId(Weapon_ID).getCount() > 1)
        {
            activeChar.sendMessage("works only with 1 weapon");
            return false;
        }

Anybody could help?, thank you in advance

6 answers to this question

Recommended Posts

  • 0
Posted

ummm well but you have for weapon there.

 

you try changing code like this, well maybe I ask some stupid

 

        if(activeChar.getInventory().getItemByItemId(Armor_ID).getCount() > 1)
       {
           activeChar.sendMessage("works only with 1 armor");
           return false;
       }

  • 0
Posted

ummm well but you have for weapon there.

 

you try changing code like this, well maybe I ask some stupid

 

        if(activeChar.getInventory().getItemByItemId(Armor_ID).getCount() > 1)
        {
            activeChar.sendMessage("works only with 1 armor");
            return false;
        }

what do you mean :D?
  • 0
Posted

Its obvious that you can't compare L2ItemInstance with int.

 

Anyway I can hardly understand what do you exactly mean.

 

First of all what exactly is this?

 

Armor_ID

 

int? L2ItemInstance or what?

 

if (player.getInventory().getItemByItemId(10).getCount() > 1)

{

//code

}

 

Something like this works without any problems.

  • 0
Posted

Its obvious that you can't compare L2ItemInstance with int.

 

Anyway I can hardly understand what do you exactly mean.

 

First of all what exactly is this?

 

int? L2ItemInstance or what?

 

Something like this works without any problems.

yes it works but I think it's work only with etcitems... For example with adenas/ancient adenas.. etc.

Not for weapon :S

  • 0
Posted

Answer me first.

 

First of all what exactly is this?

 

int? L2ItemInstance or what?

 

You "think"? Test it ...

  • 0
Posted

Answer me first.

 

You "think"? Test it ...

I didn't try to use int in L2ItemInstance.. I just added weapon_id for my weapon Id..

 

I use it correctly:

if(activeChar.getInventory().getItemByItemId(6621).getCount() > 1)

 

anyway I have already test this.. I created a voiced command that you give an enchanted weapon and automatic you get another enchanted weapon and I wanted to avoid some bugs, so I prefer to add return false; if the player owns >1 weapons

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock