Hello all,

I've been using ORK for a few months and have made great progress on my game prototype without writing any C# yet.

In my game, the Hit Chance & Crit Chance are replaced by a hit bar challenge (See image link below)
https://francis-calimacil.tinytake.com/tt/NTA4MTI4OV8xNTk2MTg2MQ
  • White = Miss
  • Orange = Base hit chance % or the attack
  • Red = 100% hit chance + Critical
  • Blue = Miss
I use many "Wait for input" to match each color range and I disable the "Hit Line" animation to make it stop.

Here is my event for this attack : https://francis-calimacil.tinytake.com/tt/NTA4MTI5MF8xNTk2MTg3Nw

While it works perfectly for this basic attack, it is not going to work for more complex attacks like combos or attacks with multiple keys to input.



So my question is : What would be the best way to do this by using the final "Hit Line" position instead of doing it with time?

From my understanding, I'd have to get the "Hit Line" X transform position after the animation is stopped, somehow get that number back in the event and check if the result is a Miss, Hit or Crit.

So far, the only thing I can think of is a disabled by default C# script that would store the X position in a Game variable when activated by the event system and then use that Game Variable later in the event... but I am not sure how to actually do any of this.

Thanks a lot for any help you can provide. I hope to be able to help others as well when I get better.
  • I think the easiest way is to just do a single Wait For Input node with the total time available for button press and do the rest via the time it took to press the button (using float variables).

    For this, you'd first use a Change Game Variables node to store the Time Of Day or Game Time into a variable before the Wait For Input node, and do the same right after the input (storing into a different variable. Now, subtracting one from the other will give you the time it took the player to press the button, i.e. you can do the rest based on that.
    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!
  • Hi GIL,

    I've implemented the suggested logic and it works great. For some reason, I had to review my timeframes to get it right, but that's not a problem. I can already see how I can use this new logic to make multiple keys attacks and combo attacks work.

    I used a Formula to Variable node in order to get the result of the time it took the player to press the key. Then I used two Check Game Variable with range to check if the attack is a normal Hit or a Crit. All of these in a local origin.

    As a follow-up question : How could I get the resulting variable in the console? It would help me figure out what I've done wrong when testing the game and getting an animation that doesn't fit the Hit Line position.

    Thanks a lot for your help!

  • The next update will add options to automatically store the time it took the player into a float variable directly in the Wait For Input (and Wait For Input Fork) node, so it'll be even easier to do :)

    You can add values of variables via variable text codes - use the More button when editing text areas, select the Data button and Game Variable to select variable text codes.
    E.g. #varcfloattime#0.00# would display the float variable time with 2 decimals.
    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!
  • Great to know about the update. I'll give it a try! For now, using the formula is fine. I think I'll be able to get everything I need with 3 or 4 very simple formulas.

    The console text works great now. I already had the Debug node, just didn't dig deep enough to see all the text options in there.

    Thanks for your help again. I find a lot of answers on the forum that are very helpful to me. I'll try to keep the new posts to a minimum.
Sign In or Register to comment.