Objectives - MarkusBordihn/BOs-Easy-NPC GitHub Wiki

Objectives 🎯

Give your NPCs a purpose and define their behavior with the powerful Objectives screen. Whether it's simple actions or complex behaviors, you can shape how your NPCs interact with the world. Just keep in mind that some objectives might affect performance.

Basic Objectives 🚶‍♂️

Set up essential actions and movements for your NPCs.

Basic Objectives screen

Here are some basic objectives you can assign:

  • Random Stroll: The NPC wanders aimlessly.
  • Return Home: The NPC goes back to its home or spawn point.
  • Water-Avoiding Stroll: The NPC wanders but stays away from water.
  • Village Walk: The NPC moves through the village.
  • Stay in Village: The NPC stays close to the village or returns there.
  • Village Stroll: The NPC randomly strolls within the village.
  • Random Swim: The NPC swims around unpredictably.
  • Panic Run: The NPC runs in a panic when hurt or attacked.
  • Avoid Sun: The NPC seeks shade to escape the sun.
  • Flee from Sun: The NPC tries to escape sunlight.

Follow Objectives 🚶‍♂️➡️🚶

Direct your NPC to follow specific targets with these objectives.

Follow Objectives screen

Follow Owner

The NPC follows its owner when they are online and within a certain range.

Follow Player

The NPC follows a designated player when they are online and within a certain range.

Follow Entity by UUID

The NPC follows an entity with a specific UUID, which could be anything from another NPC to a mob, as long as it's online and within range.

You can even create NPC chains by setting up a sequence of NPCs to follow each other using their UUIDs.

Follow Entity by UUID screen

You can find and copy the NPC's UUID from its configuration screen.

NPC UUID

Attack Objectives ⚔️

Set your NPC up for battle with attack-specific objectives.

Attack Objectives screen

Some objectives, like ‘Perform Melee Attack’ and ‘Attack Player,’ should be paired for the NPC to behave as intended.

Attack Types

Choose from a variety of attack styles:

  • Melee Attack: The NPC engages in close combat.
  • Zombie Attack: The NPC attacks like a zombie.
  • Crossbow Attack: The NPC uses a crossbow.
  • Bow Attack: The NPC uses a bow.
  • Gun Attack: The NPC uses a gun.

Bow Attack with Modded Bows

You can use bows from mods that extend the vanilla bow item with the Bow Attack objective. If a modded bow doesn’t work, it might not be extending the vanilla bow item. You can try adding it to the bow item tag in the data/easy_npc/tags/items/ranged_weapon/bow.json file.

Example of a bow.json file:

{
  "replace": false,
  "values": [
    "minecraft:bow",
    {
      "id": "spartanweaponry:wooden_longbow",
      "required": false
    },
    {
      "id": "spartanweaponry:leather_longbow",
      "required": false
    }
  ]
}

Crossbow Attack with Modded Crossbows

Modded crossbows that extend the vanilla crossbow item can be used with the Crossbow Attack objective. If a crossbow doesn’t work, it might not be extending the vanilla crossbow item. You can try adding it to the crossbow item tag in the data/easy_npc/tags/items/ranged_weapon/crossbow.json file.

Example of a crossbow.json file:

{
  "replace": false,
  "values": [
    "minecraft:crossbow",
    {
      "id": "spartanweaponry:wooden_crossbow",
      "required": false
    },
    {
      "id": "spartanweaponry:leather_crossbow",
      "required": false
    }
  ]
}

Gun Attack

The Gun Attack objective allows NPCs to use guns from mods, even if they don’t extend a vanilla bow or crossbow. To use this objective, the gun must be added to the gun item tag in the data/easy_npc/tags/items/ranged_weapon/gun.json file.

Example of a gun.json file:

{
  "replace": false,
  "values": [
    {
      "id": "cgm:pistol",
      "required": false
    },
    {
      "id": "tacz:modern_kinetic_gun",
      "required": false
    }
  ]
}

Note: The gun will not use the mod's ammo system and will rely on simple arrows as ammo. Not all guns will work with this objective, as it depends on how the gun is implemented.

Attack Targets

Choose what or who your NPC will attack:

  • Attack Player: The NPC attacks players.
  • Attack Player w/o Owner: The NPC attacks players but ignores its owner.
  • Attack Villager: The NPC targets villagers.
  • Attack Animal: The NPC targets animals.
  • Attack Monster: The NPC targets monsters.
  • Attack Mob: The NPC targets any mob.
  • Attack Mob w/o Creeper: The NPC attacks any mob except creepers.

Look Objectives 👀

Control what your NPC pays attention to with Look Objectives.

Look Objectives screen

These include:

  • Reset Look At: Resets where the NPC is looking at a set time, preventing it from staring endlessly.
  • Look Randomly Around: The NPC looks around randomly, great for those with attack objectives.
  • Look at Player: The NPC focuses on players.
  • Look at Mob: The NPC focuses on mobs.
  • Look at Animal: The NPC focuses on animals.