Announcement

Collapse
No announcement yet.

Turn off the lights in the room by clicking on the switch

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

    Turn off the lights in the room by clicking on the switch

    Hello. Me need create a swith on the wall in the room for turning on/off light on chandelier by clicking on swith. This is two differents objects. And need appear hint like a "press "e" for use" when cursor on the swith. Maybe can make together lesson for this situation.
    P.S. sorry for my english.
    Здравствуйте. Задача в следующем. Нужно сделать так, что бы выключатель расположенный на стене в комнате. выключал и включал свет на люстре. Это должны быть два разных объекта. И еще должна появляться надписть на подобие "намтите "Е" что бы использовать". Возможно объединившись сможем сделать урок.

    #2
    Hi there,




    and

    https://www.youtube.com/watch?v=jHxUisYmuAg

    should get you started
    Do Not Argue Toxic Game
    Balloony PoP get it on Google Play
    Fishy Blub Blub
    get it on Google Play

    Comment


      #3
      this is not exectly what i want

      Comment


        #4
        Hi, Denton,

        Is this being done in an FPS type of game? If so, do you want it to work that the object will only activate when the center/crosshairs of the player's screen is over the object?

        Comment


          #5
          yeah. FPS, for crosshairs objects

          Comment


            #6
            Hi DcDenton,

            i had the same problem a few days ago. Here is a short tutorial on how you can make a switch.

            1. Go to Blueprints: Right click on "Blueprint_WallSconce" --> Create Copy = name it "MyWallSconceBP"

            2. Open MyWallSconceBP in your Blueprint Editor, go to EventGraph

            3. Right Click --> Choose "Custom Event" = name it "LightSwitch"

            4. Drag PointLight2 into the EventGraph, choose "get". Look for "toogle visibility" and connect everything together. Compile and save.

            Click image for larger version

Name:	mywallsconce.jpg
Views:	1
Size:	51.5 KB
ID:	1050920

            5. Go to Props --> Right click on "Material Sphere" --> Create Blueprint using.. = name it "LightButtonBP"

            6. Open "LightButtonBP" in the Blueprint Editor --> Components --> Add Component --> Select a "Box" rename it to "Trigger" and place it around your sphere.

            7. Add Component --> Text Render, rename it to "HintMessage". Go to Details --> Text > set Text to: "Press E". Place your Text somewhere around your sphere. where the Text should later appear.

            8. Go to Details --> Rendering --> uncheck Visible.
            Click image for larger version

Name:	LightButton1.jpg
Views:	1
Size:	35.4 KB
ID:	1050919

            9. Go to EventGraph --> select Trigger --> and in the EventGraph create all the Nodes like shown in the picture below.
            Click image for larger version

Name:	LightButton2.jpg
Views:	1
Size:	82.0 KB
ID:	1050917

            10. at the "Get All Actors of Class" choose "MyWallSconceBP" and on "Out Actors" choose "get" --> CasttoMyWallSconceBP --> As My Wall Sconce BP --> LightSwitch. Compile and Save.

            11. Now you can place the "MyWallSconeBP" and "LightButtonBP" somewhere in your Editor (Transform --> Scale "LightButtonBP" to 0.5 for X Y Z) and that's it! Hit play and test your new Lightswitch.
            Click image for larger version

Name:	editor.jpg
Views:	1
Size:	22.9 KB
ID:	1050918

            I hope this is more or less what you are trying to do.

            Greetings

            Ace D.

            Comment


              #7
              The one issue, Ace, with that set up is that a person could theoretically back up into the light switch and get the pop up to turn it on, without actually facing the switch.

              Denton, what you want is to have the blueprint for MyCharacter draw a trace out from itself. Here is a screenshot of the blueprint that I have set up and working:

              Click image for larger version

