Counter incorrectly counts when several of the same objects perform the same action

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

Counter which counts the quantity of goods in stock.

What is the expected result

In my game the player can bet the magazine and the mines. When the mine and warehouse are in the game, the worker automatically delivers the goods from the mine to the warehouse via the pathfinding extension. When the worker gets to the warehouse, the counter should add 1 and the worker goes back to the mine.

What is the actual result

The worker and his delivery system works, but counting the goods in the warehouse doesn’t work very well. when one worker delivers the goods to the warehouse it’s fine but when 2 or more workers simultaneously deliver the goods instead of adding to the counter 2 it adds only 1

Related screenshots

Pozdro z Polski
(Greetings from Poland)

Last event do not need to be for each since it is sub event of for each for same object

What you need to do in last event is remove trigger once
In condition set that it is for worker with goods and then you in action add 1 and under that in another action remove goods from worker

BTW i do not see any event to link goods with workers?
You got it in other event?

Basic idea and best solution would be to take into account all workers with goods that come into warehouse
And when they are in warehouse you add 1 to whatever you want and remove that goods + unlinking them from worker

I have exact same concept to show buildings HP when their HP is below their Max HP and only create+link them to buildings which do not already have HP bars created+linked

And for deleting+unlinking

This way as soon as building HP is 0 or less but building still exist (it does for 2 secs so explosion animation can play) HP bar is unlinked and deleted

Kinda like you would let worker still exist in warehouse but take goods only once and add +1 only once

1 Like

The worker has a boolean variable “posiada_ladunek” and in it I determine whether he has a good or not.
Thanks for the help. Will try your way. Pozdro :slight_smile:

1 Like