Hi, I recently started my new project, something like a card game.

I scoured the forums and took the advice you mentioned. Take the item as the card and display it to the UI using Select data.But I'm not sure if I'm using this data correctly, because I'm running into some problems.Here's how I did it. It's going to be a little too much because I want to be as detailed as possible.

Some game Settings:
Battle System > Phase.
One player and several enemies.
After a hand is drawn from the deck, the card is removed from the deck.

1) I started by using shortcuts to display cards, but I don't know how to use the 'hand' data and store them into shortcut slots. I only found Change Shorcut node can use selected data to change a slot with a fixed index, I'm not sure if this is the storage method you mentioned. If the index can use an int variable, then all slots can be changed with a loop. But currently this node can only change slot by fixed numbers. If there are a lot of cards in hand, it will be bad.

2)Since the shortcut didn't work, I tried using a custom HUD:

add HUD Selected Data List component and set prefab、data key
image
add HUD Click component and add action
image

Schematics:

image image

Anyway, it's working! But it also brings new problems! If I use one item at a time and wait until the end of the animation to use the second one, there will be no problem in this case. However, if a second or third item is used before the animation ends, the item will be used one by one, and the round will automatically end (even if the item is set to zero cost). What's even weirder is that the next player's turn after the enemy's turn is over, I can't do anything, just jump to the enemy round again, and it goes on and on. I also used the 2D Grid Battle RPG tutorial to test and found the same results.

Normal(Skip to change phase):

image

Unnormal(automatic switch round):

image

I seem to have encountered such a problem once. It's a similar grid battle system. I use the mouse to connect four cells, and then the character moves along those cells. In the process of moving, if I draw another line, which disrupts the original action, the above problems will also occur.But I did it in another way, disable mouse input during movement. Now it seems that all of these things are disrupting the original action and that's causing the problem.

Is this a BUG? Or did I set something wrong? Or I shouldn't have used the 'hand' selected data in this way?

