Announcement

Collapse
No announcement yet.

UDK Flashlight Tutorial!

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

    UDK Flashlight Tutorial!

    Hello guys

    Many people want to know how to make a flashlight in UDK. So here is a variant how to make one:



    Note:

    This is the important code part:

    Code:
    }
    begin object Class=SpotLightComponent Name=SpotLightComponent0
    Radius=1000
    Brightness=3
    LightColor=(R=255,G=240,B=190)
    CastShadows=false
    end object
    Components.Add(SpotLightComponent0)
    
    }

    #2
    Where i put this code?:

    Code:
    }
    begin object Class=SpotLightComponent Name=SpotLightComponent0
    Radius=1000
    Brightness=3
    LightColor=(R=255,G=240,B=190)
    CastShadows=false
    end object
    Components.Add(SpotLightComponent0)


    In "UTAttachment_TestWeap1" or "UTWeap_TestWeap1"?

    Comment


      #3
      Follow those steps:

      1. Copy and paste a file into the Devlopment-Src-UTGame-Classes folder e.g copy and paste the U****erVolume
      2. Now rename it to: UTWeap_flashlight
      3. Delete all the script lines in the file
      4. Add this script part into the file:

      Code:
      Class UTWeap_flashlight extends UTWeapon;
      
      defaultproperties
      {
      
      begin object Class=SpotLightComponent Name=SpotLightComponent0
      Radius=1000
      Brightness=3
      LightColor=(R=255,G=240,B=190)
      CastShadows=false
      end object
      Components.Add(SpotLightComponent0)
      
      }
      5. Now rebuild the scripts and add the "weapon" with kismet or a pickup factory

      I will upload a video about how to create a flashlight tomorrow, so either you follow those steps that I wrote into this thread, or you wait until tomorrow to follow the stepts that I show in the video

      Comment


        #4
        Oh thanks!!! Very helpful, i will wait that video by the way! thanks bro!

        Comment


          #5
          Here it is

          Comment


            #6
            OMG THANKS!!! Now i can go on with my game! That's very helpful! Yay!

            Comment


              #7
              I couldn't compile for some reason

              Analyzing...
              C:\UDK\UDK-2013-07\Binaries\..\Development\Src\UTGame\Classes\UTWe ap_FlashLight.uc : Error, Bad class definition 'SpotLightComponent'/''/199/199
              Compile aborted due to errors.
              Warning/Error Summary

              Comment


                #8
                begin object Class=SpotLightComponent Name=SpotLightComponent0 -> probably you have a 199 instead of the 0

                It would be esier when you could post your script ^^

                Comment


                  #9
                  Well I the problem was originally caused by copy/pasting the code posted in his original post

                  That's all resolved now and UDK has rebuilt successfully. Though new problem - the light doesn't attach to the pawn when it's picked up from the weaponpickup, aka the light remains static over pickup area.

                  Comment


                    #10
                    You have to choose a gametpye (e.g deathmatch,...)

                    Comment


                      #11
                      Sorry for the bump but, how to make the flashlight follow the crosshair? If I look up, the flashlight still go straight foward

                      Comment


                        #12
                        Normally it should follow the crosshair

                        Here is a example:

                        Click image for larger version

Name:	crosshair.jpg
Views:	1
Size:	92.5 KB
ID:	3250088

                        I could help you when you would give me some more infos (what have you exactly done,...)

                        Comment


                          #13
                          Hey when I do exactly what you say at the end it says player_Start0 has no handler any ideas

                          Comment


                            #14
                            -have you chosen a game mode? (utdeathmatch,....)
                            -Which way have you used? (pickup factory or kismet)

                            Comment


                              #15
                              Originally posted by fighter5347 View Post
                              -have you chosen a game mode? (utdeathmatch,....)
                              -Which way have you used? (pickup factory or kismet)
                              I did it the kismet way how would I send you a pic of the error code and how I have kismet set up? Also when I put a deathmatch game set up the gun appears and no flashlight do I need to add the light myself in udk?

                              Comment

                              Working...
                              X