These reference issues… I havent run into one in a while, but here it is again.
I noticed that there was a delay between when AI would hit my character and when damage calculation was completed and printed to screen. I found that if I used a AnimNotify and applied the damage there that would work nearly instantaneous.
The problem is that I need to reference the Function that sits within the AI Character BP then return that output to the Apply Damage I have in this AnimNotify.
This is the first time Ive attempted this, ive always had the damage in the character itself, but the 1 second delay bothered me.
Anyway, I cant figure out how to get it to work, or even if its possible to reference a character inside an AnimNotify.
Mouse over the blue note. You don’t need to cast, AIREF is already an AI_Character_Master.
1 Like
Yeah I know that. i was putting it there to show that I had attempted it.
This seems like it should work, but its returning a NONE error.
Ok, how did you set the AI reference?
1 Like
Thats kind of my point; I dont know how to set it if CAST doesnt work.
Right, you haven’t set it. You have a variable there, but you actually have to point it AT something
TryGetPawnOwner → cast to AICharacter
Any good?
if that doesnt work, i do something very similar via creating a ‘Anim Notify State’ blueprint.
I know exactly the issue you’re struggling with when it comes to that delayed damage, i’ve got the same issue. i have not yet tackled it. I wanted to avoid running anything in an anim state because i feel like if the player hacks his attack speed in some way it could lead to some bad infinite attack speed issues. No idea tho, im sure there are ways to avoid it haha.
2 Likes
Ill look into an Anim Notify State BP. Havent used those but ill give it a shot.
I should add that shouldnt you be able to control for that sort of hack by doing the calculation on the server?
EDIT: i did try that get actor owner , but it didnt work. ill try that first.
Likely yes, by adding in some sort of timer that sets a flag true or false. Something like ‘canattacktimer’ and after the first attack its set to false then the timer on server sets it back to true after 2.1 seconds (my attack time).
Bingo. That was the solution. Thank you. Credit given.
1 Like
I was trying to get owner then SET the AI REF, which i didnt need to do at all. In fact, I can remove that VAR completely.
ya definitely no need for it unless you plan to call to that variable to use it for other things (which im not even sure how you would cast to an anim notify state haha). Remember to use get owner when it comes to casting, it’ll be your best friend! Its saved my casting time and time again, although i’ve had to get tricky with it depending on where its being used. Sometimes i’d have to cast to something else or get the owner for something else just to cast to another thing haha.
So this issue popped up again. Before it worked because I was just setting up one side of the combat and using the player character as the target. The thing is, there is no player character, its basically a team of pawns attacking another team of pawns.
So i tried setting up a Game Mode VAR of Target and calling that inside the AnimNotify, but it wont complile. Guess its read-only for some reason and cant actually be SET.
Cant think of a way to pass the target into the AnimNotify like I did initially with the player character.
Might be forced to move the Apply Damage outside of the AnimNotify which is lame. I did it there because I didnt like the 1 second delay between hit and damage numbers being shown. The character would already be turning around to head back to start location before the damage was shown.
so this worked. first time i havent had to SET the REF…
i was kind of confused as to why you were setting the game ref, the only reason you ever set something is if you plan to call to that variable from outside that function or to just use that new set variable in multiple places inside that blueprint so you have cleaner looking code.