Worst-case scenario: the UEd Goblin wipes the map and burns down your house.

Difference between revisions of "Unreal Wiki:Scratchpad"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
Line 6: Line 6:
  
 
<uscript>
 
<uscript>
 +
class MyTriggerMessage extend Trigger placeable;
 +
const NoOfMessages=5;
 +
var int WhichOne;
 +
function PostBeginPlay()
 +
{
 +
Super.PostBeginPlay()
 +
Message=GetMessage();
 +
}
 
function string GetMessage()
 
function string GetMessage()
 
{
 
{
local int i=Rand();
+
local string OutText[NoOfMessages];
if (i<0.2) return "11";
+
OutText[0]="11";
if (i<0.4) return "22";
+
OutText[1]="22";
if (i<0.6) return "33";
+
OutText[2]="33";
if (i<0.8) return "44";
+
OutText[3]="44";
return "55";
+
OutText[4]="55";
 +
WhichOne=Rand(NoOfMessages);
 +
return OutText[WhichOne];
 
}
 
}
 
</uscript>
 
</uscript>

Revision as of 18:48, 14 April 2008

This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.

You are free to remove any existing code from below, and paste your code between the <uscript> </uscript> tags. If the page hasn't been edited in 24 hours, you can assume it isn't needed anymore and can be removed. A full edit history will be available, so don't worry about losing anything.


class MyTriggerMessage extend Trigger placeable;
const NoOfMessages=5;
var int WhichOne;
function PostBeginPlay()
{
	Super.PostBeginPlay()
	Message=GetMessage();
}
function string GetMessage()
{
	local string OutText[NoOfMessages];
	OutText[0]="11";
	OutText[1]="22";
	OutText[2]="33";
	OutText[3]="44";
	OutText[4]="55";
	WhichOne=Rand(NoOfMessages);
	return OutText[WhichOne];
}