[Solved / Not a bug] Multiplayer: Object picking - Create object picks all instances instead last one

Describe the bug
After creating an object, setting object variables apllies to all instances instead to last created one.

This results into all creatures moving towards last players (who created last creature) oponent. Expected result is, that creatures should keep moving toward each players oponent.

Share the complete GDevelop project showing the bug
Here is video: Watch - Screencastify

1 Like

I added test to check how many instances are picked after creating object - all of them:

image

I guess should be just the last created one.

I’m assuming Players is an object group with LilWiz and WizardFemale in it? If so, how have you assigned player_id to each of the Players objects?

Yes, it is Players is object group of LilWiz and WizardFemale. Creatures is object group of Goblin and Ice zombie. Player id is assigned directly on object:

I found a way how to get around it before this problem is solved. If anyone will have more elegant solution, I’ll be happy for any suggestions:

Please can anyone from gdevelop team response to when this issue would be fixed? It’s not possible to develop with this miss-behavior. Thank you.

Hello, this is not a bug.

You are using a condition “The variable mana of Players > Goblin.mana_cost”

First of all, this is not a good practice as if no instance of Goblin exists on the scene, Goblin.mana_cost will return 0
(this is an instance variable, remember that it can be different per instance on the scene, and not fixed on the object, so if no instance exists the variable does not exist)
Secondly, by doing so, you are picking all the Goblin instances on the scene as it’s trying to find which mana_cost of which instance makes this condition turns true, hence your result.

You should save the mana_cost of your objects in scene variables, in a Structure for instance, as they are constants and are not dependent on the instance of your objects.

2 Likes

Thank you very much for this explanation and pushing me forward. I will test all your advices.

I want to thank you one more time. You helped me to resolve my problems. I would not expect object picking by conditioning value comparison and using one argument objects variable.