Hi everyone,
I've been playing around to build a polymorph system and I have found a few viable ways. My intent is to have a new combatant replace the old one, while keeping a few traits. I have found a few ways to more or less do this, but all the solutions I've come up with have two major problems:
1) if I make the old combatant leave the battle group and the new one join it, they have the same battle spot (which is what I want) but they don't have the same position in the battle group so, for example, if I have combatants A B C in my group and transform combatant B into combatant D (having the first one leave the battle and the latter joining it for obvious reasons), combatant the combatant group becomes A C D instead of A D C. Of course this make sense, but I can't think of a way to switch the positions. It's worth noting that this issue doesn't present itself if I switch the combatants through the ChangeBattle function in a custom node
2) (and this is where I'm actually stuck) When I switch the combatant, whether through the event system or a custom node, every action targeted at it simply won't happen. Is there any way to retarget the OTHER combatants' abilities when I transform? Or do I have to manually check, in every ability, if the target has transformed and change the target consequently? This would still be an issue if I simply wanted to switch a combatant from the battle group with one from a "reserve" group so I thought there should be a simple way of doing it that I'm missing

Plus 3) I'm not sure of what method I should use to store the old combatant in case I want to revert back to it. I'm just keeping the actual object in the scene right now, inactive, and "coupling" it to the transformed form through an object variable. Is there a more efficient way to do this?

Thank you for your help!
  • 1) Well, change battle is really switching the combatants for each other, while removing a combatant and adding one will just add it at the end of the list. I'll look into new options for the group nodes to exchange a combatant for a new one.

    2) So, in short, you replace a combatant mid-battle, while the combatant could be targeted by actions, and those actions don't target the new one.
    Hm, yeah, that'd require e.g. a new node to exchange targets in actions ... I'll look into that.

    3) In-event, you could store the combatant as selected data, but that's gone when the event ends. You'd have to keep the combatant's prefab somewhere, as that's the only link the combatant has left in the running game when it's out of the player group.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited October 2017
    Thanks for your quick reply as always!

    1) that's what I figured, so I better keep using that? It doesn't seem to work/behave as expected with enemy groups, so this only works the way I want it for the player group. I don't think I'm going to display the enemy group with an HUD (as I am with the player group), but if I ever wanted to that would be an issue since I still have to use the leave/join method for enemies. My interpretation is that player groups are handled differently from enemy groups (as in, the latter don't have a distinction between battle and standard group). Is that right?

    2) of course this only happens during the turn the combatant is switched, afterwards it's perfectly possible to target the new combatants. It also behaves differently if I do it from script or from the event system (when doing it from script I get an alert saying that the animator is trying to animate something that isn't there, I'm guessing that's because it's looking for an inactive animator component). Isn't there anything like a "currently targeting" property in the Combatant class? how are current targets stored after they are selected from the menu or from the AI?

    3) So just keeping the original prefab around is ok? I figured as much, but I wasn't sure if there was a better method (like, creating a hidden gameobject to store just the Combatant objects waiting to be reverted to their original forms or other "cleaner" solutions).
    Post edited by azazello on
  • 1) What's the difference when using it for enemy groups? Or what happens and what should happen?
    Generally, all groups are treated the same, with the exception of player groups having a battle group, while for other groups the battle group is the whole group.

    2) No, there's nothing like 'currently targeting' availalble. I'll have to add a new event node to exchange targets in actions to make this work.

    3) I haven't tested it, but it should be enough. Alternatively, you could also store combatants in other, non-active player groups.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.