Sorry again for my poor English. I'm not sure if I explained it clearly.
Waiting for your reply, thanks anyway~ O(∩_∩)O


  • The next update will add Selected Data option to the battle menus, i.e. you can list shortcuts from selected data as buttons in a battle menu. That should help with such a setup.


    1) You can use Select Selected Data node to get the cards from hand one by one, setting them to individual shortcut slots. If you only have a fixed number of cards in the hand (e.g. 5) this is manageable.
    I'll look into an update for the shortcut nodes to allow a value selection (e.g. variables) for indexes.

    2) You could try using Next Action or Outside Battle Order as the Add Action type in the Use Battle Action node.

    Generally, the Use Battle Action node has the potential to disrupt battle order and lead to such behaviour if the action is added as Try.
    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!
  • gamingislove said: The next update will add Selected Data option to the battle menus, i.e. you can list shortcuts from selected data as buttons in a battle menu. That should help with such a setup.
    Wow! That's totally awesome!
    gamingislove said: 2) You could try using Next Action or Outside Battle Order as the Add Action type in the Use Battle Action node.
    I've tried them all, and they all have different problems:
    Next Action doesn't really fit with my game mechanics(i.e. play cards and immediately implement the corresponding effect.).
    Outside Battle Order is not a problem for normal cards(e.g. a potion that adds health). But if this card uses a ability(Items>Use Settings>item ability), this action will not be performed immediately, it will be performed after the next action. This's just like Next Action.

    In addition, there is a problem that I can't do target selection using Use Battle Action node. I have no problem using shortcuts with the same selected data(i.e. I can select targets after playing the skill card).

    Thank you for your support!
  • edited March 12
    I've updated to the latest version and started using the Selected Data option to the Battle Menus. Everything was fine, except for some small problems.

    1) The menu always selects an option by default, and in this case, it's one of my cards. The card is highlighted, as is the target of the card. It's not the effect I want, but I can't disable the highlight because it's going to be used elsewhere. I disabled the following Settings, but it still runs with one selected by default.
    image image

    Are there any other Settings I missed?

    2) When I select a target with a skill card, the battle menu (i.e., my hand) is hidden. The same goes for skill animations and enemy turns. Can I set it to always show?

    Post edited by Xiaofan on
  • 1) No - that's just how it currently works. Battle menu and menu screens will automatically select something (first thing in the list or when using the remember options, whatever was previously selected).

    2) Also no - battle menu is currently only shown during action selection.
    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!
  • Well, I guess I'll just have to adjust the highlighting, or keep working on something else.

    So, I tried the shortcut again. I see that the Change Shortcut node has been updated. But there seems to be one thing missing.
    image

    This is the place I mentioned above. It makes me a little confused about what you mentioned:
    gamingislove said: 1) You can use Select Selected Data node to get the cards from hand one by one, setting them to individual shortcut slots.
    If I'm going to use selected data to set individual shortcut slots, it should be use this node, right? Or any other ways?

    By the way, just to mention the previous question. Does Use Battle Action node allow me to select the target of the action?
    Xiaofan said: In addition, there is a problem that I can't do target selection using Use Battle Action node. I have no problem using shortcuts with the same selected data(i.e. I can select targets after playing the skill card).
  • edited March 13
    Hmm going back to shortcut HUD option, maybe try using the Auto Add shortcut (type) settings in editor instead of doing it in a schematic.

    I'm not sure when the Auto Add takes place though and all that.
    Can it be done when a new card is added to inventory during battle GIL? I think items looted will Auto Add but not sure about add to inventory schematic node

    Then with shortcut HUD you can use the normal Items>Use Settings>item ability and that should do the target selection and action cost you expect I think. (have to set turn and phase action cost to 0 both)
    Post edited by GeneralK on
  • edited March 13
    GeneralK  通用K said: Hmm going back to shortcut HUD option, maybe try using the Auto Add shortcut (type) settings in editor instead of doing it in a schematic.
    Thank you for your advice. The first thing I tried was Auto Add Shortcut. But things don't seem to be going in the right direction.

    1)When the battle starts, it will automatically display all the cards in the inventory. The normal effect would be to random pick 5 cards every player turn, then displayed in the shortcut slot.

    2)The same cards will be stacked in the shortcut slot.

    3)Even if I use Change Shortcut nodes to change the individual shortcut slot, when the quantity of cards used in the hand is the same as the nquantity of cards in the inventory, the cards on the shortcut slot will disappear, regardless of whether there are any unused cards left. For example, there are 5 cards in the inventory: "AABBC". I changed the shortcut slot using nodes, using AAAAA. And then when I use it twice, the remaining 3 cards will soon be gone, because there are no more in inventory. So I don't really understand how to set hand selected data to individual shortcut slots.
    Post edited by Xiaofan on
  • edited March 13
    1) So the entire deck is in inventory?

    Wonder could you put the Deck in the inventory of a Hidden combatant (won't show in menus etc).

    "Deal hand" schematic does a chance/item fork random situation to choose Items and then an Add to inventory for the Hand inventory and a remove from inventory for the deck inventory. I think maybe you can selected data the items coming from deck inventory and random out from it to an add item node? Not sure.

    Then the shortcut auto add would only be from the hand inventory

    Or if selected data from Deck hand isn't going to work could have a bool variable on the item and just check it so that if the random item fork selection selects an already used card, it will fail and go back to random again instead of adding it to hand.

    Or a check inventory node before adding it, and if it's true (already in inventory) then fail and go back to random.

    If the card items are all just triggering abilities anyways then maybe just use abilities to begin with? The icons / shortcut HUD could look the same either way. Then you could check is ability learned before dealing a car.
    Unless you want multiples of the same card available then has to be items.

    Sorry if I'm not understanding all your setup, just trying to brainstorm ways of doing it that would allow you to not use battle menu for those issues.
    Post edited by GeneralK on
  • edited March 14
    Yeah, That's pretty much how I operate.

    At the start of the battle, store all cards (items, e.g. by item type) from the player's inventory into a global selected data list (i.e. 'deck').

    At the start of the player's turn, select random cards from the 'deck' selected data and store them into the 'hand' selected data.

    Setting them to individual shortcut slots.(It's just not quite clear here how to do it.)

    For shortcuts, it seems that if you set the shortcut type to item, it will automatically display all items in the player's inventory, regardless of deck inventory or hand inventory. So what I came up with was to use the 'hand' selected data to modify the individual shortcut slot( i.e. using Change shortcut node). And then there are some of the questions that I mentioned above about this node. Other than that, I haven't found another way to fill the shortcut slot with select data.
    Post edited by Xiaofan on
  • Auto adding shortcuts happens whenever that shortcut is added to the combatant (e.g. item added to inventory, ability learned, etc.), so that's not really a good way for such a system.

    Setting shortcuts (i.e. shortcut slots) should be done in your card handling schematic (i.e. when you set up the hand). E.g. use a Check Shortcut node to check if a slot is empty, if it's empty, set it to one of your shortcuts (e.g. Select Selected Data node to get a random card from deck and Change Shortcut node to set it to the slot). When a card is used (i.e. it's schematics animating it), you can remove it from the slot (i.e. the hand) again via Change Shortcut node (the action's schematics have it available as action local selected data).

    Such a setup would have the hand completely as shortcut slots and not as selected data, as you can directly put the needed cards into empty slots. The latest update also changed the shortcut nodes to allow using value selections for list/slot indexes, so you can e.g. just use a Loop node and loop 5 times to go through 5 slots :)
    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 March 14
    gamingislove said: E.g. use a Check Shortcut node to check if a slot is empty, if it's empty, set it to one of your shortcuts (e.g. Select Selected Data node to get a random card from deck and Change Shortcut node to set it to the slot).
    Maybe I didn't make myself clear. I drew a picture, can you help me to check if I did something wrong?

    image
    Post edited by Xiaofan on
  • Ah ... yeah, seems like the selected data settings of Change Shortcut are missing the new value selection fields ... will fix that in the next update.
    I.e. you'll currently have to do it without the loop, i.e. just copy/paste the stuff and change the slot index each time :)

    Btw, what do you use the handCards list for?
    Also, getting the random card from deck mibht also need to have Remove enabled if you want to actually remove the card from deck to not draw it again.
    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!
  • Well, that seems to be the way it is for now.

    handCards is used in other schematic. After using the card, delete action data from the handCards. Not much use here.

    While waiting for your reply, I have a new problem. I am trying to study the changes to the card UI. As in all other card games, when the mouse moves over the hand, the card will be enlarged and overlays the other cards. In some games, unselected cards are accompanied by dynamic moves. Is this possible in ORK's current functionality? Change the UI as the mouse moves over the card, whether using the battle menu or shortcuts.

    I tried to add Interaction Machine components to the cards, as well as other related components, but nothing seemed to work.

  • It's somewhat possible - UI boxes can use schematics e.g. when selecting or accepting an input. So you can do UI stuff when a card in the battle menu is selected via those schematics.

    Generally, this is a very custom setup, so you might need to write some UI scripts for that. Since ORK's UI is just Unity UI, you can extend it with custom components as wild as you want :)

    Interaction machine (e.g. mouse enter/exit) will not work on UI, those Unity events it depends on are not supported 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!
  • It is worth a try and I appreciate your support all the time!
Sign In or Register to comment.