Making A Multi Mob Mob

Started by ZRandomness on

Topic category: Troubleshooting, bugs, and solutions

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Making A Multi Mob Mob

Currently I'm trying to code a centipede mob and I'm trying to make it act like the Naga(Twilight Forest) or Snake(The Game) where each segment of the body follows behind the first one. The problem is I can only get it to teleport on its parent. I'm using a plugin called Additions (Link: Mod), This allows me to get and set the parent entity. I mainly just need a way to figure out if the parent entity moves then it should move to its past position. I have been working on this for a little while. I just want to know if anybody could help me.

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only way to properly do…
Sun, 02/02/2025 - 23:39

Only way to properly do something like this is to custom code it yourself. Plugins wont get you far enough to make a chain entity

 

What you CAN try is: 

  • Make sure your body entities follow the parent and make sure that is the ONLY AI task
  • Create a global chain variable that counts down each entity/body segment that spawned
  • When the head spawns, it sets the global chain variable to however long you want your entity to be -1
    • If you want your entity to be 5 segments long, set it to 4 to account for the head
  • When the head spawns, you need the following
    • If global chain variable is > 0 spawn another body segment with the parent set to the current segment then set the global variable to current variable - 1
    • Ensure your body segments ONLY use the Follow Parent AI Task and make sure it's speed is equal to the head's speed for the body segment entities
  • If you have a tail segment, set that to spawn at 1 and add no additional spawning features for the tail.
  • Potential issues
    • Due to making this with procedures, you will have numerous issued
    • Health Issue
      • If you wish for your entity to share it's health across all child/parent entities to have the same health, you will need to code this in
      • All segment entities health will be individual unless you find a way with procedures to set the health for all entities
        • Find a way to set all entities parents to the Head segment and direct all damage to the head then set the health of all segments to it's parents health
    • Segment Separation
      • Use Owner instead of Parent for following to better define how close the entity needs to follow its owner
      • If this doesn't work, or if that is not possible with the plugins you use, then you will have no choice but to code all of this yourself.