Unreal Script Basics by h85XaTp

VIEWS: 0 PAGES: 15

									             Unreal Script Basics

                  CIS 488/588
                 Bruce R. Maxim
                  UM-Dearborn


12/11/2011                          1
              Unreal Script
• Unreal Script lets you define and extend
  objects that can be used in UT2004 games
• You can create and edit classes inside
  UnrealEd, but if you want to create serious
  content you should probably create your own
  Edit Packages and compile them using the
  Unreal ucc make command (located in the
  UT2004 System folder)

12/11/2011                                      2
              Packages - 1
• Basically they can contain any type of Unreal
  content, if the ucc compiler is to find the
  content you need to adhere to a few
  conventions
• You need to create a folder in the root
  UT2004 directory, the folder name is the
  package name (e.g. HelloWorld)
• Unreal script files are placed in a package
  subfolder named Classes
12/11/2011                                        3
             Packages - 2
• Convention would suggest that you name the
  class file with the class name and use the
  extension .uc
• You can also create directories to hold
  Animations, Textures, StaticMeshes, Sounds,
  Music, etc.
• The compiled package will be placed in the
  UT2004 System folder

12/11/2011                                  4
             Compiling Packages
• The first step is to edit the UT2004.ini file
• You need to locate the EditPackages section
  and add a line EditPackages=HelloWorld
• After you save the edited .ini file you then
  need to make sure the file HelloWorld.u is
  renamed (or the source file will not be
  compiled)
• Type ucc make at a DOS prompt to compile
  all new classes

12/11/2011                                        5
                  Classes
• Syntax of Unreal Script class definitions are
  similar to those found in C++ or Java
• The keyword extend is used to indicate
  parent being extended
• The root class of all Unreal objects is name
  Object (though most of the time you will work
  with its child class Actor as the root class
  library to extend)

12/11/2011                                        6
             HelloWorldTrigger
//=========================================
// HelloWorldTrigger.
//=========================================
class HelloWorldTrigger extends Trigger placeable;
   //Override a function from the parent class
   function PostBeginPlay(){
      //Call a function from the parent class
      Super.PostBeginPlay();
      //Assign a value to a member variable of the
      //parent class
      Message = "Hello World of Unreal Tournament!";
   }

12/11/2011                                             7
             Using the New Class
• When you start UnrealEd the new class
  HelloWorldTrigger will appear in the Actor
  class library and can be placed in the level
  map and used like any other actor
• There is a good Tutorial on creating a new
  game object from scratch on the DVD that
  comes with UT2004



12/11/2011                                       8
             Exec Directive
• "#exec" directives in UnrealScript class code
  execute console commands at compile time.
• This is useful for keeping content closely
  coupled with the code that uses it
  (textures/sounds
• Every "#exec" directive can be executed in
  UnrealEd's console bar (without "#exec”).
• Currently in the newer engine builds, they are
  the only method of importing vertex meshes
  (think .3ds).
12/11/2011                                     9
                     Texture Import
#exec TEXTURE IMPORT NAME=NameForTextureToImportAs
   FILE=PATH\TO\SomeTexture.pcx GROUP=SomeGroup MIPS=OFF
   FLAGS=2 PALETTE=SomeTexPalette LODSET=2
// note no terminating ";". Presumably must be all on one line, too
• Imported textures are addressed as
  PackageName.Texturename, and available
  via UnrealEd after PackageName is loaded in
  the Actor browser
• Optional params: Name, Group, MIPS, Flags,
  Pallette, LODSET,

12/11/2011                                                            10
                    Sound Import
#exec AUDIO IMPORT NAME=NameForSoundToImportAs
    FILE=PATH\TO\Soundfile.wav GROUP=SomeGroup


• NAME (optional) Name the sound is imported as.
  Defaults to the file name without extension if omitted.
• FILE - Path to the sound file being imported. Paths
  are local to the root of the package directory.
• GROUP (optional) Name of the group the sound is
  classified under (used in, for example, the UEd
  Sound browser)


12/11/2011                                              11
             Loading Other Packages
#exec OBJ LOAD FILE="..\Textures\MyTextures.utx"

#exec OBJ LOAD FILE="..\Textures\MyTextures.utx“ PACKAGE=MyPackage

• You can use the OBJ LOAD parameters to load
  a specific file at compile time, so that you can
  reference objects in that package at compile
  time.
• You can also load textures into specific
  compiled packages using the PACKAGE
  parameter
12/11/2011                                                           12
             Importing Static Meshes
#exec STATICMESH IMPORT NAME=GrenadeMesh
   FILE=Models\assaultgrenade.lwo GROUP=EnemyWeapons
#exec NEW STATICMESH NAME=AnotherGrenadeMesh
   FILE=Models\assaultgrenade2.ase GROUP=TeamWeapons
• You can import static meshes to be compiled
  in your .u file. You can import Lightwave
  (.lwo) and the .ase files exported from the
  ActorX Utility.



12/11/2011                                             13
                 Importing Skeletal Meshes
#exec MESH MODELIMPORT MESH=Weapon_1st MODELFILE=models\WeaponModel.PSK
     LODSTYLE=10
// Position, Rotation and Scale
#exec MESH ORIGIN MESH=Weapon_1st X=0 Y=0 Z=0 YAW=0 PITCH=0 ROLL=0
#exec MESHMAP SCALE MESHMAP=Weapon_1st X=1.0 Y=1.0 Z=1.0
//Assign Animations and Textures
#exec MESH DEFAULTANIM MESH=Weapon_1st ANIM=WeaponAnim
#exec MESHMAP SETTEXTURE MESHMAP=Weapon_1st NUM=0 TEXTURE=WpTex

• You can import .PSK files obtained from the ActorX
  utility, that are placed in the /models folder of your
  package directory.
    12/11/2011                                                       14
             Importing Animations
#exec ANIM IMPORT ANIM=WeaponAnim ANIMFILE=models\WeapAnim.PSA
   COMPRESS=1 MAXKEYS=999999 IMPORTSEQS=1

• You can import .PSA files obtained from the
  ActorX utility, that are placed in the /models
  folder of your package directory
• COMPRESS - Compresses the animations. 1 is
  normal, uncompressed, lower numbers are more
  compressed.


12/11/2011                                                 15

								
To top