I want to make an enemy that has a gun. The player also have this behavior so I just copy it to the enemy. The problem is that enemies is multiple so I need to use for each object and link two objects to make them all behave the same as the player.
Here’s the event for the enemy skeleton:
I try to create 3 skeletons and they all have guns which means the first part works. Unfortunately, all of the events with take into account don’t work. I think it’s because the take into account needs to be below the link event but I can’t because the gun must be created only once when the skeleton was created too.
Perhaps try changing “Take into account all Skeleton linked to EnemyPistol” to “Take into account all EnemyPistol linked to Skeleton”…
Change the oder of how you link the object you are in a foreach Skeleton so when you create the Gun thing do Link Gun to Skeleton
Also what I do is with the help of UUID extension is to set an UID to the enemy and then when i create the gun or sword for that enemy assign the same UID to the gun then in a double foreach check
if gun UID == enemy.UID and Gun linked to Enemy
So is basically this
Foreach Enemy
Foreach Gun
if Enemy.UID == Gun.UID
Gun linked to Enemy
Do your stuff.
Look my land enemies have an Sprite to simulate vision
Later in other events for attack