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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

GameState Casting Issue

I was told to try and use GameState for this goal I am trying to accomplish which is to stop a pick up counter from resetting when the player dies. The goal of this game is to pick up pants as a car (don't judge my game here LMAO). For some reason the pants pick up counter resets to 0 upon death.

I tried to use GameState (Learned most of has to do with Mulitplayer stuff) but I can figure out why I cannot cast a variable from Game State that has been stored in the GameState itself. (Yes I did go to the world settings and enable this game state to be used) How do I fix this problem?

alt text

When I try to connect the "As Game State" to the "Target (self)" it says that it is not compatible. I do not know why this is happening. I tried to restart the engine to see if that fixed it, but it did not.

This issue is killing me. I really cannot solve this and I feel so silly I cannot do this correctly.

Product Version: UE 4.20
more ▼

asked Nov 18 '18 at 12:16 AM in Blueprint Scripting

avatar image

8 2 1 3

avatar image Voyager_871 Nov 18 '18 at 12:24 AM

Okay now I got another issue. Choosing a new GameState aside from the original causes my game to be frozen on play. Like my pawn refuses to move and actors that rotate will not move either, but sounds play normally. One problem after another. This is exhausting.

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

2 answers: sort voted first

Answer is in the comments

more ▼

answered Nov 18 '18 at 04:03 AM

avatar image

8 2 1 3

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

Okay, have you set the int 'PantsUpCounter' in the game state? Also, regarding the image you supplied us with, the target for 'PantsUpCounter' would be applicable with the 'As Game State' cast to node.

Also, create your own 'BP_GameState' and make sure that the Game Override for your map is set to include 'BP_GameState' as your Game State. When you go to cast to this object, you will search for 'BP_GameState'. You will not cast to the default 'GameState' unless you have set the variable there.

more ▼

answered Nov 18 '18 at 01:21 AM

avatar image

69 1 5 8

avatar image Voyager_871 Nov 18 '18 at 02:18 AM

Hey Thanks for the reply! Yeah I casted the wrong state like a dummy. Also I noticed the game was frozen because I created a new game state bp that referenced game state when it needed to be referenced from Game State Base. Thanks a ton dude. I am now going to rework this and see if it works! I let you know if it does. You are a hero

avatar image Voyager_871 Nov 18 '18 at 02:29 AM

IT WORKED. Thank you so much. I would have never been able to figure this out on my own. Thank you. I am definitely going to add you on the credits page for helping me.

avatar image Debaucher Nov 18 '18 at 03:09 AM

Haha. Do what you please! Glad to help you. (:

avatar image Voyager_871 Nov 18 '18 at 04:02 AM

My Insta is Seniattusstudios You can check out my game progress there if you'd like! Right now I am creating a save and load function for the game. Really daunting stuff.

(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