Download

How to Fire a Event when a button is clicked ?

What im trying to accomplish is having my weapon switch by clicking/touching the button, i manage to accomplish it through keys but when trying a Event Dispatcher and Binding it wont work… im probably doing it wrong can somebody help me out. Thanks

This is a problem solved best by watching tutorials on the subject of UMG, widgets, events, dispatchers. I’m not trying to discourage you or anything, but did you even consider that there might be a solution to what you are looking for that can be reached much quicker if you only searched the documentation. In fact, I encourage you to watch tutorials to avoid future complications in your game projects. Plus it is far more interesting to discuss blueprints on forums when you have gained more knowledge on the matter.

It would also help if you could be a bit more descriptive as to what you’re trying to achieve. Are you trying to switch weapons via some UMG widget? If yes, you can get your player controller and trigger a custom event.

sorry if i not clear is not a actual control button is a inventory button i got in my widget game hud which i would like to use to switch the weapon instead of pressing number key, as you yo can see in the screenshot my weapon configuration is set to switch when pressing number 1 and 2 but i want to change that to my inventory button so when click or touch (since it will be a mobile game) switch the weapon.

Try this;

OnClicked -> GetPlayerController -> Get Controlled Pawn -> Cast to HeroCharacter -> Equip Weapon System

See if something like that works. :slight_smile:

1 Like

Thanks for the reply, actually i did watch a lot of tutorials but majority of the people are making the same tutorial, same thing different person for example " pickup items " just to name one and you’re right this could be a more in interesting thread only if people share there knowledge with newbie like myself. I have a great portion of my game ready but currently stuck in tree obstacle which are
1). Switching weapon through a button in my HUD instead of using numbers keys
2). Unlocking a inventory slot when a person purchase the item
3). How to establish a InApp-Purchase feature

If you know about a good tutorial or documentation on how to accomplish this please point it out. Maybe the solution is out there but with my lack of knowledge i can’t wrap my head around it that why im here looking for help, guidance, blueprint example from expert who know how to achieve this.

It work!!! thanks you!!! your are a life saver thanks again :wink:

I would LOVE a tutorial on this! Being able to purchase DLC stuff from the google play store and from steam is paramount for a few of the games I’m making.

Here’s a breakdown how you would do it with keyboard input rather than on button click.

Thanks, that helped me !