Sniper's Paradise!


Basic UnrealScript Information

These are some basic things you should know that will help you with your coding.

Commenting: Using comments within your code is a very useful way to help explain what is going on. Especially when your code starts to get complicated. Comments can also be used to save any ideas you might have. They can comment out one line, or entire paragraphs. To comment out one line we use “//” . To comment out paragraphs you begin the comment with “/*” and end it with “*/”. If you are using a syntax highlighting program such as TextPad the commented sections will appear in a green color if set up properly. For example.

class PowerUnit extends Actor;

//Variables
var int PowerSupply;
var int PowerLimit;
var bool PowerOn;

/*
I need to remember to fix the power supply bug!
Maybe I could try an inverse Tachyon beam!

*/

Debugging: These basic debugging techniques will help you to locate the source of any bugs or problems you might have. There are some more advanced techiques which you can read about here Unreal Wiki: Debugging Techniques.

//The log file can viewed in game by typing "showlog" in the console.

//The Log() function is available to all classes because it was declared in Object.
//"S" is what you want it to log. "Tag" is optional, it is used to change the name of the log.
//If "Tag" is omitted the name will default to "ScriptLog".
//Log() writes the string to the UT2004.log file in your UT2004/System folder.
Log( string S, optional name Tag );

//Warn() is almost exactly like Log(), except there is no "Tag" option.
//The name of this log is always "Warning".
Warn( string S );

//Broadcast() is declared in the GameInfo class and so is only available to those classes that can access it.
//Any Actor can access it through the level, which references GameInfo.
//"Sender" is the Actor doing the broadcasting, in most cases this will be "self".
//"Msg" is what you want it to log. Don't worry about the optional "Type" for now.
//Broadcast() is not written to the log, it is displayed on the screen via the in game chat.
Level.Game.Broadcast(Actor Sender, string Msg, optional name Type );

//The in game text to speech feature can be utilized if you would prefer an audio message.
//"Text" is what you want it to say. "Volume" is how loud you want the in game audio message to be.
TextToSpeech( string Text, float Volume );

//Examples of usage.
event Touch(Actor Other)
{
	if(Other != None)
	{
		Log( "I was touched", 'TouchWarning' );
		//Or...
		Warn( "I was touched" );
		//Or...
		Level.Game.Broadcast(self, "I was touched" );
		//Or...
		TextToSpeech("I was touched", 255.000000 );
	}
}
//You can log a huge range of things as most variables can be converted to a string. We can link them together with the
"@" or "$" operators. For example.

event Touch(Actor Other)
{

	if(Pawn(Other) != None)
	{
		Log( "I was touched by" @ Pawn(Other) @ "his health was" @ Pawn(Other).Health);
	}
}

//Which would output: ScriptLog: I was touched by DM-1on1-Idoma.xPawn his health was 100
//This is very useful as it allows us to keep track of almost anything we want.

Defaultproperties: Unreal classes have a special section where you can define the default properties of the global variables. The global variables of any parent classes can also be changed in this section.

The defaultproperties block is a special section in an UnrealScript class source file. It can define or redefine default values for all properties declared in the class or inherited from a parent class. If a property is not mentioned in the defaultproperties block, its default value is inherited from the parent class. If a property is not mentioned in any parent class defaultproperties either, its default value is corresponding the initial value of the property’s type..

The defaultproperties section appears at the end of the class. For example.

	//Class declaration.
	class PowerUnit extends Actor;

	//var declaration.
	var int PowerSupply;
	var int PowerLimit;
	var bool PowerOn;

	//function declaration/code.
	function PowerDown();

	function PowerUp();

	//defaultproperties.

	defaultproperties
	{
		PowerSupply=100
		PowerLimit=250
		PowerOn=true
		DrawScale=1.500000
		CollisionRadius=50.000000
		CollisionHeight=100.000000
	}

Console Commands: Console commands are useful during the creation process. Console commands should be inputted into the in game console by pressing either ” ‘ ” or “Tab”.

Command Example Description
addbots <number> addbots 2 Adds the specified number of bots to the game.
fly fly Allows you to fly around.
fov <number> fov 45 Changes the FOV (field of view), the normal FOV is 90.
ghost ghost Allows you to fly around and go through walls.
god god Turns on God mode, makes you invincible.
killall bot killall bot Kills all bots currently in the game, and removes them from play.
obj classes obj classes Displays a list of object classes in the log (type showlog in the console to view the log in game).
open <map> open DmAriza Loads the chosen map.
rmode <number> rmode 1 Changes the rendering mode (1 is wiremode, 5 is dynamic light (normal mode).
show collision show collision Shows collision and blocking volumes.
showdebug showdebug Shows a lot of debugging information on the screen.
showlog showlog Shows the log.
stat fps stat fps Toggles the display of the framerate.
summon <object> summon Unreali.SkaarjGunner Summons the chosen Actor. Please note, to summon weapons you must summon the pickup class instead. If the actor doesn’t appear check the log for errors, and try again in spectator or ghost mode.

Note – Very large Actors may not fit in the space, try to summon them in ghostmode. And double check your spelling when commands don’t seem to work.



Spam Killer

Back To Top
2005 Sniper's Paradise
All logos and trademarks are properties of their respective owners.
Unreal™ is a registered trademark of Epic Games Inc.
Privacy Policy
Website by Softly
Powered by RUSH