|
The Dusty Tome of UnrealScript Black MagicEpic Games, Inc. brandon@epicgames.com http://unreal.epicgames.com/ Last Updated: 12/08/99 I. Introduction UnrealScript is a powerful programming language, but one steeped in the shrouded mystery of time. The purpose of this document is to reveal some of the more arcane methods of invoking this language. The tips and guides in this document will be compiled over time, from the author's one experience and from the experience of those who submit entries. For now, entries will be unsorted. II. Index to Invocations
III. UnrealScript Spellcraft Using UWindow for Mutator Options Author: Jack 'Mek' Porter
Using SpawnNotify to control objectcreation. Author: Brandon 'GreenMarine' Reinhart
class MyPRISpawnNotify expands SpawnNotify; event Actor SpawnNotification( Actor A ) { if (!A.IsA('MyPlayerReplicationInfo')) { A.Destroy; return Spawn(class'MyPlayerReplicationInfo'); } else return A; } defaultproperties { ActorClass=class'PlayerReplicatonInfo' } When you spawn your SpawnNotify object it will add itself to the level's SpawnNotify list. Objects in that list are queried with SpawnNotification whenever an object of their ActorClass is created. Notice that the example is careful to check the type of the actor. Failing to do this would cause an infinite loop (as our spawn notification destroyed the MyPlayerReplicationInfo it tried to create). Using Entry for persistent object creation. Author: Mongo
Package flags for package control. Author: Brandon 'GreenMarine' Reinhart
[Flags] AllowDownload=False ClientOptional=False ServerSideOnly=False When you rebuild your package, the settings you give each of these flags will be saved. AllowDownload will send your package to clients that connect to a server with that package set as a ServerPackage. ClientOptional means that the client doesn't have to have the package in order to connect to the server. A client optional package can be skipped during auto download and the client will still be allowed to connect. ServerSideOnly indicates whether or not the package should be loaded on the client side when a client joins a server running the package. Client side mods that add new graphics or sounds will want to turn off ServerSideOnly and turn off ClientOptional. Server side mods will want to turn on ServerSideOnly and turn on ClientOptional. Setting Package flags directly: ucc packageflag Author: Jack 'Mek' Porter
Using MS Developer Studio as an UnrealScript IDE. Author: Brandon 'GreenMarine' Reinhart
Now start DevStu and create a new workspace in your Unreal Tournament directory. Add an empty windows DLL project for each source package (Core, Engine, Botpack, etc) and create a folder until the FileView called Classes. Set the folder's extension type to uc. Finally add each package's source files to their respective folder. You can compile inside DevStu by using a custom batch file. Create a MakePackage.bat inside your UnrealTournament system directory and add some commands like this: @ECHO OFF del %1 ucc make This will rebuild the argument (for example, MakePackage Wookie.u would delete Wookie.u and rebuild it). Now add a custom tool to the tools list in DevStudio. If you select "Use Output Window" the results of the build will be dumped to the Build window in Dev Studio. Finally, you can attach your custom tool to a custom button and put it on your button bar for fast access. If you want limited context highlighting, you can run regedit and find the following key: [HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs/Language Settings\C/C++] Add "uc" to the FileExtensions list. Make sure DevStudio is shutdown first, otherwise it'll write over your changes when you exit. Now restart DevStudio and you've got some limited context highlighting for UnrealScript! Author: Nathaniel "^Soul^" Brown
|