Change in another Blueprint -> Event called no more

Hello,
I am currently trying to script a simple system for using weapons in a third person shooter.
Therefore I have a base Class “Weapon” which has all properties and main events.
Additionally I have a class which inherits from weapon. This class is an actual Weapon which can be used in the game. In this class the actual shooting mechanism is implemented.

Now I have the following problem: As soon as I change the actual weapon class from a weapon which just uses raytracing to a weapon which fires a projectile, i does not stop shooting anymore.
The two scripts for actual shooting can you see here:
Shooting a ray (works just fine):

Shooting a projectile (does not stop shooting):

Both are implemented in the same script, I just attach the start event to the one or the other to change behaviour.
Now the player controls the weapon with this script (in the player-character blueprint):

The Left Mouse Button Released Event fires in either case. I checked this. Also if I set a breakpoint at Event Stop Fire, this breakpoint kicks in.
Now the following script is in the Weapon parent class:

An I could see that the Event Stop Fire is not triggered if the actual weapon uses the projectile method.
But what I think is very strange: I can clearly see, that the event is called in the player control. Only in the weapon base class, the line between the Event Stop Fire and the Set Variable does not turn orange.

Can anyone think what causes this behaviour?
Thanks in advance.

I am not exactly sure how events are handled but it looks like you have build an infinite loop with your start fire event. The event is recalled as soon as it is finished.
You could use the start/stop fire events to simply set the variables and then do the actual firing in the Tick event: That way you avoid the loop.
Why it is bahaving differently for the raycast version I don’t know. Maybe the error is obscured by something in that case.

Thank you. That helped. But now it is harder to have a correct delay.
Do I have to do this with the current time? Because the Delay does not work anymore.

That is strange. Delay should work in the Tick event. Can you upload an image of your new graph?

Well, the delay probably works. But the delay in the tick event does not delay the next tick event.
The Graph looks like this:

What I want to do is to force the weapon to wait between two shots while the mouse button is pressed. Additionaly it should also wait if the user does not hold the mouse button but clicks a few times.

Thank you. That solves the problem.
But now the delay also counts for the first shot, so when the mouse is clicked, the weapon is fired after the delay.
I know this could be solved if all was in an own function and then call the function once after the mouse click and then set the button to pressed so the tick event fires while the mouse is pressed.
But then the player could just click the mouse again and again and therefore fire faster than it should be.
So, is delay the correct way to go or is there a better way?

I believe putting your delay node in front of the fire weapon node should solve the issue.

If you want to do other things in your Tick event, the delay node can become a problem. In that case your could create another custom event called ‘HandleFire’ (or whatever) that gets called by the Tick event. That way you could put all the nodes that are currently in the Tick event in the new event and the delay does not interfere with other ‘OnTick’ code.

You solve that by using a ‘gate’ node. I don’t have access to a blueprint editor right now but I will try to explain.

  1. Put a ‘gate’ node right in front of the ‘fire weapon’ node.
  2. Connect the ‘branch’ node’s True pin with the Enter pin of the ‘gate’ node.
  3. Connect the Exit pin of the ‘gate’ node with the ‘fire weapon’ node.
  4. Put a ‘sequence’ node right before the 'delay node.
  5. Connect the First pin of the ‘sequence’ node with the Close pin of the ‘gate’ node.
  6. Connect the Second pin of the ‘sequence’ node with the ‘delay’ node.
  7. Connect the Output pin of the ‘delay’ node with the Open pin of the ‘gate’ node.

I think that should work.

Thank you,
I did what I understand from your description.
This is the outcome:

I am not sure what I should connect to the in-pin of the sequence node.
Maybe I missed something in your description. I am sorry, I am new to this.

That looks pretty good already. The only thing missing is a connection between the ‘set current ammo’ node at the very right of the graph and the input of the ‘sequence’ node.
You also have to uncheck the ‘start closed’ boolean of the ‘gate’ node.

That way the gate will be closed after every shot and reopened after a certain delay. And since it starts opened the first shot will be fired right away without any delay.

Oh man. Thank you very much. It works how intendet.
Thanks.

You’re welcome. Good luck with your project!