So Event Begin Play is sending one pulse when play is started. But if that feeds into get actor of class whose output is promoted to an OBJ variable, and that feeds a bind event dispatcher from another bp where it was created and called. Will that still work ok for this? Being that when the event dispatcher is fired will not be at begin play.
Had to read this a couple of times
Iâm still not sure if this is what youâre asking for, but still would like to give it a shot:
-
Create the dispatcher in the actor you want:
-
Call it after some specific event youâd like:
-
In a different actor (ThirdPersonCharacter in my case), bind the dispatcher on Beginplay after getting the actor (the way you specified):
-
Profit?
Edit: Video fixed
Thanks for trying to help me. My problem seems to be my Event Dispatcher is not receiving fire. In a Beat Em Up style game. I have a barrel actor that the player can pick up and throw. I had it working but things happen and you easily break your game and stuff lol. SO, in the barrel actor bp I made an event dispatcher ârelease barrel dispatcherâ dragged it in and called it, set a print string to prove the event dispatcher is getting fire when it should.
Then in the third person character I get the barrel reference and bind that dispatcher, yet I get nothingâŚ
So for some reason that Event Dispatcher must not be getting fireâŚyou might be able to help me out in more ways than one tonight. When I get refs, I generally just have a long line coming from an event begin play, but in that long line something must be happening to stop that getting fire. I will try to show you the whole REFS line and see if you can spot anything.
Bare with me this is a put together image.
Can you see anything in there that could cause it not to be getting fire? Thanks again!
Bump, any ideas why that Event Dispatcher is not getting a pulse?
im pretty sure the binding just isnt set, for instance youre using a doonce on tick, the tick fires before the bind is set then doesnt fire again.
try adding another bool after the bind and only allow it to call after that or find another way to call it
But it does fire againâŚcheck out that delay set to 2 seconds after the call dispatcher.
And if I have a print string there before the call dispatcher it fires every two seconds WHEN the character IS carrying a barrel AND the face button left key is pressed.
But over in the third person character, I get no fire.
Not sure how that will help me get fire over in the third person character bp though when I get fire to the call dispatcher, yet it doesnât carry over for some reason. Which is why I asked that about an event dispatcher in the op, I donât think an event dispatcher will work right on event begin play, but maybe it can?
It should be workingâŚI even simplified and went straight out of the event begin play to a get actor of class to the bind dispatcher and into a add custom event into a print string, and nothingâŚ
check all the refs are valid and report back, or use breakpoints
I havenât used breakpoints yet. But the weird thing is, I added an Is Valid just like you suggested and I saw it work one time, I then traded that custom event for a create event and thought I would get the ball rolling again. Then it stopped working again. An even when plugging back the print string like before. Sometimes it is like this program has gremlins in it lol.
@Everynone , any idea why this event dispatcher would not be receiving fire inside the third person character bp but it is getting inside the actor bp it is called from?
Apart from the fact that the name of the custom event does not match delegated event call event, it is hard to tell. Using Get (all) Actor node is always suspicius. You never know which actor.
Lets say you have 2 barrels. Which one do you think youâre getting?
you also need to rename the custom event in that example to match the dispatcher
can also try calling the event directly from the barrel
I used get actor not get all actors of class? I picked the only barrel actor that was there.
Such selectivity seems to be one of the things the level bp is for. I am thinking on a beat em up game, perhaps that is how you have an enemy walk up with a weapon attached already, perhaps that is done through the level bp.
So I had only one event dispatcher in the barrel actor bp and that is called in a place it needs to be to release the barrel.
Then back in the TPC, this time I chose to assign the event dispatcher and it went ahead and created the event, so perhaps that helps with the name issue. I did not know that an added custom event had to have a name that perfectly matched the event dispatcher name. I thought all it needed was a delegate to hook to.
And it that case, both of those print strings are firing, the one in the barrel actor bp and the one in the tpc.
Ok, so then I thought I could resume throwing barrels like a mad gorilla. So I just called an event after that print string and went to my detach lineâŚbut noâŚnothingâŚeven (and this really confuses me) that print string on the TPC side is no longer firing. No detaching, no cool physics, nothingâŚ
Honestly id redesign it, use an interface for interaction
say press âeâ for interact
on pressed if âinteractable refâ is notvalid trace forward to actor and set it as âinteractable refâ
if âinteractable refâ if it is valid call throwevent and set ref to null
this way it will work for all interactables, so barrels, crates etc
Youâre picking a class. If there are 2 barrels of that class spawned (or more), thereâs no telling which one will be returned. And what happens if you want to pick up / throw something else, other than a barrel.
As mention above, reference what youâre picking up. Get (all) Actor of Class is a bad / lazy approch. It had its uses, this is not oje of them.
Inheritance could work well ebough - interact with base class only. And interface could work better. And combining both would be the best.
I also see Tick + Delay, also unmanagable in the long run. Consider event driven approach whenever possible.
Well, you may be right, with this particular event dispatcher Iâm dead in the water. Honestly I have never used an interface, so I have been watching some vids on it and trying it out. The button to interact will be the gamepad face button left. So I imagine that will feeding the call like part of the interface inside the third persob character. So I made a new interface and set it up like this video. https://www.youtube.com/watch?v=wGmlKbllPcw
I will try to re-adjust a weapon(barrel) blueprint for the interface.
In the character bpâŚ
- Im first checking if the player has any weapon. If false proceed
2.Im checking if the TPC capsule is overlapping with the weapon parent REF (which is parent for all the weapon BPâs)
Then I go into the interface, wasnât too sure about the inputs there.
Now in the barrel bp, I guess just start off slow and try to attach. But so far Iâm not getting any fire, not even a print string.
Any and all help is appreciated.
If not a cast or a get actor(s) of class, how would I get that ref then? Could you explain this more?
I guess Iâm starting to see that now, but I have not used an interface yet lol. So that is a rabbit hole I have not went down yet. And while I have used Event Dispatcherâs before, I never claimed to be an expert in using them, and in this particular case, I seem to be having quite a time with this one for whatever reason(s). But hey, interface might be a better option for all weapon pickups / drops as to streamline the whole process. And like you said, finding a way to use that a long with Event Dispatcherâs even better.
I donât know what you have personally against high speed delayâs.
Ok, once again EN thanks for all the insight and tips and checking this out.
The button to interact will be the gamepad face button left. So I imagine that will feeding the call like part of the interface inside the third persob character
The interface goes into the actor you wish to interact with, not necessarily into the player (but it may help sometimes, too):
The premise it:
- the player pushes a button to interact
- if they have an item, they use it
- if they have no item, they search nearby for one
- what use means is up to the item itself to decide
- the interface functions:
- are implemented inside the interactive item:
- the player does the interacting:
You can combine the above with inheritance if necessary. In which case itâd be just he base class that needs the interface.
Itâs not personal at all. Why do something 120 times per second, flood the latent system, face nightmarish debugging scenarios when you can do something once instead and maintain a cleaner and more performant script.
I canât shake this off:
When I see the Tick + Delay combo. So yeah, itâs actually somewhat personal. ;p
Ok, this is first time I have used a interface. So we first search an add it, then double click open it to get to function window.
What kind of select node is that? Expand more on that Is Interactive boolean and index.
Lol ok.