[Line of sight] Not working with families

  • Problem Description

    When using the LOS and families obstacles are ignored.

    I have made an example where there is a player unit and an enemy and a green box working as obstacle with a solid behaviour.

    When I use the LOS that is added to the player unit it self, it works fine.

    Using the one that is added to the family which uses the exact same settings. It doesn't see the green box as an obstacle.

    Description of Capx

    Check line of sight between 2 objects, using a LOS added to a specific object and one add to a family.

    Observed Result

    LOS doesn't work when its a family.

    Expected Result

    That it would be like any other behaviour that is added to a family and can be used by the children.

    Affected Browsers

    All

    Operating System and Service Pack

    Windows 7

    Construct 2 Version ID

    r185

  • Its working as expected.

    You would need to either use the family in the condition, rather than the object, or add the behavior to the objects to do what you are expecting.

    Otherwise you are just asking if it has los to itself.

  • Im not sure what you mean? The red object is not the same as the blue object, also using the player object is not the same as using the family object and im testing towards the enemy object. If I add the enemy to its own family and do a Player LOS to Enemy family where player is not part it still doesn't work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But they are in the same family, and the behavior is of the family.

    Its just like if you used units has los to enemy, it won't work there either since the enemy is in the units family.

    I see why you want to use it that way, but I don't think he will, or can make it work.

  • I see your point, but all other behaviours work like that, so why it shouldn't for the Line of sight I don't see a reason for.

    The way it is now, you have to add a line of sight for each individual type of object or family depending on your design, which will create a lot of copy/paste conditions. I have a hard time believing its suppose to work like that.

    But you are correct that in my case I could just remove the enemy from the family, but then its just a matter of time before the problem occurs again, if for some reason I wanted to make a buff system where enemies within line of sight of each other got a buff of some sort. Then I would end up with the same problem as now as the enemies wouldn't be able to be part of the same family.

  • Its about picking.

    Oddly enough you can add a variable to the family, and change that family instances variable and pick using that.

    +units variable "selected" = 1

    -+player has los to enemy, do fo

    ->else do other fo

  • It does end up doing a line-of-sight check to itself in this case, and says it has line of sight. That shouldn't happen, so I changed it for the next build so objects never count as having line-of-sight to themselves, which fixes this case.

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