How do I Make semi smart AI

Get help using Construct 2

Post » Fri Apr 14, 2017 7:53 pm

So im making a management game, and i want to have People go to the toilet to cover their toilet needs and to vending machines to cover their food needs, and when they dont need food or toilet needs to just sit in their cubicles and work.

The problems comes in where i have multiple people walking to the same toilet/food dispenser, and cubicle too, but ONLY if they need to go to the place AT the same time, the problem is probably that i have a variable for Used/Not Used, and when a path is found it gets set to Used, so nobody else can go to it, but again when they both have to go there at the same time it doesn't matter, any workarounds, other ways to do it?
B
5
Posts: 8
Reputation: 241

Post » Fri Apr 14, 2017 9:37 pm

If you have conflicts, try implementing a scheduling system for your People objects so that only one gets a path each tick. This method along with your flag/state system should eliminate all conflicts.

You can use a counter, and IID. For your action event -

System pick Nth instance - PersonObject, InstanceCounter

After your actions are run for that instance, Add 1 to instance counter. If instance counter = PersonObect.count, set InstanceCouter to 0. One action way to do this is Set InstanceCounter to InstanceCounter=PersonObject.Count?0:InstanceCounter+1
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 19, 2017 12:20 pm

oosyrag wrote:If you have conflicts, try implementing a scheduling system for your People objects so that only one gets a path each tick. This method along with your flag/state system should eliminate all conflicts.

You can use a counter, and IID. For your action event -

System pick Nth instance - PersonObject, InstanceCounter

After your actions are run for that instance, Add 1 to instance counter. If instance counter = PersonObect.count, set InstanceCouter to 0. One action way to do this is Set InstanceCounter to InstanceCounter=PersonObject.Count?0:InstanceCounter+1



Seems advanced but ill try to mess around with it.

Thank you for the advice!
B
5
Posts: 8
Reputation: 241


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests