Announcement

Collapse
No announcement yet.

How to bind print string score to widget?

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

    How to bind print string score to widget?

    So i searched online and found tutorials of how to bind print score to widget, but the examples they give are totally different than my project and its hard understanding. I'm asking how would i go about successfully binding my print string score to widget so the widget will show the score. The first image is my spanner that spawns the enemies randomly right when the game starts. As you can see the node SpawnActor Thing(Enemy) and spawner reference is connected to get reference to self. The second image is my enemy BP and shows the score system. So how would i bind this to widget text? much help appreciated.


    Click image for larger version

Name:	A#!.PNG
Views:	1
Size:	183.0 KB
ID:	1162270


    Click image for larger version

Name:	a#2.PNG
Views:	1
Size:	225.0 KB
ID:	1162271

    #2
    In what form is your widget? Where do you create the widget? What is it that they do in the tutorial that you cannot do? You could use your widget reference to set a variable within your widget, cast from your widget, or many other things.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      like this image. In most of the tutorials they bind the widget score through Playercontoller or Playerstate BP and use get player controller when binding with the widget to show the score and i'm not using any of them. i just have a spawner and enemy BP. And i'm having trouble with doing this.

      Click image for larger version

Name:	bind.PNG
Views:	1
Size:	86.9 KB
ID:	1088623

      Comment


        #4
        Do you need Score Variable to be in 'Spawner Reference' blueprint?

        Why not set the Variable in the Playerstate or Player controller and when it changes add to it. Get your Playerstate/controller and increment just like you have done for the 'Thing' BP. Then make a variable in your widget for your Playerstate/Controller and then in your designer on the left hand side where it says Content > Text click on Bind then go down to your widget variable whether this is your Playerstate or controller and select Score Variable.

        This would be the way I'd do it. What I've mentioned above i'm not sure is 100% step by step you may have to fill in the gaps. Not on development machine to confirm. But that's the logic.

        Edit: Thinking again where ever you store the variable you may want to convert it to a string in your HUDBP and have the HUDBP as the Widgetvariable.
        Last edited by Conkerballs; 10-03-2015, 12:57 AM.

        Comment


          #5
          Ok, when and where are you spawning your widget?
          Marketplace Assets

          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

          Comment


            #6
            Ya i'm not the best in Bp and that's why im having trouble with this. Could you provide example BP or something?? Cause i don't know if this method will work entirley since you dont think it's 100% too. Thanks for the help!

            Comment


              #7
              The widget is placed in the world level and shows up at all times right when the game starts. Is this important?

              Comment


                #8
                Go into your widget, and create a variable 'Spawner Reference', the type will be the spawner blueprint. Make the variable editable and expose it on spawn in the details panel. Now go to wherever you have the 'Create Widget' node for your widget, and you'll need to link up the Spawner Reference input to a reference to your spawner. Now in your widget, you can access the score variable using the spawner reference. If you have trouble, I need to know where your create widget node is to be able to help you.
                Marketplace Assets

                Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                Comment


                  #9
                  Ya i'm having trouble. What do you mean by i need to know where you create widget node to be able to help you?

                  Comment


                    #10
                    You need a reference to your spawner for this to work. Where at in your blueprints do you add the widget to the screen?
                    Marketplace Assets

                    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                    Comment


                      #11
                      oh sorry. I put it in the level BP, but i don't know if i should put it there.

                      Click image for larger version

Name:	321.PNG
Views:	1
Size:	82.1 KB
ID:	1088688

                      Comment


                        #12
                        It really doesn't matter where it is, as long as you have a spawner reference to hook up to the create widget, which it looks like you won't in your level blueprint, unless the spawner is already in the world.
                        Marketplace Assets

                        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                        Comment


                          #13
                          So how do I creat the widget working. I gave you where my widget is

                          Comment


                            #14
                            So how do I creat the widget working. I gave you where my widget is

                            Comment


                              #15
                              Well it depends. Is your spawner blueprint already placed in the world, or do you spawn it in once the game has started?
                              Marketplace Assets

                              Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                              Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                              Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                              Comment

                              Working...
                              X