Propogating behaviour states

0 favourites
  • 2 posts
  • So I have a bunch of AI in a layout and I'd like them to be aware of each other and their state.

    For example, I have two AI's in a room. One AI spots me and becomes aware, should the other AI be in the vicinity/have line of sight on me, then they too will become aware.

    My problem is that I cannot fathom how to check if one enemy type sees an enemy type that is not itself. How do I check for this?

    I am basically wanting to script any AI that have line of sight to other AI to become aware.

    Any help on this matter would be super appreciated.

    I am sorry for the lack of capx - my project is now so monstrous and confusing I don't really think it would help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A possible way of setting up your project could be as follow : example capx.

    It works because the rooms are red sprites (you can make them invisible) that will "propagate" to the AI that are overlapping them.

    A difference between the instance variable "Aggro" and "Alerted" is that "Alerted" means that even if the specific AI instance doesn't have LOS on the player, it still is alerted because an instance in the room has LOS on it.

    From the moment the player will leave the room and AI instances will have lost LOS, then they change their state to "Not Alerted" (the boolean is switched to false), later on switching their Aggro status too.

    It works in this simple setting apparently, let me know if you manage in getting it working in your game too <img src="smileys/smiley2.gif" border="0" align="middle">

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