Announcement

Collapse
No announcement yet.

Important Classes, Public Class Members and Functions.

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

    Important Classes, Public Class Members and Functions.

    I create this thread since it could be good to know what can be reached from where. Sometimes you might now what kind of function you need. Something that updates every frame, like Tick().

    Somtimes it might be that you need to know how to reach the LocalPlayer from somewhere. I though we could add important things to know to a centralized place where it can be easily found with out having to read every single .uc to find out what the name might be and where it is implemented.

    Anyone that feel like they want to help out may do so. This is not a documentation of every function. More of Important centralized functions that most people can have use of.

    Code:
    Input
        Mouse Position
            //Position x,y can be accessed from almost anywhere trough.
                class'UIRoot'.static.GetCursorPosition( x, y );
        Mouse Click
             //A fast way to know if a mouse button is clicked when prototyping
             //without changing to much code is to overload the following functions
             //in your own PlayerController Class
                 exec function StartFire(optional byte FireModeNum)
                 exec function StartAltFire(optional byte FireModeNum)
             //Better example needed
    
    UIInteraction
        Retriving
            //From any extension of PlayerController you can use
                GetUIController();
            //Global access point
                class'UIRoot'.static.GetCurrentUIController();
    
    LocalPlayer
        Retriving
            //Trough UIInteraction, if you named your UIInteraction var to UIController
                UIController.GetLocalPlayer(0); //Shouldn't be more then one local player in a ordiary game.
        Useful Members
            //The Players GameViewportClient
                ViewportClient
            
    
    Mouse Position To World Position
        DeProjection
            //There is two classes that will allow you to DeProject the mouse to the world.
            //Trough the Canvas in the PostRender(Canvas Canvas) of a Hud class
                Canvas.DeProject(out HitLocation, out HitNormal ...
            //Or trough a LocalPlayer, the comment says that this is slower then using the canvas.
            //Important remember to divide the mouse position by the size of the viewport to get a value
            //between 0-1 before doing the DePoject.[/I]
                LocalPlayer.DeProject(out HitLocation, out HitNormal ...
          
    
    UISceneObject //like UIScene and buttons
        Useful functions
            //A good point to set your own start up values 
            other then defautlProperties 
                event Initialized()
            // Or, depending if you want to set the values before or after the current objects children
                event PostInitialize()
    
    UIScene
        Is also
            UISceneObject
        Useful Members
            //The Viewports size, necessary for DeProject
                CurrentViewportSize
            //The Scenes LocalPlayer Owner
                PlayerOwner
            //Get the UISceneClient
        Useful Functions
            //Get The WorldInfo instance
                GetWorldInfo();
    
    UISceneClient
        Useful Functions
            //Open UIScene
                 OpenScene(UIScene scene ...
    Actor
       Useful functions
            //Getting hold of other actors in the scene based on criteria
            //For detailed input values look at Engine/Actor.uc line 1898-1939
                AllActors(...
                DynamicActors(...
                ChildActors(...
                BasedActors(...
                TouchingActors(...
                TraceActors(...
                VisibleActors (...
                VisibleCollidingActors(...
                CollidingActors(...
    
            //Get The Local Player Controller in a single player game, or random 
            //local in a splitscreen game
                GetALocalPlayerController();
            //Function called before game starts
                event PreBeginPlay()
            //Main Update function
                event Tick(float DeltaTime)
    
    Pawn
        Is also
            Actor
        Useful Members
            The current Pawn Controller
               Controller
            Get the current Pawns Weapon
                Weapon
            Pawns Inventory Manager
                InvManager
    
    PlayerController
        Useful Functions
            //Before the game start
                simulated event PostBeginPlay()
            //Player Update, only happens client side and if the Controller got a PlayerInput Object.
                event PlayerTick( float DeltaTime )
            //Make the current Controller take controll of a pawn
                event Possess(Pawn aPawn, bool bVehicleTransition)
            //Access to the hud and canvas
                function DrawHUD( HUD H )
            //If the pawn Died
                function PawnDied(Pawn P)
            [I]//Camera Rotation function
                 function UpdateRotation( float DeltaTime )
    
        Useful Members
            //The current controllers PlayerInput instans.
                PlayerInput
            //The current PlayerCamera
                PlayerCamera
            //myHUD is the default HUD reference, it can be converted to your current HUD class.
            //Say you have a HUD class named NinjaHUD you could access it trough
            //local NinjaHUD MyNinjaHUD = NinjaHud(myHUD);
                myHUD
    
    InventoryManager
       Useful Functions
            //iterator for all inventory items (called inventory, a inventory is resposible for droping 
            pickup and handeling a carried object)
                InventoryActors( class<Inventory> BaseClass, out Inventory Inv )
    
    GameInfo
        Useful Functions 
            //Rating function to determine best start position for spawn, good place to override, if for instance dying 
            //would require the player to go to jail, or to value spawnpoints close to team mates higher, or based on 
            //claimed checkpoints
                RatePlayerStart(PlayerStart P, byte Team, Controller Player)
            //If you need to do magic before tha game begins, setting own var values
                event PreBeginPlay() 
            //Or after the game started, setting values based on what other objects exist at the moment
                event PostBeginPlay()
    
    WorldInfo
        Is also
            Actor
        Retrieving
            //Get the WorldInfo from anywhere.
                'WorldInfo'.static.GetWorldInfo()

    Thanks to everyone who have given suggestions or anwers I have found in different topics or posts. I won't thank you by name since there are too many of you. And a thanks to Epic for providing us with UDK.

    #2
    This is helpful, thanks!

    Comment


      #3
      nice thanks !!!

      Comment


        #4
        Great idea, thanks!

        Comment


          #5
          Code:
          PlayerController
             Useful Members
                  //Reference to Player HUD; usage: CustomHUD(MyHUD).FunctionToCallInHUDClass();
                  MyHUD
          I use this one very often.

          Comment


            #6
            Ah, yes I haven't looked trough the HUD stuff since i Essentially don't use it myself, thanks.
            I will change the use referens slightly

            Comment


              #7
              can i bump this ?

              Comment


                #8
                I guess so

                Comment


                  #9
                  I don't mind. I find it good.

                  Comment


                    #10
                    This helps me out alot thanx

                    Comment


                      #11
                      We should start a Wiki with this info and more bumping

                      Comment


                        #12
                        UIRoot.TextureCoordinates

                        Comment

                        Working...
                        X