Hello, i try to create a combatant and joint it the the active group(player group). I not a coder but i know how to read code, but not a expert. Below is my code, i have followed the tutorial how to create a combatant here:
// Start is called before the first frame update void Start() { Group testGroup = new Group(0); Combatant combatant = ORK.Combatants.Create(4, testGroup, true, true); Debug.Log(combatant); combatant.Init(); Debug.Log(combatant);
}
// Update is called once per frame void Update() {
} }
I using the demo project for testing, so i have create a empty Gameobject in the Town scene, and have a added this script to it.Not sure if its the way to go , but from the debug.log i got the correct combatant(blue pants), but when i check the menu ,he not there with my other combatant.
I not sure about my testGroup, faction 0 is the player faction, but maybe i miss something somewhere..
I'd recommend to have the creation in your Start function instead of the field declaration - depending on where/when the script is used, the creation might be called before ORK is initialized with the current script (e.g. during quick game testing right in a scene).
Post edited by gamingislove on
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!
Combatant combatant = ORK.Combatants.Create(id, ORK.Game.ActiveGroup);
is this the correct way to declare and initialize a combatant??
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ORKFramework;
public class CreatingCombatant : MonoBehaviour
{
public Combatant combatant = ORK.Combatants.Create(4, ORK.Game.ActiveGroup, true, true);
// Start is called before the first frame update
void Start()
{
combatant.Init()
}
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!