[Request] Check objects, in another way!

Firstly, I know that this type of request can be resolved with some code via javascript, and also using some combined commands from GD itself. But they are alternatives that can help to improve (I believe)

It would be interesting to enable checking of a type of object, or groups, for example:

Example 1:
If object_1 exists in group_1 ----> Action

Example 2:
If object_1 does not exist in group_1 ----> Action

Example 3:
with group_1 and ≠ objeto_3 —> Action

Example 4:
with all Groups ----> Action

Example 5:
objectName = “Objeto_10” ----> Action (This differs from “Number of Objects” and “Collision” )
Group = “EnemyGroup” -----> Action ( This differs from “For Each”)

It’s a feature that would be interesting to have in GD, because sometimes I wanted to use a certain group to do an action but I didn’t want to use any of the objects that were inside that group.

Description of a problem this could solve:

object Name = “enemy _4” Action text = “enemy 4”

objectName = “Enemy 4” Action
“enemy 4” shoots

These are different ways of working with objects, which could improve the combination of certain actions and conditions.

So there’s been some conversations around building out separate selected object lists over on the Github, I’m not sure where that is at.

However, to accomodate what you’re looking for above, there is some discussion about adding a “Deselect all Objectname object instances” or something similar as an action, especially since it could let you drop objects from a myriad of scenarios, including yours. You can follow along here: Just referring to an object in an expression changes the result after the object is created. · Issue #3196 · 4ian/GDevelop · GitHub

This doesn’t negate your request, but if this action is implemented it would be an easy way for you to accomplish what you’re looking for in an action or two.

1 Like

It would be interesting to be able to have a condition that we can compare the name of an object or group. It opens up more possibilities for certain actions.

You can already do that with the compare two strings condition and the Object.Name expression. Note that for it to work with object picking, as it is not an object condition it will only be executed for the first picked object, you will have to use a for each object event to take all objects into account.

I believe you got confused with this function:

What I’m suggesting is like this:

Williamholtz clarified a bit above. But the request is more to use conditions/actions around object group membership specifically.

I think the suggested “unpick/deselect all Object/groupname objects” can get this 90% of the way there, but I still think groupname expressions/conditions would be super valuable.

The issue becomes that you would probably not be able to get groups from an object since there could be numerous groups. So it couldnt be like ObjectName.Groups(), at least not easily. I’d think it could be ObjectName.Groups(“Groupname”) and return a true/false?

Or a condition of “Object is a member of Groupname group” maybe?

That makes sense too!

I’ll use an example I had these days. As you know, my game uses FSM, so I have groups of enemies that only do certain things in the FSM model like: IDLE, FALL, DEATH.

Therefore all enemies created are placed in the gEnemy group. This gEnemy group is also responsible for damage to the player, because it makes sense since all the enemies created are there…

But within this system, a problem appeared when creating a BOSS. Boss is also an enemy, but I didn’t want to use him in the FSM system.

So I tried to find a way to have a condition doing that:

group = gEnemy
object ≠ boss
Enter the Finite state.