Hi Guys,
Im currently learning Unreal and stumbled upon a specific problem that had me banging my head against a wall (rather unsucessfully).
I want to make a simple 3-hit Combo for the player Character using Integers.
My Integer keeping Track of the Combo is called “Attack_Counter”
Every time the left Mouse Button is pressed, the Integer should increase by 1 and a unique Anim Montage plays
specific to each step of the combo.
After the third anim montage is finished, the Integer resets to 0, starting the cycle again if the left mouse button is pressed again afterwards.
Yet, whenever I try it, “Attack_Counter” is always stuck on 1. It never increases.
Can someone please tell me why this is the case? Am I missing something?
Heres the Code. Sorry if its a bit… messy. Im still learning.
Compounded delays look like an issue.
Instead of using delays. Why not add an anim notify to each of the montage anims. Have those notifies call an event that sets your bool and counter.
Ok, I tried it and it still doesnt work…
Here is the changed code.
Character_BP:
Tiksia
(Tiksia)
June 20, 2023, 11:04am
5
Both version should work as far as I can see.
The delay in first version is fine.
You are not overriding the the variable somewhere else?
And you dont have two variables with allmost same name?
I.e. “Attack_Counter”, “AttackCounter” or “Attack Counter”?
Diffect variables, but will be displayed the same in blueprint
I checked my code again. As far as I can tell, I don not set this value anywhere else.
My variable names are also diferent enough, that they should not cause any problems.
Is there perhaps another way to make a combo attack without using integers?
Sorry for asking so much.
Tiksia
(Tiksia)
June 25, 2023, 2:39pm
7
Lots of otherways to do it properly.
I just tried to make prof-of-concept, and can’t see any wrong with your way of doing it.
Its working fine for me.
You can see the code that worked for me here:
Try to either debug, and see, or put in some more “print string” nodes to see whats going on.
Hello again,
I have looked over my code again and implemented the fix.
The Integer itself was working.
It turns out, I had the Integer reset to 0 elsewhere. ^^`
Guess I deserve a Dunce Hat for that one…
Thank you all for helping me and giving me more Insight into this topic. I learned a lot this way.
Sorry if I wasted anyones time.
usa423
(usa423)
July 1, 2023, 5:16am
10
If you just want to add ONE to an integer. I suggest you use the “increment integer” node. And you won’t even need to set your integer. Simply plug a get of your integer into the increment node. And hook an exec to that inc integer from whatever you want with an exec output.
Tiksia
(Tiksia)
July 4, 2023, 9:31am
11
Np, glad you got it working