Results 1 to 6 of 6
  1. #1
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default Scripting Changes from UT3

    I thought it would be nice to have a thread listing changes to Unreal Script and the base classes from UT3 to UDK.

    Unreal Script changes

    • It is no longer valid to have ` in strings.
      Solution: Escape it (i.e. "\`") - elmuerte

    • Trying to compare an interface variable against a non-interface object variable results in a "Const mismatch with '=='" error on compile.
      Solution: Cast the object variable to an interface variable first, or get a non-interface variable of the interface object. (Ok, that sounds really confusing, but say you have an object MyObject that is a subclass of Actor and implements MyInterface...)
      Code:
       function Example(MyObject obj)
      {
          local MyInterface interface;
          local bool dump;
          interface = obj;
          dump = (interface == obj); // Won't compile.
          dump = (interface == MyInterface(obj)); // Compiles
      }
      Basically it should be noted that Interfaces in general are a bit rough in UE3 (or at least they were in UT3), so take care when using them and expect peculiar behaviour.

    • UDK is stricter about consistent usage of the optional flag on parameters - you will now get an error if it a changes from class to subclass.

    • You can now flag functions as protected, preventing them from being used except from within the class or by subclasses (not sure about inner classes or whatever you call classes that are "within" another class).

    • New nameof() feature allows you to get the name of a functions and variables as a string. Used extensively in UDK code when setting timers and handling RepNotify in the ReplicatedEvent functions.

    • When accessing a member of a within class' container class, you now have to use the special Outer member variable. This presumably helps deal with name clashes.
      i.e.
      Code:
      class BonusPlayerData extends Object within MyPlayerController;
      
      function string GetName()
      {
           return Outer.PlayerReplicationInfo.playerName;
      }
      Unfortunately this can lead to maddening statements like GetSceneClient().Outer.Outer.Outer.GetCurrentWorld Info().



    Base Class changes
    • Actor no longer has the TimeSince(float Time) function. Use WorldInfo.TimeSeconds - Time instead.
    • It is no longer possible to directly access DecalMaterial in DecalComponent, instead you must use SetDecalMaterial() and GetDecalMaterial().
    • PlayerReplicationInfo no longer has a TeamID value, suggest using GetTeamNum() or getting Team.TeamIndex instead.
    • PlayerReplicationInfo no longer has the bFromPreviousLevel_Replicated variable which was used to replicated bFromPreviousLevel, meaning that variable is no longer replicated. Unsure if this is a problem or not, although obviously a similar system can be added if necessary.
    • Canvas' DrawText functions have changed. DrawTextClipped is gone and DrawText now takes a FontRenderInfo struct which specifies whether to clip among other things.
    • The system to stitch characters together from selected parts (CustomCharData, etc) appears to be gone or gutted.
    • In PlayerController, RegisterPlayerDataStores() is now final... however it only calls RegisterCustomPlayerDataStores() and RegisterStandardPlayerDataStores(), neither of which is final. So you can override those instead.
    • In PlayerController, ClientHearSound() no longer has the bIsUISound parameter, so you must rely on the bIsUISound attribute of the audio component.
    • Some of the navigation variables have changed in Controller. In particular the Destination vector is gone, replaced with DestinationPosition which is a BasedPosition. BasedPosition appears to be a new system to handle navigation on a moving actor.
    Last edited by immortius; 11-12-2009 at 05:38 AM.
    Nightblade, a stealth based total conversion for UT3

  2. #2
    MSgt. Shooter Person
    Join Date
    Nov 2007
    Posts
    209

    Default

    Nice initiative, will remove some confusion for people following UT3 tutorials among other things

  3. #3
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Location
    Ripon, WI
    Posts
    59
    Gamer IDs

    Gamertag: SpartanDonut007

    Default

    Nice! I don't know UT3 Unreal Script too well (Was just learning about a week before UDK was released) so I will benefit in the way Crozz mentioned.

    Excellent Initiative Indeed!

  4. #4
    Redeemer
    Join Date
    May 2000
    Location
    between the monitor and chair
    Posts
    1,523

    Default

    Quote Originally Posted by immortius View Post
    [*]It is no longer valid to have ` in strings.
    Solution: Put string values in localisation files?
    Escape it:
    Code:
    myString = "foo \'bar";
    Michiel 'El Muerte' Hendriks
    Magicball Network - Little Big Adventure community
    the Unreal Admin page - Unreal server administration
    UnrealWiki - UnrealScript and UnrealEd wiki.
    UnCodeX - powerful UnrealScript tool for programmers

  5. #5
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,986

    Default

    The custom character system was custom for the UT3 build of the engine, as far as I could tell - I went through that code with a fine toothed comb, trying to figure out how it worked, and all of the references to it were in the UT3 specific code pieces.

  6. #6
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    The new nameof() feature for getting the name of a function or variable as a string is pretty nice.
    Nightblade, a stealth based total conversion for UT3


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.