edited November 2015 in ORK Scripting
Hiho,

Is it possible to access a gameObject + the component in a battle-startEvent? I just find out how to use the camera or the actors to use "Call function" or "Enable Component".

This time I have a script in my scene, which will disable all Combatants which are not in battle. Looking in the tutorials I found the Combatant Handler to this, but I am not sure how to start it when battle starts (and of course enabling the combatants again when battle ends).

Thank you.
Post edited by widnig89 on
  • To get all combatants (excluding the player group) that are not dead and not in battle:
    List<Combatant> combatants = ORK.Game.Combatants.Get(false, Consider.No, Consider.No);

    You can access the game objects of the combatants through their GameObject property.

    Just store the list of combatants somewhere and enable them again after battle.
    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!
  • Hi,
    thanks for the response.

    maybe I miss something obvious here in your answer...

    ...but how can I access a game object in my scene which isn't a player when battle starts.

    More concrete:
    My script is attached to an empty GameObject somewhere in the current scene. If battle starts (battle start event) I want to get that GameObject and call a function (e.g. disableEnemiesWhichAreNotInBattle()).


    An opportunity would be to attach this script to each combatant gameobject, but I would really like to avoid that...
  • You can use the Search Objects step to search for the game object in the scene. If found, the object will be added to a Found Objects list (only available in the running event) or to a Global Objects list. The found/global objects can be used in the other event steps.
    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!
  • Oh man i am so sorry. I only looked for "find" in the searchbox for the nodes. :D

    Thank you very much.
Sign In or Register to comment.