Announcement

Collapse
No announcement yet.

HowToCastToActorClassBlueprint..

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

    HowToCastToActorClassBlueprint..

    I have tried almost everything. Even get all actors of class as the object pin and no matter what I do I cant seem to cast to a actor class blueprint? Does anyone know the answer to this?

    #2
    what exactly are you trying to achieve, show us your BP.

    Comment


      #3
      Its very basic, I have a actor blueprint called secret. I collect the secret which sets a Boolean inside itself to true sayin collected and makes the secret mesh hidden.
      I then get to the end level trigger and in the trigger blueprint I want to cast to the secret actor blueprint to get that Boolean and set another Boolean in my save game file to true.
      The reason I want to do this in the end level trigger is because I don't want the player to be able to collect the secret without completing the level.

      I have searched the whole internet on unreal and nowhere ive seen does anyone ask about casting to an actor blueprint to get a variable. Maybe I'm doing something wrong.

      For my other collectables I casted from the collectable to a variable in my player blueprint so it knows the amount. Then when I reached the end level trigger I casted to my player bp to get the collectable amount to check it against the full collectable amount in the level and then saved the collectables collected Boolean in my save game. This seems like a lott of casting and id rather just cast to the actor blueprint if it is at all possible.
      Thanks for the quick reply
      Last edited by viggerz; 10-09-2017, 05:44 PM.

      Comment


        #4
        Classified. Mind your business.

        Comment


          #5
          Originally posted by viggerz View Post
          Classified. Mind your business.
          It is really hard to help someone without an example. For all we know you've misunderstood a concept, are using a node in the wrong location, or almost anything else. If you are having this trouble in a 'super secret project', you could at least attempt to recreate the same scenario in a dummy project, or in an 'unclassified' area to show us what you're currently doing. If you feel like this is going to make you look silly, don't worry about it; We've all been there.
          Marketplace code plugin: AesTargeting - Make your Actors targetable =)

          Comment


            #6
            lol it was a joke. It is very basic I will show you a pic but it is as I said. I cant figure out what to put in object in order to get the variable from the cast.
            Last edited by viggerz; 10-10-2017, 02:39 AM.

            Comment


              #7
              Click image for larger version

Name:	
Views:	0
Size:	252.6 KB
ID:	1367099

              Comment


                #8
                Well, you need something to cast it. The "Object" Input for the Cast node is empty.
                You probably want to load it from your SaveGame? You may also store it somewhere else, simply set your variable/bp variable to public and retrieve it just with a get node and plug it into the Object-input

                Comment


                  #9
                  I'm getting abit confused now. I don't want to load it from the savegame yet. I have loaded the savegame slot here because once I get the secret collected variable from the cast. I will set it to the savegame variable. I'm just trying to pass information from the actor bp to the savegame bp through the end level bp I'm using now. I'm going to load from the savegame bp on the level selection screen where it shows the scores and also load it at the start of the level begin that its on so it hides the collectable once collected.
                  The variable save collected? is the variable I'm after and it is already public that's how I'm getting it from the cast.
                  The thing that's confusing me is, how can I cast to the variable I want and then plug it into the object if it hasn't got an object to cast it in the first place?
                  Do you mean I should promote the actual secret blueprint to a variable then wire it into itself? Because doing that puts a note on the cast saying the variable is already itself so theres no need to cast to itself. Surely casting to an actor blueprint is the same in every instance and one thing should go into the object to get the variable from the blueprint that I need.
                  Last edited by viggerz; 10-10-2017, 04:11 AM.

                  Comment


                    #10
                    Where is your SecretBlueprint? In your Actor that enters the LevelEnd Collision?
                    If so, drag off the "Other Actor" from the Overlap Event and cast it to your Actor class that contains the SecretBlueprint. Then simply retrieve it with a get node.
                    Then you don't need to cast to Secret BP anymore.

                    We don't know your setup and don't what you are actually trying to achieve.

                    Comment


                      #11
                      The actor bp is just a spawned mesh in my level. it is just a secret collectable. My main character collects it, it sets a the Boolean secretcollected? inside itself.
                      How I set it up is I made a actor blueprint, put a mesh in it, made the mesh on overlap to hide itself and set the Boolean inside itself to true so I know its collected. I'm just trying to retrieve that variable from within.
                      Last edited by viggerz; 10-10-2017, 04:29 AM.

                      Comment


                        #12
                        This is the actor bp I'm casting to. You can see it is just a variable within an actor bp I put in my level.


                        Click image for larger version

Name:	
Views:	0
Size:	269.7 KB
ID:	1367142

                        Comment


                          #13
                          I would show you it in the level but the file size is too big and its just a mesh anyway

                          Comment


                            #14
                            All I need to do is know how to cast to an actor blueprint to get a variable. How do I know what to use as the object because nothing seems to work at all
                            I even tried cast to actor and using that to cast to the actor blueprint...

                            Comment


                              #15
                              You might have to Click on the empty object pin on Cast to Secret Blue_Print and click make into a VARIABLE'.

                              Comment

                              Working...
                              X