edited December 2022 in ORK Support
Hello! small question for Ork 2 (I know it's outdated, but I'm way too deep in for an upgrade):

I'm trying to figure out how to get the various battle gains from code or somehow save them as a variable but I have no idea what it's under.

It's definitely not ORK.Game.ActiveGroup.Leader.LootCollected.ToString() but I'm hoping there's something similar to that for getting the active group leader's battle gains?

And I figure if "show gains" is able to display those values, it has to exist somewhere. I'd even be happy if I can just get the experience reward somehow.

Also I need the values before the player collects them if that's possible. Thanks in advance!
Post edited by braytendo on
  • So, one step closer, I managed to find SimpleLootDialogueSettings.cs in the Ork source code.

    This seems to be generating the output for show gains, but I'm not totally sure how I could use it to get these values in my own code.

    Sorry if I'm being dumb, I'm doing my best I swear!
  • ORK.Battle.Loot gives you access to the available loot, e.g. you can access the list of items, equipment, etc. (all instances of IShortcut interface with access to content information like name, icon, etc.) via ORK.Battle.Loot.Loot:
    for(int i=0; i< ORK.Battle.Loot.Loot.Count; i++)
    {
    string name = ORK.Battle.Loot.Loot[i].GetName();
    }
    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!
  • edited February 2023
    This is wonderful!

    I was able to retrieve my currency gains with

    ORK.Battle.Loot.Loot[0].Quantity;

    However, I cant seem to access the experience reward in a similar way. I tried something like

    ORK.Battle.Loot.Experience[0].Quantity;

    but that doesn't seem to be an option.

    Also, how would I update battle gains from script as well? For example, I want to check if the total exp reward was more than 99, and if so, set the exp reward to 99.

    EDIT: Also, I only have one player so I don't need the exp reward split between a group, but I am using "receiving level difference factors" so I need to make sure that's calculated before I retrieve the value if that's possible.

    EDIT AGAIN:

    I solved it! Using that script of yours I found earlier, I was able to put this together:

    foreach (KeyValuePair<int, List<ExperienceLoot>> pair in ORK.Battle.Loot.Experience)
    {
    int exp = 0;
    for (int j = 0; j < pair.Value.Count; j++)
    {
    exp += ORK.Game.ActiveGroup.Leader.Status[pair.Key].Setting.GetExperience(
    pair.Value[j].experience,
    ORK.Game.ActiveGroup.Leader.Status.Level - pair.Value[j].baseLevel,
    0);
    }

    if (exp > 0)
    {
    exp = (int)(exp * ORK.Game.ActiveGroup.Leader.Status.ExperienceFactor);

    if (exp > 99)
    {
    exp = 99;
    }
    ORK.Game.ActiveGroup.Leader.Status[pair.Key].AddValue(exp, false, true, false, false, true, true, null);

    }
    }
    ORK.Battle.Loot.Experience.Clear();


    Not sure if there's an easier way, but this worked!
    Post edited by braytendo on
  • As long as it works :)
    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!
Sign In or Register to comment.