How do I separate turret targets by team?

Get help using Construct 2

Post » Sun Jan 10, 2016 7:07 am

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
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
78
S
11
G
6
Posts: 958
Reputation: 10,081

Post » Sun Jan 10, 2016 10:06 am

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
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Sun Jan 10, 2016 11:25 pm

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.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
78
S
11
G
6
Posts: 958
Reputation: 10,081

Post » Sun Jan 10, 2016 11:33 pm

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.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
78
S
11
G
6
Posts: 958
Reputation: 10,081


Return to How do I....?

Who is online

Users browsing this forum: ddabrahim, kiko2015, Momio, MSNbot Media and 7 guests