and I want to change the enemy via script. I think this should work by
battleComponent1.combatant[0] = SOMETHING
but I'm missing the SOMETHING part.
I've tried to set up a combatant like in the script tutorial but I get a "Cannot implicitly convert type 'ORKFramework.Combatant' to 'ORKFramework.BattleCombatant'" error:
public class ChangeEnemy : MonoBehaviour { public GameObject battleObject1; BattleComponent battleComponent1; Group group = new Group(1); Combatant combatant;
public void Change() { battleComponent1.combatant[0] = combatant; } }
EDIT: It doesn't have to be a newly spawned combatant, either - I'd be perfectly fine with simply picking (and maybe adjusting) one from the already existing list I set up in the ORK editor.
The combatant field in the Battle component isn't a Combatant (which is an actual combatant, holding stats, etc.), but only the setup for creating the combatant (i.e. a BattleCombatant class). It only holds the id, faction, etc of the combatant and will use that info when the battle is started to create the combatants.
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!
Yes, just create a new instance of BattleCombatant and set it up to your needs.
See the API for the different fields. The id field is the ID of the combatant group that will be used. When you want a single combatant to be used, set up the member field with a new CombatantGroupMember instance.
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!
Setting it up to change the group was surprisingly easy, thanks for holding my hand, lol. I'm stuck again with the CombatantGroupMember stuff but luckily I can just make groups with only one member and call them, which works for my purposes, for now.
For future reference:
public GameObject battleObject1; BattleComponent battleComponent1; BattleCombatant newBattleCombatant;
It only holds the id, faction, etc of the combatant and will use that info when the battle is started to create the combatants.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
See the API for the different fields. The id field is the ID of the combatant group that will be used. When you want a single combatant to be used, set up the member field with a new CombatantGroupMember instance.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I'm stuck again with the CombatantGroupMember stuff but luckily I can just make groups with only one member and call them, which works for my purposes, for now.
For future reference:
public GameObject battleObject1;
BattleComponent battleComponent1;
BattleCombatant newBattleCombatant;
void Start()
{
battleComponent1 = battleObject1.GetComponent();
newBattleCombatant = new BattleCombatant();
newBattleCombatant.id = 2;
newBattleCombatant.factionID = 1;
}
public void Change()
{
battleComponent1.combatant[0] = newBattleCombatant;
}
}