Is there a way to change an object's group inside the game?

Like the title said. Is that even a thing?

Not that I’m aware of. What are you trying to do? I’m sure we can find another option.

1 Like

In short: While fighting hordes of enemies, some of them can be electrified, while electrified they can spawn a projectile (bolt of lightning) that flies into another enemy.

What I wanted: to change the group of the electrified enemy that spawns the projectile to tag him as the “shooter” and other enemies as “potential targets”.

What I did instead: I spawn the projectile and by using the magnet effect extension, I move the projectile from the enemy that spawned it to an enemy that is outside of the original enemy’s zone.

In shorter short: I’m making a chain lightning effect.

You could try giving the objects boolean variables like CanElectrify , shooter, target, etc and then use the boolean variable of object is true condition to filter the groups.


He’s right, it’s much less complicated too, because you’d have to put a bunch of objects in and out, with a variable you can just give the group it then it should auto select the right one

1 Like

Ah, okay. Thank you guys. I’m not sure how i can use booleans as targeting system, but i’ll try to figure it out

I’ll show a picture of what I think works

But make sure to make the variable for the effect to a specific group and it should do it to only a particular object that it happened to and by the way, the variable is a global variable, health and damage cooldowns are for object variables but make sure they’re the same names for all objects so they all connect, but using the health extension will do that almost automatically for you, just a suggestion whether you want to use it or not, unless you already do [edit] also I did this on a phone so it may look weird sorry, you also do not have to do everything I did with collision or cooldowns, it’s optional, but it’s just a quick example, making cooldowns with a boolean that enables when hit is useful when you make a separate event for the cooldown so you just put that variable enabled when hit

1 Like

I hope that works tho

1 Like

Sorry, but unfortunately nothing works. The chain lightning either stays in place, bounces around like crazy or flies to right side of the enemy

could you show show a picture of your code and show a video of whats happening in your game?

I don’t really see a problem, what exactly do you want to have happen?

The lil lightning bolt to bounce between enemies…

Like bounce the opposite way it hit the enemy?

No, literally from one enemy to another

So like after it hits an enemy, it homes into another?

Yes, exactly. Since you’ve mentioned that you’re using your phone, I think you’re not seeing what’s in the video, so let me explain: the player character wets an enemy with a water projectile, then electrocutes the same enemy with a lightning orb. When an enemy is both wet and electrocuted, it creates a lil lightning bolt that’s supposed to home into another enemy. What’s happening instead is that the lightning bolt goes to right no matter what.

I’ll try to suggest a line of code in a bit

Have you tried making the thing go straight toward an enemy? It is possible that the thing is targeting the already hit enemy, but have you tried using the add a force to an object condition? And maybe and the nearest enemy has a cooldown it will not target

There are a couple of issues with these events:


  1. The first/parent event reduces the enemies down to those that are wet and electrified. The repeat subevent work with only that subset of enemies - those that met the condition in the parent event.
  2. The nearest enemy to the chain lightning is the one the chain lightning is been created around.


Yes, because you are applying a force at Enemy.Angle() - this is the rotational angle of the current enemy. And I’m assuming none of the enemies have been rotated, so Enemy.Angle() will return 0.

You really want the angle from the chain lightning to the enemy.