hi I’m new to unreal and I’ve got a question that’s quite…difficult to say the least
I’m using paragon wraith as my main character and I gave him kwang’s anim class,I’m trying to make a weapon switching system,but I also want to switch between Wraith’s and kwang’s animation class.
for example:when wraith is equipped with the sword,he uses kwang’s attacks
when he switches to the gun,he uses his own
it’s kinda crazy I know but I would appriciate the help
Hey @Son-Naruto! Welcome to the forums!
Not that crazy at all! The main thing you want to look into here is Enums! An Enum variable will allow you to have separate “classes” as it were. Then wherever any attacks or animations are concerned, you can use “SwitchOnEnum” to have your branching paths!
Then on the AnimBP, you can use that same enum and on “AnimUpdate” set the value of the enum to the one on your character BP! And then switch on Enum there as well. Just keep in mind the separation: every class you do is even more work!
switch on enum…hmm…that’s pretty helpful,could you dive in a bit more?
I wanna use set anim instance class,do they work together?
the switch system is ready,I just miss this
So there are a few ways to go about this: One being having all of the anims together in one anim BP but it looks like since you’re using two separate ones, Set Anim Instance class would be good as well. And that could work together with the Enum.
You should be able to just use that node “SetAnimInstanceClass” and pass in Kwang’s (if gun) or Wraith’s (if sword) AnimBP and it work just fine. The skeleton is compatible if I remember correctly, they should both use the standard UE4 skeleton.
thanks for the tip,but I tried doing that but when I switch to the gun and activate wraith’s animations,he goes into T pose,as if the blueprint doesn’t find it,even though I have the anim class in the project
Can you show your code? It’s pulling a null-reference exception, meaning the variable isn’t being set.
Try going into your AnimBP’s and replacing “EventBeginPlay” with “EventBlueprintInitializeAnimation”.
The Update isn’t starting, I’m sure!
in wraith’s?
worth a shot
still T pose…
I’m missing something I just know it…wraith and kwang have their own animation blueprints
this is simply my weapon switching system,I have no idea what it doesn’t work
Would you mind showing some more code? I don’t mean to push but if you’re looking for help it’s not very easy to know what’s going on purely by description. It could be a myriad of things. Why don’t you get some pics of the AnimBP?
Also EventBlueprintInitialize on both, not just Wraith.
Ok so a few things:
This pic here is saying that the “Input object is NOT valid.” If it was valid, the isValid path would be orange as it is before the check.
You need to create a reference to owner with “TryGetPawnOwner” on initialize. Then set that as a variable, say BPOwner or something. Then use that as the input object instead of tryGetPawnOwner for every usage (I know, these old codebases are weird). HOWEVER there is also this:
Make sure to throw printstrings on the “Cast Failed” outputs to let you know that it didn’t work! At this point I’d personally be throwing printstrings everywhere to try to figure out where the code stops working.
thanks I’ll give it a shot