edited November 2020 in ORK Support
Hello
I'm trying to make a battle game with combatant (player) vs combatant
(other user using that user's saveData i,e not controlled by human).

So, the key is to create a combatant appropriately by using the save data of other users.

In this case, what should I do?

1. Create a combatant by passing the player's save data as an argument (Is this method available?)

2. By reading the save data properly (equipment, ability, etc.)
After creating a combatant, initialize it through a variable
(ex) combatant.equiment = savedata["equipment"][index]
If I code like this, it will get too complicated.

That is, the scenario is
There is a player combatant (myself), and I want to summon that user's combatant to my game by using the save data of the opponent playing the game.
(For example, a puppet combatant that is not actually manipulated, but is made of data using load data)

It is a rpg pk system, but ai controls it. However, for equipment level, etc., I want to create a combatant based on data that other users have played on other devices.

Any advice available?
Post edited by KESHYAS on
  • Loading a combatant is pretty simple:
    Combatant combatant = new Combatant(data, loadPosition, group);
    data is a DataObject containing the combatant's save data (pretty much the same thing you get when using combatant.SaveGame()).
    loadPosition is a bool value, pass on true if you want to load the position data, otherwise false.
    group is the Group the combatant should be part of, you can e.g. create a new group from scratch:
    Group group = new Group(factionID);
    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 answer!
    I think this is what I want.

    I haven't tested it yet, but I have a question.

    new Combatant(data, loadPosition, group);
    Can I pass the entire DataObject when I save/load the entire game as the data parameter dataObject??

    So, in this case, if I want to create an index 0 combatant of other users' save/load data, how will the code recognize it?

    The scenario I want is to receive the entire Ork's save/load string of another user from the server, deserialize it to a dataObject, and pass that dataObject as an argument.
    And I want to spawn Combatant by reading the "index 0 combatant" from the dataObject. (Other users' abilities, equipment, status, etc... have been initialized completely)
  • Since this'd involve custom scripting in any case, you could just save the individual combatant data for exchanges and pass them on instead of the whole save game.

    When using the whole save game, you'll have to traverse the save data to reach the player group's combatants - best check out the SaveGameHandler class in the gameplay source code.
    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 December 2020
    1. Summoned a combatant through script, but in the inspector
    The "Battle Information" > "in battle" variable of the combatant component is set to false.
    (My game is using the real-time battle area throughout the scene
    so combatants summoned as "CombatantSpawner" work in real-time battle normally, but combatants summoned with scripts do not seem to enter the battle.

    Is there a separate way to set this part manually? (

    In other words, my playerLeader is in battle "true", but the newly created combatant is false.
    Real-time battle area is placed without collider (to apply to the entire scene)

    2.And when I kill the combatant summoned through scripting, I want to execute a specific event (or function). Is there a function to check?
    (The kill score should increase.)
    Post edited by KESHYAS on
  • 1) Call this to have a combatant join the battle:
    ORK.Battle.Join(combatant);
    The real time battle area itself is only used by the player, for enemies that stuff is handled by the spawner.

    2) Without scripting you can do that in the death events. With scripting, you can register to the combatant's death state change handler:
    combatant.Status.DeathStateChanged += DeathChanged;
    E.g. with a function like this:
    public void DeathChanged(Combatant combatant)
    {
    if(combatant.Status.IsDead)
    {
    // your stuff
    }
    }
    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.