1 / 15

Unreal Script Basics

Learn how to create and compile edit packages in Unreal Script, allowing you to define and extend objects for use in UT2004 games. Includes instructions for creating folders, naming conventions, and compiling packages.

lgarnett
Download Presentation

Unreal Script Basics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unreal Script Basics CIS 488/588 Bruce R. Maxim UM-Dearborn

  2. 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)

  3. 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

  4. 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

  5. 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

  6. 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)

  7. 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!"; }

  8. 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

  9. 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).

  10. 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,

  11. 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. 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

  13. 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.

  14. 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.

  15. 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.

More Related