Name:	UE_Linetrace_Example.png
Views:	1
Size:	808.6 KB
ID:	1050926

              What this does is that every tick there is a trace shooting out from the center of your screen to X feet in front of you. It will stop if something is blocking it and it will return a hit result if it hits anything flagged to be WorldDynamic.

              Anything that it hits will receive a message that it is being looked at from the blue print interface. At that point, you'll just need to set up an event on the object regarding what to do when it is being looked at.

              Let me know if you need help on that part, but at least this part should get you going. The only downside is that your main character is constantly doing a tick... and I'm not too sure how big of a performance hit that could be.

              The upside is that you could use this wherever you want in your game, i.e. turning on lights, opening doors, etc, all based on if the player is looking at something.

              Comment


                #8
                Im tried yesterday AceD scheme, this is not exectly what i want, Me need, what hint always will be front for player, like a hud element, and else E button didnt swith light. Today will try McSean scheme

                Comment


                  #9
                  Originally posted by KillerSneak View Post
                  Hi there,




                  and

                  https://www.youtube.com/watch?v=jHxUisYmuAg

                  should get you started
                  Hi, I need help with this tutorial. It tells me to turn off the light in rendering, but there is no box to turn off the visibility of the light. After that, whenever I type in visible when adding a new node I do not get the same functions options. All I get is "Set Actor Hidden in Game"

                  Please help??

                  Comment


                    #10
                    Im make a multi interact like this lesson https://www.youtube.com/watch?v=WwfsWr4A894
                    and make wallSconce with toggle function https://dl.dropboxusercontent.com/u/...WallSconce.png
                    and
                    when i add event in lightSwither to communicate them to wallsconce, i compile and see the next error https://dl.dropboxusercontent.com/u/.../PinTarget.png
                    what me need to do?
                    Last edited by DcDenton; 05-31-2014, 09:02 AM.

                    Comment


                      #11
                      Hi DcDenton,

                      you have to plug your Blueprint_Wallsconce_Child as the target to your LightSwithasD.
                      Create a new Variable and search for your Blueprint_Wallsconce_Child under Variable Type. "Get" that variable into the eventGraph and connect it to the target.

                      Comment


                        #12
                        Originally posted by AceD View Post
                        Hi DcDenton,

                        you have to plug your Blueprint_Wallsconce_Child as the target to your LightSwithasD.
                        Create a new Variable and search for your Blueprint_Wallsconce_Child under Variable Type. "Get" that variable into the eventGraph and connect it to the target.
                        I'm only beginner, can u write more details instruction?

                        Comment


                          #13
                          Originally posted by DcDenton View Post
                          I'm only beginner, can u write more details instruction?
                          Hi DcDenton,

                          ok first, open your LightSwitch-Blueprint and click on Variable:
                          Step 1:
                          Click image for larger version

Name:	step1.jpg
Views:	1
Size:	50.0 KB
ID:	1050982

                          than click on bool and search for your Blueprint_Wallsconce_Child.
                          Step 2:
                          Click image for larger version

Name:	step2.jpg
Views:	1
Size:	70.8 KB
ID:	1050983

                          drag your newVar (you can rename it of course) into the EventGraph and connect it.
                          Step 3:
                          Click image for larger version

Name:	step3.jpg
Views:	1
Size:	63.0 KB
ID:	1050984

                          If this isn't still working, try Step 4 and create Nodes like shown in the picture.
                          Step 4:
                          Click image for larger version

Name:	step4.jpg
Views:	1
Size:	72.3 KB
ID:	1050985


                          Greetings

                          Ace D.

                          Comment


                            #14
                            And else. About hint when mouse look on object. Im add text via myHUD bluprint, but i dont know how make variable with text from object give to myHUD text. and the begin showing when mouse look at object

                            Comment


                              #15
                              McSean,

                              The only part I'm having trouble with in your blueprint is the On Observed light blue piece.

                              I'm totally a beginner here. I assume its some type of variable that you apply to other objects? I really have no idea.

                              Appreciate any help.

                              Comment

                              Working...
                              X