edited September 2016 in ORK Scripting
Hi,

I'm working on a sim game with multiple heroes and need to be able to change the class of a selected hero from a GUI.
My first problem was that ORK GUI can't seem to handle data from combatants other than the player in a meaningful way (i.e. modifying and not just displaying).
That's fine. I knew going in that ORK was not meant to be used this way. I'm okay with scripting my own GUI.
Thanks to the API documentation I've found the way to get the class ID (integer) from the combatant component.
What I couldn't find was a way to access the class names as string.
The obvious workaround is to keep a list of classes as a list in my script, but it's rather clumsy to keep track of the classes in two places.

So my question is: do you happen to know how to get the names of the classes from ORK in any way?

Post edited by gamingislove on
  • You can get a list of all class names like this:
    string[] names = ORK.Classes.GetNames(false);
    When passing true, the IDs of the classes will be added before the names.

    To get the name of a class:
    string name = ORK.Classes.GetName(id);
    or
    Class c = ORK.Classes.Get(id);
    string name = c.GetName();

    id is the ID/index of the class.

    What kind of GUI do you want to display that's not possible with ORK?
    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 quick reply. Much appreciated.

    I didn't mean to imply any shortcoming of the framework.

    If you played the Majesty series, I want to do something similar.
    The player clicks on a unit and gets its stats in a menu screen.
    It should also be possible to change the combatant's class, equipment, etc.
    I set up the click-and-select part pretty easily by moving the player interaction object to where the mouse is pointing.
    The part where I got stuck was getting the data into a GUI.
    It just kept displaying the player's stats.
    By setting the GUI to 'allow any combatant' the farthest I got was a list of all combatants. But that is not what I need.
    Then I found the option to display the stats of the player's target but couldn't find an event box that would force target selection.
    I also saw the combatant selection GUI type but choosing the combatant from a menu defeats the click-select part.

    With the valuable info above I can now script my menu system pretty nicely.
    Of course if you could enlighten me on how to achieve my goal within ORK that would be even better as the menu editor is very nice.

  • You can display the combatant info in the menu screen by adding a Combatant menu part. It can e.g. use HUDs as templates for displaying the infos.

    Whatever combatant is the user of the menu screen will also be used for the info display there.
    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's what I did though.

    The event was very simple.
    Take the object being interacted with.
    Display the GUI.

    The GUI had the combatant menu part just like you wrote.
    But it displayed the Player's stats.

    What I can't figure out is how to set the menu screen user.

    Sorry if this is a stupid question but I can't find this written anywhere.
  • Yeah ... the Call Menu Screen doesn't set the user of the called screen, i.e. it'll use the player (or the the previous user).
    I'll add new options to define which combatant will be used for the node.

    When using the combatant HUD's click functionality, you can also call a menu screen with the displayed combatant as user.
    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's more than I hoped for.

    Thank you very much. I'll be looking forward to it :)
Sign In or Register to comment.