Announcement

Collapse
No announcement yet.

Trying to wrap my head around variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to wrap my head around variables

    Quick intro. I'm a professional game artist, and the idea of using Blueprint to make and prototype my own games at home is really game-changing. So I come from a pretty technically proficient background.

    I'm trying to figure out how to handle global variables with Blueprints. Like a global variable to hold different states of the game (score, difficulty modifiers, etc). I can only seem to manage them localized within a blueprint. I saw some tutorials on using "cast to..." to access variables from other blueprints. Those work just fine, but they become unwieldy to do inside every single blueprint. It obviously becomes a chore pretty quickly.

    Loading up the samples supplied (the strategy game, and the new card matching one) I can't help but notice they seem to have an easy job of just accessing and using custom functions and variables all over the place with no "cast to..." wizardry.

    What part of this am I missing? The only thing that stands out to me is that in my project I'm pretty much spawning everything on "Event Begin Play" in the level blueprint instead of placing things implicitly in the level. Is that the real secret, I just need to dump my objects somewhere in the level so they exist in a more permanent sense? It seems like I would lose, for example, the ability to place enemies randomly in the level that way.

    I'm sure there's just a concept I'm missing, or some approach to my workflow that's causing this. Any help in clearing this up would be awesome!

    #2
    Global variable can be managed in two place, level blueprint and gamemode blueprint.
    If you are planing to make anything that works in a multiplayer way, put them in gamemode(which only lives on server.)

    You would have to check blueprint communication tutorials the Epic already made, so they are not exactly custom function all over the place.
    And they do need to use cast if they want to call a function/event only available to that class.
    Unreal Engine 4 Game Framework diagram for relation of all major base object types
    Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
    Resident Evil Classic Camera
    RPCs official document, Must Read
    Everything you should know about replication

    Comment


      #3
      I was about to go to bed but I had to help you simply because your Name is Awesome...really...I'd be in bed otherwise right now...

      They are Making a Variable of the other Blueprints and calling (casting kinda) the events from those variables....
      I found a good example in the card matching game you mentioned....

      Here's what they are calling from the Blueprint_BoardM
      Click image for larger version

Name:	activatehere_by_presidentnelson-d7gsmxr.png
Views:	1
Size:	116.4 KB
ID:	1050392


      Here's how they called it
      Click image for larger version

Name:	castfromhere_by_presidentnelson-d7gsmxo.png
Views:	1
Size:	209.8 KB
ID:	1050393
      Bottom left of the pic you'll see a variable they set the variable type to the same Blueprint from earlier BoardM .... from there a simple "getter" version will have all the Events and Functions that BluePrint has to offer as seen on the upper right - Clear Table....

      once again Awesome name...hope this helps...if not feel free to ask for any clarification...

      I'd dig around the card game and find a few examples of your own...you'll catch on in no time...

      Streams: www.Twitch.tv/BlinkTheory
      Patreon: www.Patreon.com/BlinkTheory

      Comment

      Working...
      X