Hi Gil,
could you point me to a way to designate a combatant group as the active player group? I know there is a way using the event system, but I would prefer to do it using script.
This function will be useful in the situation where there are for example 5 friendly combatant groups on the map and the player want to cycle between them.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Alternatively, if I create a new script to do this, would the steps be like this:
- create an array of combatants - c1, to save the current active group combatants
- create a variable as reference to the active group - g1
- create an array of combatants c2, to save the second group combatants
- create a variable as reference to the second group - g2
- remove all members from g1
- get all combatants from c2, and add them to g1
- remove all members from g2
- get all combatants from c1, and add them to g2
- set g1 location to one of its combatants
- set g2 location to one of its combatants
Would this work?
I've already explained in your other thread how you can access different player groups in the PlayerHandler. So it'd be way easier if you simply add a new player group and use that group when creating your combatants - they'll automatically join the group you've used.
To switch between player groups, you can use this function:
ORK.Game.PlayerHandler.SetActiveGroup(int id);
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
thanks for the reply.
If I follow that approach, what will happen to the original player group? Is it deleted automatically, since it will no longer have members? If it is deleted, will the player group indexes be re-arranged automatically as well?
Also, when I create the new group, I need to use an id that has not been used before right?
The way I get the new id for now is by looking into the ork framework option and manually assign the (last index + 1) as the new index. Is there a way for me to get the last player group index or to get the total count of how many player groups are there?
Sorry if I overlooked a simpler solution that you have mentioned before.
The player groups aren't index based - but ID based, so, you can have groups with the IDs 0, 1, 5 and 20. There is no function to get the last/highest ID, but you can check if an ID already exists by calling ORK.Game.PlayerHandler.GroupExists(int id).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Thanks for the help, Gil.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I'd like to let the player cycle through friendly combatant groups just like @andyMul was talking about. I see the Change Active Group step, but it removes the old group from the scene, so it's not really "cycling" through groups.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!