Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

UnrealScript Non Static Func To Static

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

    UnrealScript Non Static Func To Static

    Hello, im stuck with this stuff - i want to make a non static native iterator function, to a static
    Code:
    native(310) final iterator function RadiusActors  ( class<actor> BaseClass, out actor Actor, float Radius, optional vector Loc );
    Thats what i have !
    Is it possible to convert it to static function like that
    Code:
    static function GetRadActor( Actor DummyActor,class<actor> BaseClass, out actor Actor, float Radius, optional vector Loc  )
    {
      DummyActor.RadiusActors(BaseClass,Actor,Radius,Loc);
    }
    Or mb like that
    Code:
    static function GetRadActor(class<actor> BaseClass, out actor Actor, float Radius, optional vector Loc  )
    {
      return RadiusActors(BaseClass,Actor,Radius,Loc);
    }
    I'v been troubling with this for 3 days, can someone help me out pls!

    #2
    I can't find RadiusActors anywhere in my version of UDK. I'm not sure whether it's possible to create custom iterators (don't think so). Your idea to use a DummyActor is the way to go. This DummyActor can be the WorldInfo (which you can get anywhere using class'WorldInfo'.static.GetWorldInfo() ). But it won't work like that in your code above. You'll either have to use a custom macro which prefixes RadiusActors with class'WorldInfo'.static.GetWorldInfo() and can then be used like any other iterator. Or alternatively you'll need to pass a delegate to GetRadActor which is called in every iteration.

    Something like
    `define StaticRadiusActors(BaseClass, Actor, Radius, Loc) class'WorldInfo'.static.GetWorldInfo().RadiusActor s(`BaseClass,`Actor,`Radius`if(`Loc),`Loc`endif)
    Usage:
    Code:
    foreach `StaticRadiusActors(class'Actor', Actor, 1024.0f)
    {
    	//TODO
    }
    Or

    Code:
    delegate OnRadiusActorsIteration(Actor Actor);
    
    static function GetRadActor(delegate<OnRadiusActorsIteration> Delegate, class<actor> BaseClass, float Radius, optional vector Loc  )
    {
    	local Actor Actor;
    	if (Delegate != none)
    	{
    		foreach class'WorldInfo'.static.GetWorldInfo().RadiusActors(BaseClass,Actor,Radius,Loc)
    		{
    			Delegate(Actor);
    		}
    	}
    }

    Comment


      #3
      Thanks for reply, i forget to mention that im doing this not for udk but for ut2004(ut2k4+), can it de used in the same way for it ?

      Comment


        #4
        Unfortunately I am unfamiliar with UT2004. But as long as it already has macros such as `log and `warn the first approach should work. The second option should work if delegates are available and the worldinfo exists and has a static getworldinfo function.
        You'll just have to try it on your own I'm afraid. Or one of the veterans familiar to UT2004 could jump in and help you out.

        Comment


          #5
          But can you explain a bit the first approach ?

          And the second one wouldnt work cause there is no WorldInfo and there is no "delegate" in UT2004, i posted it here, cause it is having more reviews(people read it more often) then ut2004 thread, that is just forgotten =(( .

          What can i do ?

          Comment


            #6
            If you don't have a WorldInfo then the first approach doesn't really work either. Why do you need a static version of RadiusActors anyway? You can always do DummyActor.RadiusActors in those cases. But you won't be able to wrap it into your own static function. And a macro wouldn't really benefit you there either.

            Comment


              #7
              Well i need static version of radius, because im working from UWindow Interface, and the main class of it refers only to Interactions -> Object, so its not going to actor. But i need to get visible actors through it, so i could cast an function that get Info of actors that are near by. Originaly this function work when you target an actor by mouse, but i guess it could be used to cast over array of actors, am i right ?

              Comment


                #8
                All you need is any actor right? There has to be a function to get a pawn, playercontroller or whatever somewhere... But I can't help you any further, sorry.

                Comment

                Working...
                X