I've done some searching and found the posts to create a combatant this way:
Combatant combatant = ORK.Combatants.Create(
int combatantID, Group group);
My code is as follows:
Group group = new Group(2);
int index = 2;
Combatant combatant = ORK.Combatants.Create(index, group, true, true);
Debug.Log(combatant);
--When I run this the debug reads "Null" - does this mean a new combatant hasn't been created? Also, if I don't include the 2 bools in the Create() part like how it shows to do this in the example posts, I can't get the script to compile. Any ideas on what I'm doing wrong here? Thanks!
This is currently the correct way to create a combatant, but don't forget to also initialize it (via the Init() function):
Combatant combatant = ORK.Combatants.Create(index, group, true, true);
combatant.Init();
If the combatant is null, that's most likely due to using an index of a not yet defined combatant. E.g. if you only have 1 or 2 combatants set up, index 2 will try to use the 3rd combatant, which doesn't exist.
The index is the ID/index of the combatant in the editor, i.e. the number you can see in front of the combatant's name in the list.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I was wanting to set up a series of randomly generated character stats and then if the player chooses a given one, then to create the combatant with those stats.
Would the correct approach be to set up a combatant with index 1 and then create as many of those as needed, and then for each created one adjust the stats and visuals as needed on each individually? If so is there a way to save the reference to a given created combatant so I can access that through script?
There's also the Status Value Distribution menu screen to allow players to distribute status values, can e.g. be used in your start event as a one-time thing if it should only be done for the initial character creation.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
A somewhat complex but also the easiest way (without having to get any object references or anyhing) would be using selected data. You can store the combatant into global selected data in the event (e.g. via Select Combatant node) and access that via scripting:
Combatant combatant = SelectedDataHelper.GetFirstCombatant(ORK.Game.SelectedData.Get("key"));
You can also store multiple combatants into the same key and get them all:
List<Combatant> combatants = SelectedDataHelper.GetCombatants(ORK.Game.SelectedData.Get("key"));
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
ORK.GlobalEvents.CallGlobalEvent(index, combatant);
index is the ID/index of the global event, combatant your combatant :)
Otherwise, you can store it into global selected data and access it wherever needed:
ORK.Game.SelectedData.Change("key", combatant, ListChangeType.Set);
You can also add it via ListChangeType.Add, remove it, etc.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The battle group size is only used by the player group for party management. It can also be changed via the event system, e.g. if you want to increase the size during the game.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!