#How to make it have mutiple minecraft:behavior.nearest_attackable_targets

1 messages · Page 1 of 1 (latest)

open fractal
#

Me adding component groups isnt working

#
      "traye:zombie_team_blue": {
        "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "test": "has_tag",
                "subject": "other",
                "value": "blueTeam"
              }
            },
            "deals_damage": false
          }
        ]
      },
        "minecraft:skin_id": {
          "value": 1
        },
        "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "must_see": true,
        "reselect_targets": true,
        "within_radius": 25.0,
        "must_see_forget_duration": 17.0,
        "entity_types": [
          {
            "filters": {
              "none_of": [
                { "test": "has_tag", "subject": "other", "value": "blueTeam" },
                { "test": "is_family", "subject": "other", "value": "zombie" }
              ],
              "all_of": [
                { "test": "is_family", "subject": "other", "value": "player"}
              ]
            },
            "max_dist": 35
          }
        ]
        }
      },

      "traye:zombie_team_red": {
        "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "test": "has_tag",
                "subject": "other",
                "value": "redTeam"
              }
            },
            "deals_damage": false
          }
        ]
      },
        "minecraft:skin_id": {
          "value": 2
        },
        "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "must_see": true,
        "reselect_targets": true,
        "within_radius": 25.0,
        "must_see_forget_duration": 17.0,
        "entity_types": [
          {
            "filters": {
              "none_of": [
                { "test": "has_tag", "subject": "other", "value": "redTeam" },
                { "test": "is_family", "subject": "other", "value": "zombie" }
              ],
              "all_of": [
                { "test": "is_family", "subject": "other", "value": "player"}
              ]
            },
            "max_dist": 35
          }
        ]
        }
      },```
#

this is in component groups

balmy heath
#

Everything is well written, you have to say what the error is and how you expect it to work.

primal chasm
#

You can try setting the max distance for each to be lower, so itll kinda mimic it.

#

but itll have llimitations

open fractal
balmy heath
#

I would only fix the filters

#

So that they attack only players of the opposite color

open fractal
#

it should be that in there already right?

#

isnt that what i did?

balmy heath
#

No

open fractal
#

well what i did was not attac the team that the zombie is on

#

but that should still work

#

right?

balmy heath
#

It should be something like this all_of:[ {family player},{tag redteam}] I think adding the zombie filter is not necessary

open fractal
#

its to make the zombies

#

not attack eachother

#

because thats what they were doing before

balmy heath
#

Were they attacking each other? Maybe instead of using all_of, you used any_of.

open fractal
#

oh that was before i added that

balmy heath
#

Ok

open fractal
#

bro now hes tryna attack the npc

#

with these filters

          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "other", "value": "redTeam" },
                { "test": "is_family", "subject": "other", "value": "player"}
              ]
            },
            "max_dist": 35
          }```
balmy heath
#

Which npc? :v

#

Is there an npc with family player?

open fractal
#

this npc has

            "minecraft:type_family": {
                "family": [
                    "npc",
                    "mob"
                ]
            },```
#

wait i think i figured out the issue

#

its with changing

#

when hes agro

#

so how do i make him stop being agro

balmy heath
#

Why would I attack him if he is not a player, nor does he have the tag?

#

🤷‍♂️

open fractal
#

wait thats not the full story

#

the zombie initially spawns with this

      "traye:add_no_attack_owner": {
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "test": "is_owner",
                "subject": "other",
                "value": true
              }
            },
            "deals_damage": false
          }
        ]
      },
        "minecraft:tameable": {},
        "minecraft:skin_id": {
          "value": 0
        },
        "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "must_see": true,
        "reselect_targets": true,
        "within_radius": 25.0,
        "must_see_forget_duration": 17.0,
        "entity_types": [
          {
            "filters": {
              "none_of": [
                { "test": "is_family", "subject": "other", "value": "zombie"}
              ],
              "all_of": [
                { "test": "is_owner", "subject": "other", "value": false }
              ]
            },
            "max_dist": 35
          }
        ]
      }
      },```
#

which is why

#

but i set him to red team

#

and he still did

#

until i hit him

#

and he went after me

#

then i switched to creative

#

then hes chill

#

so thats why i think agro is the problem

balmy heath
#

Ok, did you remove that group before adding the new team group?

open fractal
#

no

#

but it adds a new comp group

#

i tried removing it before, it had issues

balmy heath
#

Can you send all the code?

open fractal
#

for zombie?

balmy heath
#

Ok Ok, I don't know how you're testing it, that's probably the problem, you have to remove the previous component group before changing the group, if you execute the blue event, You must add the blue group and remove the red group, and the same with the other event

open fractal
#

ok ill try that man

#

but i still think its the agro

balmy heath
#

Also removes the owner group en cada evento

#

You add events and they pile up, everything is chaos

open fractal
#

wait i think it just works

balmy heath
#

You have 3 groups with nearest attack, when you add one make sure to remove the

rotund forge
#

Unless the question is... "How do I add a turret to my mob?"
I legit don't understand the question...

#

I know the Wither's two heads - in a way - act like turrets (if that makes sense...)

open fractal
#

lemme rephrase

#

How can i make a zombie have mutiple minecraft:behavior.nearest_attackable_target behaviors?

#

and switch between them accordingly

rotund forge
#

OH!

balmy heath
open fractal
#

i think it is solved

#

maybe

#

lemme try something

balmy heath
#

Show the code to check it

rotund forge
#

I know that Zombies typically don't "lock-on" to people like Creepers do, if that helps

#

I see people use a buddy system to have one guy kite a Creeper, then the other guy gets a free kill

#

Zombies don't fall for that

#

THey automatically attack whomever smacks them last

#

Even if that's not what this is about, I wanted to share that because this reminded me of that Mob AI fact

#

Having them be able to "switch targets" on the fly sounds pretty... "advanced"

open fractal
#

yeah its solved but its kinda weird

#

i have to spawn them as one thing

#

and never swithc them

rotund forge
#

Feel free to give videos like this a watch, when you've the time. (Even if you already know the details.) It's worth it, imo.) ❤️

balmy heath
balmy heath
open fractal
#

ok its barely changed tho

rotund forge
#

I had to... XD

balmy heath
open fractal