Announcement

Collapse
No announcement yet.

Journal Entry Menu

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

    Journal Entry Menu

    I'm trying to make a menu that brings up collected journal entries in the game from the pause menu.

    As of right now, once you pick up the journal (Notepad1) and look at it, the journal object is destroyed and a Bool variable (Notepad1_Collected?) is set to true. I'm trying to set the buttons on the journal menu to only be active once that Bool has been set to true but I keep getting a Compiler warning when i try to cast to the notepad (the journal) object that is causing the rest of the blueprint to fail.

    The warning says "Notepad1 does not inherit from character (cast to notepad1 would always fail).

    Also, i was trying to get the color of the text on the buttons for the journals to change once the journals have been picked up but i couldn't figure that out either (pretty much getting the same compiler warning.)

    Just in case the forum won't let me get a picture on this thread, here's what i have:

    OnClicked(Journal1_Button) -> Cast to NotePad1 (Object -> Get player character) (As NotePad1 -> Get NotePad1_Collected? -> Branch Condition) -> Branch (True) -> Remove from Parent -> Create Notepad Widget 1 Widget (Class -> Notepad Widget 1) (Return Value -> Target) -> Add to Viewport
    Click image for larger version

Name:	Journal Menu Compiler Warning.png
Views:	1
Size:	223.4 KB
ID:	1185126


    At the current moment i'm using UE4 v.4.10

    #2
    Hey Millert2008,

    It looks like you are trying to cast to the Notepad1 blueprint/widget with your player character. The object which you need to reference here would be the Notepad1 BP that you have created at some stage, as the character is not/does not inherit from the Notepad1 class in any way, so it is likely to always fail.

    If you have the notepad1 reference in your character you can cast to your character, then get the reference to it through there.

    Just another note by looking at your BP code, When you remove the widget from parent, there could be some unexpected results occurring with everything after that. If you want to do something when it is being removed, i believe there is a function override which allows you to create an event which will trigger when the widget is being removed/destroyed. I would suggest checking that out or simply moving the all the code after the "Remove from Parent" before it.

    Hope this helps!
    CCG Toolkit | Mutliplayer Card Game Framework: On the Marketplace | Support Thread

    Point and Click Adventure Toolkit | Adventure Game Framework: On the Marketplace | Support Thread

    Comment


      #3
      Thank you for your response.

      I tried to add a reference to my NotePad1 BP but now i'm getting a different Error from NotePad1 reference.

      Click image for larger version

Name:	Journal Menu Compiler Warning 2.png
Views:	1
Size:	313.6 KB
ID:	1107331

      Comment


        #4
        Also, I just noticed that it's not letting get a reference to the BP it self from the cast object.

        Click image for larger version

Name:	Journal Menu Compiler Warning 2_a.png
Views:	1
Size:	308.5 KB
ID:	1107332

        Comment


          #5
          The reason for the error is because "Self" (The widget witch you are working in) does not hold the reference to Notepad1. The question which comes from this would be Where are you creating the notepad widget and adding it to the screen?

          If the widget does not yet exist then you wont be able to get anything from it. Casting itself is simply a check/ safeguard to make sure an object is the correct class type (or inherits from the class) so you can access data from that class without it breaking or using anything that can be considered invalid.

          As mentioned before, if you had created the Notepad1 widget through your character (and stored a reference when it was created so it can be accessed later on), then you will need to cast to your character in order to get that reference. If the reference stored IS a Notepad1 class, then you will not need to cast again and you can get that variable and drag off again to get data from it. If the reference was saved to a different class type then you can cast to the reference (which possibly came from your character) to get that data.

          Check out: https://www.youtube.com/watch?v=E-PyDlvEQog

          Hope this is a bit more clear!
          CCG Toolkit | Mutliplayer Card Game Framework: On the Marketplace | Support Thread

          Point and Click Adventure Toolkit | Adventure Game Framework: On the Marketplace | Support Thread

          Comment


            #6
            The notepad widget is being called in the notepad BP actor that's placed in the scene.
            Click image for larger version

Name:	Journal Menu Compiler Warning 2_Notepad1_BP.png
Views:	1
Size:	340.0 KB
ID:	1107453

            Comment

            Working...
            X