For each object event?

I am currently making a colony sim/base building game in Gdevelop.
Each colonist can have 1 of 3 different jobs.(civilian, harvester, or defender.)
When there are too few civilians, the colony happiness variable should go down.

If there are 3 colonists with the object variable “job” being “civilian”, how could I make the colony happiness variable change by 1 for every civilian, making the colony happiness variable 3. Is there a condition I don’t know about? Any help is appreciated!

Whenever a civilian is added or removed (when that job or object property is changed or assigned) add or subtract 1 from the global happiness variable

Thanks, but I have already tried this. It caps everything at 2 for some reason? It might be because everything is on the same frame but I doubt it

(Ignore the wait events. I made everything wait a random amount of time to see if the problem is that everything was happening on the same frame but that didn’t fix it)

What is the condition you have all those sub conditions under?

It is under the beginning of scene condition

Then it will only count how many civilians there are once at the beginning of the scene. There is no event for increasing or decreasing the number of civilians after that.

1 Like