x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

RESET BUTTON

How can I reset my coin widget (0) back to 0 after I press PLAY and RESET button. At the moment coin widget goes trough Game Instance so it stays the same all the time even when I press PLAY or RESET button. What would I add to OPEN LEVEL. ![alt text][1]

Product Version: UE 4.12
Tags:
game reset.png (127.7 kB)
more ▼

asked Jan 16 '17 at 05:54 PM in Using UE4

avatar image

silverfish1000
124 11 22 27

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

In the OnClicked event for your button, get a reference to your Game Instance and set the value to 0.

more ▼

answered Jan 16 '17 at 07:03 PM

avatar image

CleanCut
2.1k 67 84 77

avatar image silverfish1000 Jan 17 '17 at 03:46 AM

What value is that? Where would I see that?

avatar image CleanCut Jan 17 '17 at 05:26 AM

The variable that you stated the coin widget gets from the game instance. Set its value.

avatar image silverfish1000 Jan 17 '17 at 03:07 PM

Clean Cut don't let me stranded. Game instance is really confusing to me. Would I set these up in PLAY button pressed. Get coin widget doesn't show up If I type get coin widget. It does in my game mode. Could you quickly tell me what do I need to call and how to connected properly other wise I'm gonna sit at the computer whole week..Lol. Thanks for the answers though!!!

avatar image silverfish1000 Jan 17 '17 at 03:19 PM

Here is actual text node from Coin widget. There are to text widgets one for Highest LV completed and another one for Coins Collected. How do I send message to reset it when I open level on button pressed. Also I can only Cast to game instance and can't GET game instance inside the button pressed blueprint. alt text alt text

avatar image CleanCut Jan 17 '17 at 06:11 PM

I think perhaps you have not gotten as far as I thought.

On your coin widget, have you used the "bind" key to bind the value of the coin to a function? Did you set the function up to get a value from the game instance? That is what I thought you said you had already done in your first post.

avatar image silverfish1000 Jan 17 '17 at 07:00 PM

Thanks Clean Cut. Yes it's all working. If you collect coin it will added to Text (01) in game menu. Also it goes trough Game Instance as Coin Bank. So when player dies the Coin Count remains in my Main Menu Widget and when I press play again to begin new game after i died the score (01) is still there. I just don't know or what to connect to my PLAY button to begin fresh at (00) coins collected. I connect level reset but nothing happens. Clean Cut get me out of these mass. HELP!!!!

avatar image CleanCut Jan 17 '17 at 07:06 PM

Can you show us what your functions "GetText0" and "GetText1" look like?

avatar image silverfish1000 Jan 17 '17 at 07:14 PM

Here is the Coin Widget Bind blueprint. alt text

avatar image silverfish1000 Jan 17 '17 at 07:17 PM

And here is the New Game Instancealt text

avatar image CleanCut Jan 17 '17 at 07:17 PM

Okay, so in your "OnClicked (Button_55)" do the "Variables > Default > Get Game Instance", then drag off of that and do "Set Coin Bank" and set it to 0.

avatar image silverfish1000 Jan 17 '17 at 08:49 PM

I tried but Text Values still stay from previous levels. Still not resting. How come it's not setting values to 0? Strange. Inside the level blue print I'm calling Coin Widget on Level begin but shouldn't the Set Coin Bank (0) filter it back to 0. Like you suggested.

avatar image shotty46290 Jan 17 '17 at 08:57 PM

The game instance is persistent to all maps, the game mode is only persistent to the current level, so if you switch levels all variables in the game mode will go back to default

avatar image silverfish1000 Jan 17 '17 at 09:14 PM

Well my Coin Bank is in the Game Instance and if I called in my Game mode it shows in every level with the highest Coin Count. If you don't Create Widget --Add to View Port inside Game mode then it will not show up in every level and you have to to call your widgets inside ever level. So Game Mode puts in every level Automatically. That's why I call Coin Widget inside my Game Mode. Actually just now I tried taking it out of Game mode and called them in first few level individually but that didn't do nothing.

avatar image silverfish1000 Jan 17 '17 at 10:16 PM

What do you mean by switching levels?

avatar image silverfish1000 Jan 17 '17 at 10:11 PM

Also I tried connecting Coin Widget I got two On Level Begin but still not Resetting on PLAY button pressedalt text.

avatar image silverfish1000 Jan 18 '17 at 03:18 PM

What was needed at the beginning was Cast to game instance and of course open level at the end but you were right all along!! ----THANK YOU CLEAN CUT! YOUR THE MAN!! -----

avatar image silverfish1000 Jan 17 '17 at 07:27 PM

Here is my PLAY button blueprint. These is where I think the reset function should be on PLAY button. I put in Reset Level but that's not working. Only Opens up a level with Coin Widget un reset. Where exactly do I need to put the values you mention. Game Instance, Coin widget, Coin_BP, Game Mode inside the Coin Widget (00) Bind? The Coin Widget I think. alt text

play button.jpg (140.0 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question