How do I temporality change turret target with the same object target type?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi collegues!

    I have a problem. I dont know how to solve it easily without adding javascript code.

    I dont't want to change a target type for a turret behaviour, but I have some specific condition.

    Units and building have a helper - invisible dummy that plays target role for turrets. Turret attacks units and buildings. I have specific conditions - I dont what a turret attacks building if there is unit nearby.

    How can I stop turret from attacking building if there is unit nearby? Unit and turret have the same dummy (target group), I woudn't like to give them different dummies (game logic will demand a lot of fixes).

    PS - Yes I know I can manage it with target accquire conditions, but it declines optimization, as it requires "pick and for" conditions frequently.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could give the dummy two variables one to say what it is assigned to, unit or building, and another to track if it meets the condition of being close to a unit. Then if the dummy is of type 'building' and var unitNear=true then don't target it by a condition on the main target event.

  • With only one turret you can temporarily remove the building from its list of targets, or disable its collisions.

    But if you have multiple turrets and want other turrets to continue attacking the building, then your only option is to acquire targets with events. It's not terribly complicated.

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