How do I make the Family attack their own team if it is different

0 favourites
  • 6 posts
From the Asset Store
This music pack covers differents situations for visual novels, anime games and many more!
  • Do you know if I can add the family itself to attack if it is not the same one I had at once? Instead of having to add each LineOfSight shooter.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know if I get exactly what you ask, but I've recently created a very modular system for something similar and I'm very proud of it.

    In my roguelike dungeon crawler, I've put every entity (as in the player, enemies, and even stuff like breakable pots and crates but that is irrelevant here) into an Entities family. Then, one of the variables for that is Target, which contains the UId of another entity this entity desires to attack. Then all the logic that controls the entities always uses the target variable to define what they are attacking, walking towards, or anything really. So all the enemies' Target is defaulted to the player's UId, but I can make any of them fight any of them if I really want to. AND THAT IS AWESOME!

    edit: oh and I forgot a very important bit: every weapon an entity can use shoots a projectile (even if it's melee, it's just a shorter ranged one), and that has a variable that contains the UId of entity who fired it. That way, damage is "signed", and can therefore only damage other entities. That logic also applies to "teams". All enmies, for example, also sign their damage as the "enemies" team, and then each weapon may define if it's bullet has friendly fire or not. If it has not, that will only damage entities on other teams. So enemies can even target and destroy crates on the layout if I include so in their AI.

    Man I love this system, hope it helps.

  • I actually asked kind of confused hahaha, I meant that instead of adding each shooter to attack, add the "shooter_team" family to attack the "shooter team" family and are not on the same team, That is, add to the target turret

  • Example: if the shooter_team family is not equal to itself (if it finds another object from the same family) add it to the target

  • ZeldaVerde But thanks anyway, if you can solve this riddle thanks haha

  • You could do it using two families that have the same objects in them (for you to reference the correct uids) like so:

    shooter_team has LOS to shooter_team2(or whatever name)

    for each shooter team

    -----shooter_team.UId not equal to shooter_team2.UId --> team targets team 2

    -----(whatever whatever whatever conditions)

    (srry I don't know how to format it in a pretty way)

    maybe also try removing the for each, seems like it should work

    and also maybe you can just use the same family, cause I feel like objects won't detect LOS to themselves but I'm not sure

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