Driven crazy by simple int check
this one is hard to describe and probably hard to believe but I have now for 5 hours tried to work out what is happening without success, so I thought it must be a bug and maybe someone else knows about it.
Sorry I can't show exactly what is happening because I have some very project specific functions. That doesn't matter though because if I am correct then this is super strange whatever I do down stream.
I have this variable called 'HitLevel' that I calculate on component hit based off velocity vectors.
I Print this value just before comparing with it and it prints as 1. (it really does)
Then I do this comparison,
Later downstream I print some more text to verify that I get that far.
I then try to trigger a montage animation. But when I have that check in the picture in there, it just won't play. It does print the debug text I just mentioned immediately preceeding the montage setoff.
Super strangely if I don't have the check with 'HitLevel', if I dis-connect that variable and just type in '1', as in 1>0, it then plays the animation. (and prints the message of course)
Two things are very strange. Why does it not play the animation even if it gets through the variable check, proved by my printing the second message? And why would it be doing two different things when I just do a check with a variable. (it shouldn't as I test before with the print). I don't use that variable in the animation functions, but also I don't change the variable.
This is driving me crazy! Please say that you have an idea what's happening?
Aha I'm pretty sure I have found my problem! Though I haven't got the fix yet I'm super happy to at least have identified the issue. When I force the last bit, the one we have been looking at, to only execute only on the client it just doesn't play at all. It's something to do with it not being the owner of the client and attempting to do a RPC I reckon. When it was working in the example above when setting the var directly it was actually playing and replicating the animation off the server. When I thought I made it work I actually didn't and it kept me thinking in the wrong way. I'll change how I do this tomorrow but I'm pretty sure there won't be any trouble.
answered Feb 21 '17 at 04:20 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here