I want to create an enemy that attacks when it gets within a certain distance.

・I am trying to create an enemy that approaches the player within a certain distance and then attacks by throwing stones, but it is not working properly.

Action A: Approach the player
Action B: Stop and throw stones

I have set it up in this manner, but while in Action A, although the transition to Action B occurs after approaching the player within a certain distance, the following issues arise:

・The setting to fire projectiles is configured but does not function.
・When the distance exceeds the set threshold again, it should return to Action A and approach once more; however, it seems to be rapidly cycling between Action A and Action B, causing improper behavior.

Since I am not attempting anything particularly complex, I believe the settings should be correct.
Does anyone know how to resolve this issue?

※In the video below, I have added a “Pon!” sound effect to confirm the transition to Action B.

Video

Condition links ↓

Regarding this matter, after consulting and confirming with Moonling, the cause has been identified. I would like to record the following information.

【Cause of the Issue】
The enemy’s attack target was set to the “Player group,” but an invisible object was attached to the connection point of the player-controlled ship (which belongs to the Player group), and that invisible object was also part of the Player group.

【Solution】
Remove the “Player group” setting from the invisible object under the connection point of the player-controlled ship.

The issue was resolved with the above measures.
Thank you, Moonling:man_bowing:

1 Like