edited April 2020 in ORK Support
Hello everyone,

I have a few questions about ORK (mainly about its battle system).

1) Is there a way to skip the "select target" proccess? I'm making a poke-like game with only 1v1 at a time and I'd like to skip this step so as soon as I click on "attack" it attacks immediatly the ennemy.

2) I followed the tutorial here: http://orkframework.com/tutorial/gameplay/battle-in-a-different-scene/
But, if I escape the battle (or when the battle ends), I end up with my "creature" in the main town scene and my player (controllable) disappear. What can I do about it?

3) What would be the best way to reproduce the Pokemon battle system (6vs6 group, 1vs1 battle at a time) ? I'm having a hard time to make such a system - even though I did the tutorial.



That's all for now.

I'll make sure to let you guys knows about the progress I'm making with my project and post it in the showcase thread.


Thank you for your time!

Jihaysse
Post edited by Jihaysse on
  • 1) There are options for that in Battle System > Target Settings, the Auto 1 Single Target and Auto 1 Group Target settings will skip target selection if only 1 possible target/group is available (for single/group targeting).

    2) Hm, should work - I'll look into it.

    3) Enemy battle groups are not limited in number, but the player's group is. The setting for that is in Game > Game Settings in the Player/Group Settings, which defines the player's battle group size at the start of the game.
    You can change this during the game using a Change Max Battle Group node in the event system. So, for your 6vs6 battles, you can just use the battle start event to change the player's battle group size to allow using multiple combatants. Don't forget to reset it at the end of the battle (battle end events).

    4) Do you get any errors in the Unity console in that case?
    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 April 2020
    1) Thank you!
    2) I made a video here if it can helps: https://streamable.com/nlp9i9
    3) What I meant is that I want to have 6 creatures in my party, but only 1 at a time fighting.
    Just like Pokemon games. So that would be like:
    1] First creature defeat its ennemy
    2] Another enemy is sent
    3] The enemy defeats my first creature
    4] I send my second creature
    [...]


    For the 4), I just resolved it so I edited my post before you answer, sorry!
    After a research I had the same problem as here : http://forum.orkframework.com/discussion/4567/combat-issue/p2
    I desactived the "Wait" in the "Collect Battle Gains" node and now it works.
    EDIT: I reactived the "Wait" in the node to show you the error and the error doesn't appear anymore. Weird. I tried 3 times.


    Thank you for your time, I really appreciate your help !
    Post edited by Jihaysse on
  • 2) Tested it and works fine here - how did you set up the player to not be part of the battle group?
    The setup should be like this:
    - join the player as the first member of the player group
    - remove the player from the battle group.
    - hide the player group member
    - lock the player group member

    3) Ah, ok. In that case, you'd do this in the death battle event, joining a new combatant to the 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!
  • edited April 2020
    2) I tried adding the "lock group battle member" with player but it didn't work neither.
    Here are my events :

    Game Start : https://ibb.co/2Sg22pw

    Start battle: https://ibb.co/zH4vq2m (didn't had the "lock group member" before)

    Battle end (victory): https://ibb.co/CJL7vtH

    3) I will try about it after resolving the 2nd issue. Thank you ! I will keep this post updated.

    ======

    4) I'm also having problems customizing the UI. I've done everything as described in the game tutorial, but now I'd like to customize it. I'd like to use the Unity UI, but showing informations from ORK (Party battle members info such as HP, Levels, etc... and also Quest logs, inventory item,...)

    I have made this on Unity UI:
    [1] A simple Menu Button:
    https://ibb.co/bmms0S5

    [2] Which opens this panel:
    https://ibb.co/SPgQF04

    [3] Now I need those buttons (Team, Inventory, ...) to open a panel displaying informations about my
    team (as I said, HP, levels, abilities, ...), same for inventory. Which way should I go to do this?
    Or maybe is there a better or easier way to do this?


    Thank you for your help :)
    Post edited by Jihaysse on
  • 2) Ah, sorry, lock battle member isn't needed, the player isn't part of the battle group any more, so just leave battle group and hiding the player is enough :)

    Is the player back to normal when you change scenes after the battle ended and returned to the previous scene?

    4) Well, you can also use the Unity UI in ORK's UI system (see this how-to for details).
    If you want to go with a custom UI, you can access pretty much all information via the central ORK class - e.g. access to the player group via ORK.Game.ActiveGroup.
    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 April 2020
    2) When the battle end, I have not my player anymore. Instead, I have my "monster", that's probably why I can't move anymore. I don't understand as I simply use "save scene" and "load scene" nodes, so I should simply go back to my previous scene with my player in it, right?

    Here is a screenshot of what happens when I return to my pre-battle scene, after I've won the battle:
    image
    Full size here: https://ibb.co/L9TFXVM

    4) I made this "Team Screen" image
    https://ibb.co/BqmGzff
    I've managed to update the HP text, HP slider, name, level (huge thanks to you & hellwalker for helping me in PM), but I can't find how to update the sprite & the Exp. Slider. Any idea?

    5) I tried many ways to loop through all my "monsters" to update the stats shown in the Team Screen, but I didn't have success. I have to show my BATTLE members only. For now, it shows the player + my monsters. I had success with if ( i > 0) but I guess there must be a better way.

    6) I tried to desactivate the creature panel in the case I don't have any creature (for example, I have 3 creatures and the max group size is 6 using something like this:
    if (xxxxxxxxxx)
    {
    statsHolder[i].SetActive(true);


    else
    {
    statsHolder[i].SetActive(false);
    }

    But I tried but couldn't find a way. I don't know what the put in the "if" statement.
    statsHolder being a game object array with all my 6 creature panel in it.


    Here is my current script:
    List<Combatant> _Group = new List<Combatant>();


    public void Start()
    {
    ORK.Game.ActiveGroup.GetMembers(MenuCombatantScope.Group, ref _Group);

    }

    for (int i = 0; i < _Group.Count ; i++)
    {
    if (xxxxxxxxxxxxx)
    {
    statsHolder[i].SetActive(true);
    monsterName[i].text = ORK.Game.ActiveGroup.GetMember(i).GetName();
    levelText[i].text = "Lvl. " + ORK.Game.ActiveGroup.GetMember(i).Status.Level.ToString();
    hpText[i].text = "HP: " + ORK.Game.ActiveGroup.GetMember(i).Status[1].GetValue().ToString() + "/" + ORK.Game.ActiveGroup.GetMember(i).Status[0].GetValue().ToString();
    hpSlider[i].value = ORK.Game.ActiveGroup.GetMember(i).Status[1].GetValue();
    hpSlider[i].maxValue = ORK.Game.ActiveGroup.GetMember(i).Status[0].GetValue();
    expSlider[i].value = ORK.Game.ActiveGroup.GetMember(i).Status[8].GetValue();

    }
    else
    {
    statsHolder[i].SetActive(false);
    }
    }


    Thank you for your answers!
    Post edited by Jihaysse on
  • 2) Hm ... since it's working here, my best guess would be that somehow your player is changed during battle. Try using a Set Player node before the Load Scene node and use your player's combatant.

    4) Well, you just need to update the slider's value with the value from the correct status value, e.g. in your script post, you're using status value ID/index 8 for it, so that should be your exp stat.
    Updating the sprite would be a bit tricky, as ORK doesn't have access to your sprites. You could use a Raw Image component instead, using e.g. the combatant's icon or a portrait to display a texture assigned to the combatant.

    5) If you only want to show your battle group, use the GetBattle function instead. GetMembers will get you all members of the group, including the hidden player.

    6) You're cycling through the group count when you should be cycling through the statsHolder, so:
    for (int i = 0; i < statsHolder.Count ; i++)
    Or maybe statsHolder.Length, in case it's an array.
    In your if, check for:
    if(i < _Group.Count)
    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 April 2020
    4) For the RawImage, it works well.
    For the Exp. Slider, I want to show, for example, my monster is lvl 37, he needs 1000 xp to level up, he currently has 500xp (from the begining of his level 37, not from the level 1).
    So the slide should be half full (500/1000).

    For now, my script looks like this:
    expSlider[i].value = ORK.Game.ActiveGroup.GetMember(i).Status[8].GetValue();
    expSlider[i].maxValue = ORK.Game.ActiveGroup.GetMember(i).Status[8].GetMaxValue();
    (Status[8] being my Experience stat)
    Don't GetMaxValue takes the maximum value of my Level 100 experience curve (ex: 100'000xp)?

    5) I had success using GetMembers(MenuCombatantScope.Battle, ref_Group)
    ORK.Game.ActiveGroup.GetMembers(MenuCombatantScope.Battle, ref _Group) ;

    for (int i = 0; i < statsHolder.Length ; i++)
    {
    statsHolder[i].SetActive(false);

    if (i < _Group.Count)
    {
    statsHolder[i].SetActive(true);
    }


    }

    or the GetBattle(i) function, but it still shows my Player in my "Team Screen".
    EDIT: I moved my "Player" combatant to ID 5 (for example) and now I can see my 2 creatures in my Team Screen. The problem is that a) they are sorted by their ID, not by when they joined the group and b) if I have 2 same creatures (let's call it "XY") , it only shows one. (it shows I have 2 creatures instead of 3).
    After testing, even in the ORK Team Screen, it only shows I have only 1 of those "XY" despite using 2x the "Join Battle Group" node with "XY" in it. Can't I have multiple instance of those "XY"? Just like you would have 2 "Pikachu" for example.


    7) How can I spawn only my first battle member at the start of the battle? Because for now, it spawns all my team. I tried to desactivate the "Spawn all" in the "Spawn combatants" node but it doesn't work. (in order to reproduce the Pokemon 1vs1 battle system with a 6 members party size)
    EDIT : I managed to do it by a) using a "Change Max Group Size" to "1" in the Battle Start event and then b) hiding the battle spots (because you could still see my creature n°2 in the battle scene). Is there a better way to do this or not?
    EDIT 2: Actually, it didn't work. My 2nd creature HP bar doesn't show anymore, but it still gets hit by the enemy (I saw it after the battle when checking my Team Screen).

    8) I tried to show my current "Pokemon" abilities (attacks) but I had no success. What's the function to get the current combatant abilities (during battle, to show into my battle menu)? I tried this without success: List<Combatant> _Group = new List<Combatant>();

    ORK.Game.ActiveGroup.GetBattle(ref _Group);

    for (int i = 0; i < attackButton.Length ; i++)
    {
    attackButton[i].SetActive(true);
    attackText[i].text = ORK.Game.ActiveGroup.GetMember(i).Abilities.Get(i).ToString();
    }


    9) Same for the enemy HUD, I can't find the function to access his data(health, name, etc) at runtime (for the enemy who's at the moment in battle with me).
    I've read about the IShortcut Interface but can't find it.

    Thank you for your help! :)
    Post edited by Jihaysse on
  • 4) You also need to subtract the minimum value (GetMinValue()) from both the current and maximum value to have a 0 to max representation in the value bar.

    5+8)
    ORK.Game.ActiveGroup.GetMember(i) will get you the combatant for the defind combatant ID/index, same for ORK.Game.ActiveGroup.GetBattle(i) - this is not what you want. You need to get the group list (e.g. GetBattle() for the battle group) and go through that instead.
    You already got the group, so instead of getting the member again, use the combatant in the list (_Group[i]).

    7) Set the player's battle group size (game settings > player settings) to 1.

    9) Once you've got the combatant, the information can be accessed via it, e.g. name:
    string name = combatant.GetName();
    Status values (id is the ID/index of the status value):
    int value = combatant.Status[id].GetValue();

    The IShortcut interface is used for things like items, equipment, abilities, etc.
    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 April 2020
    7) Alright but when I "capture" another "Pokemon" and make it join my battle group, should I use a "change group max size" node before the "join battle group" node?
    If so, wouldn't it be the same and get my 2 "Pokemon" in the battle (2vs1 instead of 1vs1)?

    8) I tried to get my current combatant abilities using this:
    attackText[0].text = ORK.Game.ActiveGroup.GetBattle(_Group[i].ID).Abilities.GetAbilities(UseableIn.Battle, IncludeCheckType.No).ToString(); or this:
    List<Combatant> _Group = new List<Combatant>();

    ORK.Game.ActiveGroup.GetBattle(ref _Group);

    for (int i = 0; i < _Group.Count ; i++)
    {
    attackButton[0].SetActive(true);
    attackText[0].text = ORK.Game.ActiveGroup.GetBattle(_Group[i].ID).Abilities.GetLearned(0).ToString();
    attackButton[1].SetActive(true);
    attackText[1].text = ORK.Game.ActiveGroup.GetBattle(_Group[i].ID).Abilities.GetLearned(1).ToString();

    }
    but I had an error: "Index was out of range. Must be non-negative and less than the size of the collection" I think my error is that I don't know how to properly access my current "Pokemon" abilities.

    9) I couldn't find the function to access the current enemy at runtime. Is it something like ORK.Game.Combatant.Get()? How can I access only the current enemy who's in battle with me?

    Thank you for your precious help!
    Post edited by Jihaysse on
  • 7) The battle group size defines how many combatants will take part in the battle at the same time. If you want a 1vs1 setup (i.e. 1 at a time), you should leave it at 1.

    8) Instead of:
    ORK.Game.ActiveGroup.GetBattle(_Group[i].ID)
    use
    _Group[i]

    In total:
    attackText[0].text = _Group[i].Abilities.GetLearned(0).GetName();

    The error might be for your attack button/text, e.g. if you have only 1 (or even no) button/text set up in your component, this'll happen.

    9) This will get you all combatants currently in battle, excluding the player group:
    List<Combatant> enemies = ORK.Game.Combatants.Get(false, Consider.No, Consider.Yes);
    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 April 2020
    Thank you, very helpful! :)

    10) I'm making my custom inventory and I'd like to sort items by their types (potions, quest items, others...). I had success to get my items using this code:
    for (int i = 0; i < itemButton.Length; i++)
    {
    itemButton[i].SetActive(false);

    if( i < ORK.Game.ActiveGroup.Leader.Inventory.Items.Count)
    {
    itemButton[i].SetActive(true);
    itemImage[i].texture = ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(i).GetIcon();
    quantityText[i].text = ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(i).Quantity.ToString();
    descriptionName.text = ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(i).GetName();
    descriptionText.text = ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(i).GetDescription();
    descriptionImage.texture = ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(i).GetIcon();
    }

    }

    But obviously it gets ALL of my items (I only want to show - for example - potions). I didn't have success with "GetUseableItemsByType" neither.

    11) Is there a way I can start a "Battle Event" by script? I couldn't find in the API (but I'm a total beginner so... haha). I'd like to start the Battle Event when I use one of my abilities (clicking on the ability 1 button - for example).
    Post edited by Jihaysse on
  • 10) Try this:
    List<IShortcut> items = new List<IShortcut>();
    ORK.Game.ActiveGroup.Leader.Inventory.Items.GetByItemType(typeID, false, ref items);

    typeID is the ID/index of the item types (e.g. your potions item type).

    There are similar functions in the base inventory (ORK.Game.ActiveGroup.Leader.Inventory) to get items from different categories like items, weapons, armors, etc.

    11) If you've set up a battle in your scene, you can start it via its BattleComponent component:
    comp.StartEvent(null);
    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 May 2020
    10) Thank you!

    12) I'm trying to reproduce this system:
    So, an NPC who comes to me, then I follow him.
    I tried to replicate the same using an event and a "Set Move AI Target" node (to make the NPC comes to me) but he keeps walking on the same tile.

    I use a custom player movement script which moves tile to tile. It uses a gameObject which is child of my Player prefab and my Player moves into the position of this gameObject to "jump" tile to tile, using this: transform.position = Vector3.MoveTowards(transform.position, movePoint.position, moveSpeed * Time.deltaTime);

    Do I need to attach this script to my NPC too? I already made him a combatant but it didn't change anything.

    What's the most efficient way to achieve my goal? MoveAI? Events? How?
    I'm kinda lost on the way to go.

    Reminder: I'm making a 2D tile-based game.

    13) I'm doing the abilities animations and have some questions. Is it possible to play the animation only when you don't miss your target AND to display the damage after the animation? So that would be:
    use abilities => calculate if miss or not => if touch, play the animation & sound => display the damage. I tried but it display the damage when it first calculate if miss or not.


    Thank you for your precious help!


    Post edited by Jihaysse on
  • 12) Well, this is during an event/cutscene, so it's best to have the player controls blocked and move the NPC and the player via movement nodes.

    13) You could use a Chance node to do the hit check instead of having hit chance in the ability.
    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.