How do I separate turret targets by team?

0 favourites
  • 4 posts
From the Asset Store
10 turrets rendered in 3D with top down and menu views. Three upgrade levels per tower.
  • I've been working on a project, trying to get objects with the turret behaviour to target other objects based on their team.

    Seemingly, no matter what I do, the turrets will aim at the player no matter what team they are on. I've tried setting up a condition that states "If team = 0 target player", but the other teams will also target the player. I've also tried picking an instance of a certain team, and they're also targetting the player.

    At the same time, I tried using a container to spawn these turrets, and pin them to the base, but when created, they pin themselves to the first instanced object only... not sure why, so that's why my code has that extra bit at the start.

    Ideally, I'd like the turrets to target the closest team that isn't their own, but I can't even get the teams separated at this moment in time.

    Here's a quick break down comparison of what I've done: https://copy.com/WToLXjDSmNaNrcsr

  • They aquire the target because thats what the behavior tells them to do. One way to avoid that might be to set the behavior to disabled then enable it through picking.

    sprite -> Team 1 Set Turret enabled

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So it seems that you can't use the turret behaviour to target the same sprite as itself. It'll either target itself or the first version created. No amount of disabling and picking teams seems to make a difference. It'll target anything. Shame.

    The only way I can think to fix this then is to have multiple sprites of the same objects depending on how many teams they'll be, put them in a group, and hopefully separate them out using that... I'll give that a quick go and report back.

  • So having multiple sprites representing different teams appears to work, but it's a shame that you can't determine a target based on its variable as opposed to only its sprite.

    Using a family makes it easier to determine which member of the family you'd like to pick, but it requires more events.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)