UE4.27
Please help with the logic nodes. I do not understand how to process/split AddUnique arrays, to do something once per index, then remove that index so it can’t be used in the Loop again.
I tried [Do once] or [Removing indexes] after they get to the [Play Montage Node]. But the Loop (or #2: a re-triggering of the tick ANS > Event) is still making each Character in the array, Play the anim twice instead of only once.
- [Details at steps 5, 7 below]
Goal:
-
I have a spinning leg-sweep-attack, thus the same enemy can be hit twice during the same attack. And multiple enemies can be hit by the same AOE attack.
-
But since I play a fall-down animation on any enemy that is hit, then it would look weird to play it twice (once enemy is already falling – no need to play it again).
-
Thus I want to play the anim ONCE on EACH unique enemy, for this Sweep attack;
-
- but I want the Bool logic to be able to repeat-play anims for different attacks like Chest hit – if the SAME enemy is Hit many times. (So I want a way to toggle the AddUnique logic off/on.)
Setup:
- In Anim Montage, I added a Notify State that is set to Tick (default Epic Function), meaning it will retrigger for the entire time duration that I choose (0.6 secs).
- (Also in my pic, I don’t remember why I have PlayMontageNotify – or the connected logic. It may be from an old version I was working on.)
- This Anim Notify State constantly calls an Event in CharBP (using BPI).
- CharBP has the code for Player (input > keypress > loads a DataTable that decides which variables to use for attack anim, which matching anim to play on Enemy, which bones for Hit trace, etc).
- Enemy is a child of CharBP. Thus Player’s CharBP is where Hit Enemy is told which anim to play and when – by populating the ‘Hit Character variable’ that is in Player’s CharBP.
- So Player CharBP > Keypress > loads DT > says which Anim Montage to play >
- 4b. >> Triggers ANS in Anim Montage >
- 4c. >> which triggers BPI Event call back in CharBP >
- d. >> to perform Hit check > to decide which Enemies to play reaction anim on.
-
So back in CharBP, the BPI Event starts [Pic5, part A] > goes to a Function that calculates hits.
-
In the Hit Function, I collect single hits that are “Characters,” and put each Unique character into an array. And I Set this array as a Variable to output from the function.
-
Back in the CharBP graph [Pic5, part B]: I feed the Unique Character array into a ForEach Loop (or how else can I split the array into single Characters?)
-
At the Branch [Pic5, part B], I want the bottom False-path to have logic to only play the Anim Montage ONCE, on EACH Character [Pic5, part C].
-
At the top True-path, I want the logic to play [a different Anim] on the SAME Character, many times, for EACH time a hit was registered on him (thus I would need an option to not use the AddUnique array, in the function at #6).
-
(Then after each Character plays the anim, I can clear the Array/Characters, since they are unneeded – the attack finished. If I attack again, I will determine fresh Hits that are still in range.)
-
But I don’t know the nodes to use for #8. Please help, ty.