Skip to content

Untargetable NPC

Featured Replies

Hi, how can I make that players couldn't target some npcs ?

  • Author

Thanks, Tryskell. :)

Thanks, Tryskell. :)

Np, but be aware it will affect every single object using that instance.

 

If you want it affects only a few NPCs (really special NPCs), I invite you to create a new instance extending an existing one, and then to @Override onAction as I said higher.

 

You will have only to edit npc.sql about the type to fit with your new instance.

  • Author

I need only one NPC that would be untargetable, so I can make an instance something like ChristmasTree.java ? :)

I need only one NPC that would be untargetable, so I can make an instance something like ChristmasTree.java ? :)

You can simply hardcode it if there is only one npc affected. That system is generally not a good one, but after all you make your own pack so...

 

if (npc.getNpcId() == blabla)
{
    actionfail
    return
}

 

Instances are in model.actor.instance

Create an account or sign in to comment

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.