How can i merge armies in grand strategy game?

In the grand strategy game I just started developing, I made the army movement system using “path finding”, but when these armies stand on top of each other, two armies are selected at the same time. To solve this problem, I tried a system to combine armies, but it did not work. Armies have a text and a variable called “size” that indicates the size of the army.

Does this screenshot show the events used for merging the army? Can you provide some more information on what exactly an army is? Is it a bunch of linked sprites? Is it built around an array or structure variable? Can you post a screenshot of what the army looks like in the scene editor and during the preview?

armies are text objects with a size variable.

The screenshot doesn’t show the events for merging armies. In order to merge armies, I wanted two colliding armies to merge with a varible and write a newly created army to the size variable and delete the previous armies, but in events, the size variable of the new army became 2 times an army.

The text object I created for the army is one

sorry for replying late

Ekran Alıntısı1

I was playing around with this. It’s an interesting project. It goes something like this. IDK what your triggers would be. I’m guessing collision with a confirmation or multiselect check for a boolean variable like selected equals true and a button click. Maybe a pop-up of some sort anytime objects are selected.

Delete = false
Count = 0

For each army object
-- variable Count add army.Variable(size)
-- if delete=true ---- delete army
-- if delete=false --- delete=true

Army.Variable(size) = Variable(Count)

The delete variable would prevent the 1st object from being deleted. If you’re using the text of the object instead of a variable then you could use the ToNumber(army text) in the add field. This should work on any number of selected objects.