Contents
Starting Points
- UnrealScript is an object-orientated programming (OOP) language created by Epic Games for scripting in-game content for the UnrealEngine. In some ways it looks and acts like Sun's Java(tm) language. The core of the unreal engine does not run in UnrealScript, but parts of game events do.
- For an overview of how the engine uses UnrealScript, see Unreal Engine Core.
- For introductory tutorials, see UnrealScript Lessons. Features a set of simple tutorials to get you set up, and coding your first mutators.
- Find language reference documents below (one within the Wiki), followed by more specific guides and examples.
- Start playing with the GUI in the game with no coding required using the Interactive GUI design mode built into UT2003/4
- Stuck? See Compiler Errors, Unreal Coding FAQ and the rest of Category:Legacy Troubleshooting
Official Reference Docs
- UnrealScript Language Reference (Tim Sweeney)
- Mod Authoring (Brandon Reinhart) (Mainly for UT only)
- UDN's UnrealScript Reference (Unreal Developer Network – some features don't work on builds before 600)
UDN Official Language Reference
Official documentation from udn2:UnrealScriptReference (udn.epicgames.com):
- Variables
- Expressions
- Functions
- Program Structure
- States
- Language Functionality
- Operators
- General Purpose Functions
- Variable Specifiers
- Advanced Language Features
Fyfe: This is a work in progress, at the moment most of the above links to the UDN because it has better/more accurate description of the language functionality.
- Side note: can we get an icon for udn interwiki links like the one we used to have for udntech and udncontent?
nogginBasher: The udn links don't work for me I get %23 instead of #. Anyway, I prefer the formatting on Tim Sweeny's UnrealScript_Language_Reference. :)
UnrealWiki Core Language Reference
Syntax
- Class Syntax
- Default Properties
- Replication Block
- Variable Syntax
- Function Syntax
- Latent Function
- Iterators
- Global Function
- Static Function
- Operators
- Flow Syntax
- Special UnrealScript Keywords
- Exec Directive
- Compiler Errors
- UnrealScript Keywords – All keywords in a single list
We're also working on an Wikipedia:EBNF specification of the UnrealScript Grammar, but bear in mind it's fairly technical.
Geometry
Objects
- Creating Actors and Objects
- Object Pool
- Destroying Objects
- Default Properties
- State
- Extending States
- Linked List
- Mutator Topics
Playing with the GUI
- Read up on the Interactive Gui Design Mode
- Read the GUI Overview
- Find out all about the relevance of the automated component
Extending Core Functions
- Probe Function
- Scripting Operators
- Useful Maths Functions
- Useful Mutator Functions for UT
- Official UnMath Page
See also Open Source.
Engine
Classes
- Package – Very basic introduction to UT package files, and how they're assembled (.u, .utx, .umx, .uax, .unr)
- Class Tree (navigate also from Object or Actor. To jump directly, use the search function at the foot of this page)
- UnrealScript Source
How stuff works
- Taking Damage – The effects of the TakeDamage function in the Pawn class.
- Armor Damage Absorption – How a player's inventory reduces damage.
- Communication Between Objects
- PlayerController – An engine eyes view of the player.
- How UT Weapons Work
- How UT2003 Weapons Work
- Chain of Events at Level Startup
- Chain of Events when Spawning Actors
Graphics
Other Things
- Localization
- Replication – Everyone's "favorite". How to make actors work in network play.
- Obfuscation
- Config Vars And .Ini Files
- Input Key Map
- Code References
- Compiling With UCC – Compiling outside of UnrealEd. (UEd isn't the best tool for modding, anyway. :))
Techniques
- Coding Guidelines – Ideas about coding style in general
- Maintaining Compatibility – What's good and what's bad when writing a certain type of mod
- Debugging Techniques – What to do to find out, what's wrong
- Code Optimization – How to make your UnrealScript code run fast
UnrealScript for Mappers
Pages that cover basics, aimed at mappers.
- Create A Subclass
- Embedding Code
- Mapping Hello World – Using custom code in an embedded subclass.
- InitialState
- Writing and Using an Embedded Mutator
- Scripting Custom Brushbuilders
Scripting Utilities
- CVS (Concurrent Versions System)
- UnCodeX
- See Application for a full list
Miscellaneous
- Garbage Collection
- UnrealScript Operators and Keywords – this is marked for either deletion or rewriting as a starter tutorial
External Links
- A good read: How To Write Unmaintainable Code.
- The UnrealScript Yahoo Group has over 10,000 archived messages on UnrealScript topics.
- UDN's Unreal Tournament 2003 Coding Links has some miscellaneous references to tutorials and fourms.
Related Topics
- Category:Legacy Tutorial – automatic list of all tutorials on this site
- Testing Lab
Discussion
Wormbo: Something makes me feel this page needs to be refactored since it's the portal to all UnrealScript-related topics.
Tarquin: yes! Any ideas?
scumble: The page might be better split up a bit. The section named "Core" is really about basic functions in UnrealScript, a reference guide really (could be named more instructively) and "Engine" is essentially about exploring implementations in UnrealScript of more elaborate game functions. It would work nicely on a page of its own.
Recondite Maybe I'm missing something, but after trying to do some rather simple OO operations (initialize an array of complex class instances outside of a function/prior to the actor loading default props to the editor), and not finding any documentation saying this is possible...(is there an init method?)...and running into the struct by-value / lack of true inner class capability...and where is the map class... maybe it's a documentation issue, but i really don't agree with emphasizing that unrealscript is a java-style language. it is a scripting language with quite a few quirks, and doesnt seem to have a full feature set needed for OO work. but (sigh) perhaps i should write up a page to discuss the differences.
El Muerte: there's no init function that is called before the defaultproperties are set. In the defaultproperties however you can initialize arrays with complex things. But you can only use Object classes and not Actor classes. This is, for example, how the whole GUI system works. When a class instance is created the first thing done is loading the defaultproperties. After that some events are called, depending on if it's a Object or Actor (when an Object is created the Created() event will be called, for Actors the first event would be PreBeginPlay()), do your initializing there.
The map data type has no unrealscript implementation (yet), so you can't use it.
And UnrealScript is a java-style language, note the -style, nobody claims unrealscript is like Java, so don't expect the same features of java within unrealscript (for that matter, Java doesn't have support for enums (not yet anyway), structures, etc.). It's just that the way classes are handled in UnrealScript can only be compared to Java, there is, afaik, no other language looks more like UnrealScript than Java. UnrealScript has all the features for the basic OO principle, sure it doesn't implement all OO principles, but afaik know there's no language that does.
xX)(Xx: Didn't know where to put this, so sorry if its a little off-topic, but it seemed a sensible place to ask anyway, is there any kind of limit as to how many mutators you can have, coz recently, none of the mutators that I download or create, don't show up in the choose mutator list, as i have a LOT of mutators, i am guessing this is the case, i have reached the limit as to how many mutators it is possible to have :( can anyone clarify this, or point out a soloution/fix ? thanks :)
Tricadex: The limit seems to be 250, http://www.planetunreal.com/mutation has(had, they havn't updated in a while) a contest to see if anyone could get more :)
El Muerte: there is no real limit, never has been. However pre-UT2004 having a lot of mutators slows down the game during start-up. In UT2004 the mutator info is cached. Also this is not the right place to ask, the Help Desk is the right place.
Fyfe: A plan for refactoring. This page has turned into an overview page for coding not unrealscript, the plan in my head at the moment is to make this page an intro&/overview for unrealscript "The Programming Language". The rest should be moved out to a page covering the UnrealEngine and a page covering Coding and/or Moding.
note: most of these pages need refactored as well.
- UnrealScript Language Reference
- Variable Type
- Variable Syntax
- Function Syntax
- Class Syntax
- Default Properties
- Replication Block
- Operators
- Flow Syntax
- State
- Exec Directive
- Built-Ins – Needs a better name?
- Global Function
- Built-In Struct
- Iterator – Rename to Built-In Iterators?
- UnrealScript Keywords
- Special UnrealScript Keywords – These should be moved into the appropriate syntax pages (eg Self and Super to Class Syntax)
Fyfe: Just noticed the best solution for the refactoring of this is in the title of my plan, udn2:UnrealScriptReference. This describes the language better than any of the pages in the list above.