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

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...