Announcement

Collapse
No announcement yet.

Sunlight that kills?

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

    Sunlight that kills?

    Hey, I'm working on a vampire game, and I was wondering how I could make the vampire die when it goes into sunlight.
    Any ideas?

    #2
    maybe a trigger?

    Comment


      #3
      Use Timer i.e. 0.1 (or even 1.0...) and do the trace, if FastTrace(sunlight.Location, vampire.Location,, True) return True then trigger the damage.

      Comment


        #4
        Not quite, a directional light isn't a spotlight., the rays are parallel. Trace from vampire, but along the rotation of the domdir FastTrace(Vampire.Location, (Vampire.Location - 10,000*(vector(Sunlight.Rotation), , True)

        Comment


          #5
          This is only detail, but I disagree... I don't think, that UDK have the same sunlight effect like Unreal 2.

          Hmm... If taking into account SkyLight, ten you're right - only maybe distance is too small.

          Comment


            #6
            step by step? :P

            Comment


              #7
              in your pawn
              Code:
              var DominantDirectionalLight MyDomDirRef;
              
              simulated function PostBeginPlay()
              {
                local DominantDirectionalLight D;
              
                super.PostBeginPlay();
                foreach AllActors ( class'DominantDirectionalLight', D) // only do this here as a temporary thing, best would be to store a ref one time in gamereplicationinfo or something as this function is all kinds of slow
                {
                  MyDomDirRef = D;
                }
                `log('FOUND AND STORED A REF TO THE SUN TO SAVE CALLING ALLACTORS CONTINUALLY'@MyDomDirRef)
              }
              
              simulated function Tick(float DeltaTime)
              {
                super.Tick(DeltaTime);
                if(FastTrace(Location, Location - 10000*vector(MyDomDir.Rotation)) // change 10k to whatever suits best, trace should be as short as possible
                {
                  TakeDamage(Blah); // whatever you want to do here
                }
              }
              VendorX, DominantDirectional behaves as old sunlight, parallel rays. Skylight is ambient 'directionless' light.. DomDirs can be placed anywhere in the level above ground- i put mine near some prominent geom so i can find them again easily. The angle error can be significant. But then again, what do i know *shrug*

              Comment


                #8
                Originally posted by Jetfire View Post
                DominantDirectional behaves as old sunlight, parallel rays. Skylight is ambient 'directionless' light.
                Yeah, I have confused those two... Anyways...

                1. I think, it will be a good idea (if you have SkyDom in the Level...) to find location of projected sun on SkyDom and then use that location in FastTrace.
                2. Doing this check in Tick is unnecessary - too expensive, Timer should be enough...
                3. Probably PossessedBy will be a better place to call Timer with bLoop = True if !bDeleteMe and call ClearTimer in Destroyed.
                4. Last thing is new function i.e. CheckSunlight with trace code in it.

                Comment


                  #9
                  I guess I should test it out in kismet before implementing it.
                  So, If I'm right, I can use a trigger, use in kismet as a touch event, Attach it to Take Damage, And attach All Players to it, Would that work?

                  Comment


                    #10
                    ...No one?

                    Comment


                      #11
                      Yes you can cause damage to the player that way. You could even approximate the above code since you can also run traces and get the rotation of the domdir in kismet.

                      Comment


                        #12
                        Originally posted by slader166 View Post
                        I guess I should test it out in kismet before implementing it.
                        So, If I'm right, I can use a trigger, use in kismet as a touch event, Attach it to Take Damage, And attach All Players to it, Would that work?
                        No because there's no function in Kismet which gets the all-important angle of the light. To do something like this, you need to strictly work with Unreal Script.

                        If your entire game is based around the Vampire, then you'd be better off creating a custom pawn which extends the UDK Pawn base.

                        Comment


                          #13
                          Originally posted by slader166 View Post
                          ...No one?
                          Jetfire showed you exactly how to do it

                          Comment


                            #14
                            Originally posted by TJ_MkII View Post
                            No because there's no function in Kismet which gets the all-important angle of the light.
                            GetProperty node connected to the domdir variable, and get it to query 'rotation', no?

                            Comment


                              #15
                              Triggers. Triggers is the way to go. Put triggers where the sunlight can touch the player.

                              Comment

                              Working...
                              X