Skip to content

Java question, npc click

Featured Replies

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();

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.