Driven crazy by simple int check

Hello,

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?

Cheers

Hello Fredrum,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  3. Could you provide screen shots of any blueprints/settings that may be involved with this issue?
  4. Could you try placing a break point on the node that you think is giving you an issue and right click watch value to make sure that you are getting the correct results?

Hi and thanks for answering.

(1). I’ll try later but my main issue is to get a solution or workaround for my own project.

(3). If all else fails I will. There’s a lot and it doesn’t look pretty.

(4). Break point is that called ‘Watch this Value’ in Blueprints? To test this I need to build and run over two LAN connected computers. Can I read the breakpoint off a built/cooked game?
EDIT: I’m reading about adding breakpoints. But it seems to say I can only use these with the editor? That wouldn’t work for me as I need to test this over LAN. It is a 2 player game for VR.

I just discovered that the problem only ocurs on the Client machine (im using listen server - client). Not sure why I didn’t think to try this before.

It is still the same perplexing problem, why is is failing just because I do a (successful) check of that int variable?

Here’s an image showing how I print out the var on just the client and just for that Pawn that is meant to get the animation triggered on it. (works on Server).
So it still prints as ‘1’ and DOES get past the check but anim does not get triggered. (it does without the var check)

EDIT:
Downstream:

So here are two more pictures I am not sure how I can show you more clearly than this!
Note that when running the game like in the picture here that doesn’t work it still prints out the “SHOULD TRIGGER STAGGER” message from above previous picture client_err2.png


One more that doesn’t work but has the print after the check. (Also prints the other messages further downstream)

After taking a quick look at the information provided I have a couple more questions:

Additional questions:

  1. Is the variable replicated?
  2. If you set the variable Hit Level to 1 by default does this change the behavior?
  • No the variable is not replicated and calculated on each Pawn on all clients (server or not).

  • I tried changing the variables Default value from -1 to 1. No difference.

  • When I force the variable to 1 just before the check, it works.
    (it should be 1 already though as all prints claim it’s 1)

Another example of printing the variable and it should be already good.

Hmm…getting a bit closer. This one does not make it work.
Would you be able to derive an explanation for a situation that would result in these combined behaviours?

I have a probably somewhat un-orthodox hit mechanism going upstream. Maybe it has to do with that although I can’t see how that would explain the behaviour in previous image ‘client_trig3.png’?

And this works, (of course the LocallyControlled things can be ignored here).
So I have to now figure out what this means…

Hi Rudy,

if I wrote my own c++ BP node that I inserted, would I be able to create a breakpoint like that and check it in VS?

For a cooked/built game run?

Would it be possible for you to provide a zipped down copy of your project so that I could take a closer look? If you would like to provide it privately, you could do so by sending it to me in a private message on the forums via a google drive or drop box link.

Great I will try to reduce the size to fit in my dropbox. It is very large at the moment. I’ll send you a PM when I have that uploaded!

Hi Rudy, I am trying to find your Forum username to be able to send you pm over the forum. I can’t see anything resembling ‘triplett’…?

You will need to ensure that you use capital letters for the R and the T. I hope that this helps.

Example: ()

I tested the project, while playing in Editor. It appears to be working correctly. Does this issue only occur when using two different machines?

Yes it works when playing 2 player PIE and it works over LAN on the listen server machine.
It does not work playing over LAN and as Client.

I am just trying running the cooked game on my 2nd machine and playing as client in editor on my dev machine and so hoping that the debug tools could work that way.

It prints watched values but not making me any wiser. Either it prints 1 and True, which is not the effect I am getting.
Or when I am using the dropdown menu to switch to the other character it prints -1 and True. Does it not update properly by just switching in the dropdown?

(of course the effect I am getting is of a False but none of them say False)

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.