@Gil

Haven't dug into this yet from a code standpoint. I was wondering if the systems were exposed within the API to possible do this:

Instead of creating the pre-structured troops (except for specific encounters), I'd like to assign some combatants to a list and have the system generate a troop when spawner activates in-game.

  • Beside using the event system instead of combatant spawners, you can write custom systems and create combatants via script.
    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!
  • Thanks for the tutorial link. Didn't know that one existed. Been a while since I went through the tutorial section
  • That worked out nicely. Got it spawning the way I want it to. Only thing I can't figure out (and, I've been digging on this one) is how to set a desired moveAI from spawner.

    I set the moveAI for the combatant within the editor; but, that overwrote the AIs set for existing ORK spawners (not removing those).

    I saw MoveAISettings and Components within the framework. Check tutorials, just in case.

    What's the best method for setting a move AI via script - haven't searched forums, yet. I'm doing that next.
  • Just get the move AI component from the combatant, either via the game object (GetComponent()) or via the combatant (combatant.Object.MoveAI).

    Once you've got the component, you can change the used move AI via:
    moveAI.ChangeMoveAI(id);
    id is the ID/index of the move AI.
    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!
  • Thanks, GIL.
    I'll see what I can do with that.
  • Getting so close.
    Mob still not moving. Dug into the framework source to understand a bit more. The CanUse() function of the MoveAIComponent is returning false. I think it is Battle.CanUseMoveAI() call that returns false. The MoveAI component of the combatant is null to start - not assigned in the editor. I've been using the ORK spawner to assign a move AI since I didn't want all the mobs moving. Wanted some to remain stationary.

    So, I used the following to add a moveAI component


    MoveAIComponent m = c.MoveAI; //this returns null

    //used this method to add the move ai component
    m = ORK.MoveAIs.Get(0).AddAIMover(c); //start with default mover to make sure it gets added okay

    m.ChangeMoveAI(moveAIID); //change to desire moveAI - simple random wander

    m.blocked = false; //make sure this isn't blocking


    Am I useing the AddAIMover function incorrectly?

    Thanks as always
  • Well, I approached the problem from a different angle and got the desired behavior. I assigned a moveAI to the combatant in the editor. Within my custom spawner, I have a Use Move AI checkbox - when that is false, I set the moveAI.blocked = true.

    Still would like to understand why initial approach wasn't working as expected, though :)
  • Finally! Figured out how all this works. I was able to use the ChangeMoveAI() function by assigning a default moveAI to the combatant within the editor. I created a NoMove ai.

    That resulted in the change to work successfully.
  • So, all good for now?
    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, all is good. Thanks for the direction.
Sign In or Register to comment.