edited May 2022 in ORK Support
I'm sure this must be simple but I'm an ORK beginner and having trouble getting this to working. Here's what I want:

-Enemy Combatant is spawned at a specific spot
-Player can walk up to the combatant and start the battle by interacting with the combatant

Here's my setup:

-Player has an interaction controller setup
-Gameobject with a Battle and Combatant Spawner component

-Battle Settings:
-[off] Use scene ID
-No Combatatants
-Start Settings set to "Interact"

-Combatant Spawner Settings:
-Battle Component set to the Battle above on the same gameobject
-Combatant 0 setup
-[on] Spawn at position
-Start Settings set to "Start"

This setup gives the following behavior:

-Combatant spawns on Play start at the correct location (Yay!)
-Interacting with the Combatant throw the following error:
IndexOutOfRangeException: Index was outside the bounds of the array.
GamingIsLove.ORKFramework.Components.BattleComponent.StartBattle () (at <8133a51876674e7193b890c454777dd1>:0)
GamingIsLove.ORKFramework.Components.BattleComponent.StartInteraction (UnityEngine.GameObject startingObject) (at <8133a51876674e7193b890c454777dd1>:0)
GamingIsLove.Makinom.Components.BaseInteractionComponent.StartMoveToInteraction (UnityEngine.GameObject startingObject) (at <88a6be00da074773b4f8e49e8561b8ab>:0)
GamingIsLove.Makinom.Components.BaseInteractionComponent.Interact (UnityEngine.GameObject startingObject) (at <88a6be00da074773b4f8e49e8561b8ab>:0)
GamingIsLove.Makinom.Components.InteractionController.Interact () (at <88a6be00da074773b4f8e49e8561b8ab>:0)
Thanks, for the help
-Mike
Post edited by indoflaven on
  • Well, you interact with the Battle, which has no combatants set up, so that's not working :)

    If you want the battle to start on interaction, you need to set up the battle as you want it - e.g. just place your combatant's prefab in the scene where it should be, add the Battle component and set it up with the combatant you want to fight.
    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 your response!

    Okay, I now have the following set up:

    -Combatant "Slime" setup in Makinom with Prefab "Slime"
    -Prefab "Slime" placed in scene (same prefab assigned to the combatant)
    -Battle Component added to the Slime in scene (Battle component not in prefab)
    --Combatant 0 set to Faction: Enemies / Combatant: Slime

    Now when I interact with the Battle Component a NEW slime gets spawned. So the question is how to I set the Battle component to use the Slime prefab already in the scene rather than spawn a new one. I tried adding an "Add Combatant" component to the Slime prefab in scene, but that did not work.

    I'm using a Battle Start schematic that uses the Spawn Battle Combatants Action, but disabling this does not fix the problem either.

    -Mike
  • Ah ... yeah. This probably needs a different approach.

    - place your combatant prefab in the scene
    - add an Add Combatant component to the game object and set up the combatant you want
    - add an Interaction Machine component to the game object that starts a schematic with a Start Battle node (using the Machine Object)

    If you need the battle to be set up in a special way, you can set it up as you need it and select it in the Add Combatant component's settings as the battle to use. The battle should not have any combatants added and no start type enabled (i.e. it's only used via the combatant).
    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!
  • That worked. Thank you good sir.
Sign In or Register to comment.