Announcement

Collapse
No announcement yet.

AllActors / DynamicActors / VisibleActors =\

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

    AllActors / DynamicActors / VisibleActors =\

    why cant i get anything in return when i try AllActors, DynamicActors or VisibleActors with class'Light' ?????

    #2
    Post some code so we can see how you are using it (you have not put in the optional tag have you?)

    Comment


      #3
      local Light l;
      ForEach <Iterator>(class'Light',l)
      {
      Distance checks ... set main var for use
      }

      Comment


        #4
        Post the actual code that didn't work for you.

        Comment


          #5
          ClosestL would always return none, wt-? [EDIT] Even on listen, im just wondering y

          Code:
          var float x, Dist;
          var Light l,ClosestL;
          
          function Tick(float dt)
          {
              local PlayerController C;
              C = Level.GetLocalPlayerController();
              if( C == None || C.Pawn == None )
                  return;
              ForEach DynamicActors(Class'Light',l)
              {
                  x = VSize(C.Pawn.Location - l.Location);
                  if( Dist == 0 )
                  {
                      Dist = x;
                      ClosestL = l;
                  }
                  else if( x < Dist )
                  {
                      Dist = x;
                      ClosestL = l;
                  }
              }
              if( ClosestL != None )
              {
                  ...
              }
              else
              {
                  ...
              }
          }

          Comment


            #6
            Just to make sure: You are testing this on a map that actually contains Lights, right?

            Why are x, Dist and l class-global variables? Is there maybe a negative default value for Dist? Did you check whether the code inside the ForEach loop is actually executed?

            Comment


              #7
              Lights are bStatic=True, so unless you created as subclass to override this (in which case you should use the class'subclass' isntead), you wont get any from dynamic actors. Lights are also bHidden=True, so they wont appear in visible actors either. Also it would be faster to set Dist to some large number (99999?) and then omit the if (Dist == 0) and just use the other part of it.

              Comment

              Working...
              X