How to change the group ID of an actor.

Omniso

  • Posts: 192
Basically I have an actor that stands as a neutral structure (separate group). There are two other groups that let's go ahead and call Ally and Enemy. Actors of both of these groups are capable of capturing neutral structures by shooting them via attached turret actors.  While neutral, turrets of both groups will target this structure. When the structure is captured it will join the side of whichever group killed it and switch to animation with the collision box of that said group.  You probably know where I'm going with this, but how do you change the group ID of an actor? Turrets will fire at enemy or neutral targets based on their group. Switching an animation with a different collision BOX group will not prevent both turrets from shooting at this structure regardless of what animation it is in. If it's on the Ally side, Ally turrets will still shoot it (but won't damage it of course). If this isn't possible does anyone know a work-a-round for this?

EDIT: I've saw in previous posts that you "can't" change the group ID by blocks and others said to just change the collision but that doesn't work for my situation. Maybe by code?

« Last Edit: October 27, 2016, 04:44:56 pm by Omniso »

BMJ

  • Posts: 278
I can think of two fairly easy ways to accomplish this without changing anyone's groups:

1) You can either create an actor attribute for all your actors and have your Ally/Enemy actors check this attribute before firing. As in: (I've called this attribute [alignment]in my example)

If {Get [alignment] in behavior [actor events ####] for [neutral structure]} not= [alignment]
           Firing code goes here

In the above code, the firing is only executed if the firing actor's alignment is not equal to the other actor's alignment.

2) Or, when a neutral structure is captured, you could kill it and spawn a new actor that is in the correct group, based on the group of the actor that killed him. You would just need to keep track of which actor group fired each missile to do this.

Omniso

  • Posts: 192
1) Is most certainly isn't an option for me due to the way all actors and turrets are structured and implementing that would break the game in more ways than I could imagine.

2) This was originally what I wanted to avoid because that would result in me creating 3x actors for this structure and future ones but I guess it's my only option. Thank, though