Topic category: User side tutorials
Here is a method to effectively add/declare NBT variables to mob entities that works, especially if you are not going to let them naturally spawn.
- Make a new procedure with the trigger set to "When entity joins the world".
- Then add an If-then clause to test for a particular (custom) mob type you want to declare and initialize NBT variables to. i.e. "is [entitiy] subtype of..."
- Inside the Do clause, use as many "Set [entity] NBT to [NBTtag] to [value]" block(s) you want. This makes NBT variables that are localized and retained (as far as I can tell) to each spawned mob type, individually.
- For multiple mobs, just add another If-then statement (BUT do not nest them!) and add the appropriate NBT variables you want to have.
This means you can add properties via NBT tags specific to each spawned mob entity, as desired, and give them timers, levels, etc. For debugging/testing I added a "Send Chat to all Players" block to make sure its working; there is a small bug in which the trigger is called twice, but since you are only going to declare/initialize the variables, it doesn't hurt anything since they are just set twice to the same thing.
Comments and improvements are welcome.