So ive been trying to develop a game for uni project and have been making an attack command. Within the attack command I implemented an array which plays the attack animations in a random order using the random int node.
However I want to play them in a specific order, can anyone help me or point out which node to use to achieve this?
or,create a key map struct. key store index, value store animation.
then, for loop 0 to struct length.
then, use find function to get value of key map struct
hey thanks for commenting but to be honest im not to sure i know what your on about however ive gone as far as to make an int array. am i on the right tracks lol? Im abit of a noob tbh only started using ue4 a year ago here and there.
Also the reason i want it to play in order is i want the animations to play in order as a set 123 cick sequence.
So ive done this which is what i think u wanted me to do for solution a however it doesnt seem to work… Instead it just plays the first animation which in this case is 0.
I didn’t want to interrupt @MilionX and I kinda feel bad about it because he gave you everything you need but you couldn’t grasp it. I’ll try to show you how Map variables work and you’ll see that you can figure it out by yourself.
Here, in this example, I’ve created a map variable with a string as a supplement.
I want to print “a, b, c” on the screen using this variable but my letters aren’t in order:
So, in the other side (the key side), I’ve put them in order using ints like so:
If you read the letters by following their numerical order you can read them as “a, b, c” and not “b, a, c,” and that’s exactly what we’re using the ForLoop for because it adds one to each iteration.
Here, by pressing a button, the letters are shown in order following their numeration:
you @MilionX are an angel! It works exactly how i want it to… ive been trying to figure it out for hours haha and time is valuable when doing a uni assignment lol. Really appreciate the effort you put in to answer my question. Hopefully it will help others too and has given me a better understanding of how arrays can work together. Again thank you very much
Wow thank you for that very good elaboration of what @MilionX was discussing. This has helped me understand a litter better on how the for loop and arrays work. My problem has been solved by @MilionX but i really appreciate you input and hopefully will help others
just to your comments and pictures are really going to help me moving forwards. I have also taken this method and applied it to the sounds the player makes when attacking within sequence to the attack array. I with use this method for alot of things
Hey @Aumenn2003@MilionX so I dont mean to be a pain and maybe i will work it out eventually but im trying to get the attackorder to reset to 0 if the player hasnt press the attack command for 3 seconds so i did this but obviously it didnt work. it seems like i get somewhere close just can never figure it out.
@Aumenn2003 Im creating a topdown template and using the attack order to sequence my attacks left swipe right swipe spin attack. im using play anim montage as a simple root motion solution to my attacks. so i want the character to got back to the first attack if the character hasnt attacked for 3 seconds. I hope you understand that and that i am also abit of a noob. however i do have a passion for becoming a game development so these answers you have given me are really good for my own development and helping uni studies
Suggest you use a timer for this. It will allow you to reset the 3 seconds after each attack and cancel when all attacks have been executed. Something delay node will not let you do.