does Turret Behavior: Add Target stay global?

0 favourites
  • 7 posts
From the Asset Store
Kids Game
$24.50 USD
50% off
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I have multiple layouts, depending on the layout the turrets will target different things. But it keeps breaking and turrets are aiming at the wrong things, but only after they have already once targeted an object in a previous layout. I assumed Turret was wiped clean at the start of every layout no?

    I did a work around by adding a Clear Targets on Start of Layout and that seemed to fix it. Very strange to have it be global. (a day of work lost on this btw - since nothing in the doc mentions this)

  • I've encountered this issue for years now, and yes, it's global, sometimes. It's weird.

    I end up running clear targets and resetting the turret on changing layout and then adding the targets again on the new layout, it works.

  • Halfgeek also you can't make some Turrets (of the same object) have different Targets? I only want one turret to shoot a certain thing. Even if I pick the turret I want to Add Object to, they all get it.

    So I have to make a completely new turret object in order to separate targets?

  • jobel It's possible, but instead of adding targets, you need to acquire each target for each turret instance - for example, when an enemy of a specific type for this turret comes into LOS range.

    Check out this demo, it uses the same method:

    howtoconstructdemos.com/how-to-limit-the-angle-of-view-for-turret-behavior

  • dop2000 thanks, I was wondering how to limit the cone range of the turret, I was using LOS but was never un-acquiring target!

    The way I was trying to use it is: there are friendly turrets and enemy turrets. Some shoot at you, some shoot at your enemy. But I was using the same object for both. but maybe its a better architecture to have a 2 different object types for the different turrets.

    The only reason I used the same as each turret fires 12 different weapons, and there's a bunch of logic that goes with each weapon so it seemed prudent to make just one generic turret and just change the Target Objects depending on which layout you were in...

  • You can always make turret fire call functions with params, and have different turret objects, that solves duplication of weapon logic, but makes turret behavior more consistent and controllable. This is basically what I did in Star Nomad 2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Halfgeek yup that's how it's setup with Functions, but I have friendly turrets that fire at enemies and enemy turrets that fire at you. But of those turrets I have different animations for different kinds of turrets and only one kind will shoot player & enemies & incoming missiles (for both sides). The problem is, if I Add Target of missiles, then all the turrets get it globally. It's such a strange behavior. So I just have to set that one up as it's own object. Just another thing to add to the Family, to destroy and keep track of (reload times etc). I don't like it though, I want to be able to make a Turret parent and then have 'children' of that Turret object... but maybe this is coming in the next year or so? but it won't help me now...

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