Propogating behaviour states

Get help using Construct 2

Post » Wed Oct 23, 2013 1:40 am

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.
B
45
S
9
G
2
Posts: 141
Reputation: 4,197

Post » Sun Oct 27, 2013 3:58 am

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
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,293


Return to How do I....?

Who is online

Users browsing this forum: evillair, Yahoo [Bot] and 6 guests