Jump to content
  • 0

Java question, npc click


Question

Posted

Hello Dears,

 

Could you tell me how i can create an npc (html),

1st Question) Click on image of item in html window and when you click the image auto wear the item-skin-etc until player restart.

 

2st Question) i want to add line to use the command if is vip , like activeChar.IsVIP

Can you help me where i put this line??

 

public void useItem(Playable playable, ItemInstance item, boolean forceUse)
{
    if (!(playable instanceof Player))
        return;

    Player player = (Player) playable;
    int itemId = item.getItemId();

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

Assume that you already have made a new instance for your npc 

 

its simple onBypassFeedback you will add a check, like

if (player.isVIP() && command.contains("tryme")) 
{
   player.getInventory().equipItemAndRecord(item);
}

then you will make an NpcHtmlMessage with a stringbuilder embedded and do smth like

String button = "<button value=\"Give me the sauce\" action=\"bypass -h tryme\" width=\"50\" height=\"20\" back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
htmContent = htmContent.replace("%buttonTryMe%", button);        		
  

as you can see above in the first example i made a check to handle the action of the button, in the second example we just simply create the button, hope you find it helpful

Edited by Amn3sia

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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