Open shawncplus opened 7 years ago
Hmmm, If I recall correctly I suggested something similar to this behavior with mob type inheritance. SO You could have a basic guard mob with the aggro, wander and the guard behaviors. Then you just clone the basic guard three times as the archer, city and gate guard, it comes with the basic stats and behaviors already assigned to basic guard as that would be it's prototype/parent. Then just change the wander areaRestricted on the archer.
@samjaninf this could technically be done right now with no changes necessary by using YAML anchors but I'd rather have it codified than depend on a YAML feature
There are currently 2 tiers of scripting for entities: a script, one-off and specific for a single entity; and behaviors shareable/configurable chunk of code.
The use case for composite behaviors is the following:
I have 3 types of town guard: gate guard, tower archers, and cityguards. I want all guards to wander, I want them all to attack any npc from a different area that is currently attacking an npc in this area or a player. The wander configurations differ between the archers and the cityguards but regardless they both wander, but the "aggro" behavior config is the same between them and quite complex.
Currently to accomplish this I would have to copy and paste the behavior configuration for each guard. Hence the need for "composite behaviors".
Currently behaviors live in/composites.yml"
behaviors/<entity type>/<name.js>
a new file would need to be created in `behaviors/Example
composites.yml
file:When using this composite behavior it would be like any other behavior, example in npcs.yml