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
 
(22 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 
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.
 
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.
  
Line 7: Line 8:
  
 
<uscript>
 
<uscript>
//=============================================================================
+
// paste your code here
// Copyright 2008-Now Josh Lee a.k.a. Pendragon @ Hedstem.com
+
// All rights Reserved.
+
// This was created to add a make the game rock.
+
//=============================================================================
+
 
+
class H3D_TagMutator extends UTMutator config(H3D_TagMutator);
+
 
+
var() config array<string> H3D_Inventories;
+
var() config float SpawnIntervalMin, SpawnIntervalMax;
+
 
+
var int LastUsedNode;
+
 
+
var array<PathNode> found_nodes;
+
var array<vector> used_nodes;
+
 
+
 
+
Function MatchStarting() {
+
local PathNode FoundNode;
+
`log("ASSHAT: Start");
+
if( H3D_Inventories.Length == -1 ) {
+
LogInternal( "SHIT! We are out of beer!!!", Name );
+
`log( "ASSHAT: SHIT! We are out of beer!!!");
+
Destroy();
+
}
+
 
+
Super.MatchStarting();
+
ForEach WorldInfo.AllNavigationPoints( Class'PathNode', FoundNode ) { // Create a list of nodes.
+
found_nodes[found_nodes.Length] = FoundNode;
+
}
+
if( found_nodes.Length != 1 ) {
+
SetTimer( RandRange( SpawnIntervalMin, SpawnIntervalMax ),, 'RandomSpawn' );
+
`log( "ASSHAT: Timer Set");
+
} else {
+
LogInternal( "No NavigationPoints found in this map!", Name );
+
`log( "ASSHAT: No NavigationPoints found in this map!");
+
Destroy();
+
}
+
}
+
function remNode(vector Loc) {
+
local int i;
+
local array<vector> new_array;
+
for(i=0;i<used_nodes.Length;i++) {
+
if(used_nodes[i] != Loc) {
+
new_array[new_array.Length] = used_nodes[i];
+
}
+
}
+
used_nodes = new_array;
+
}
+
function addNode(vector Loc) {
+
if(!nodeUsed(loc)) {
+
used_nodes[used_nodes.Length] = Loc;
+
}
+
}
+
function bool nodeUsed(vector Loc) {
+
local int i;
+
for(i=0;i<used_nodes.Length;i++) {
+
if(used_nodes[i] == Loc) {
+
return True;
+
}
+
}
+
return False;
+
}
+
 
+
Function RandomSpawn() {
+
local int CurrentNode, RandInvNum;
+
local PickupFactory Spawned_HItem;
+
local vector tempLoc;
+
local byte SpawnAttempts;
+
 
+
GetNode:
+
if( SpawnAttempts > 2 ) {
+
return;
+
}
+
CurrentNode = Rand( found_nodes.Length );
+
if( LastUsedNode == CurrentNode ) { // Don''t spawn a present at same spot.
+
Goto'GetNode'; // Try another.
+
}
+
LastUsedNode = CurrentNode;
+
tempLoc = found_nodes[CurrentNode].Location;
+
if(nodeUsed(tempLoc)) {
+
if(SpawnAttempts > 2) {
+
SetTimer( RandRange( SpawnIntervalMin, SpawnIntervalMax ),, 'RandomSpawn' );
+
}
+
Goto'GetNode';
+
}
+
Spawned_HItem = Spawn( Class'H3D_PickupFactory', Self,, tempLoc );
+
 
+
if( Spawned_HItem == None ) { // Get another node and try to spawn again.
+
SpawnAttempts ++;
+
Goto'GetNode';
+
}
+
+
RandInvNum = Rand( H3D_Inventories.Length );
+
+
if( H3D_Inventories[RandInvNum] != "" ) {
+
Spawned_HItem.InventoryType = Class<Inventory>( DynamicLoadObject( H3D_Inventories[RandInvNum], Class'Class', True ) );
+
Spawned_HItem.remNode = remNode;
+
addNode(tempLoc);
+
} else {
+
LogInternal( "Spawned_HItem"@RandInvNum@"is empty!", Name );
+
}
+
SetTimer( RandRange( SpawnIntervalMin, SpawnIntervalMax ),, 'RandomSpawn' ); // Prepare the next Spawned_HItem.
+
}
+
 
+
defaultproperties {
+
  H3D_Inventories(0)="InsaneMOFO.UTBerserkMOFO"
+
  H3D_Inventories(1)="InvisibleR.UTInvisibilityR"
+
  H3D_Inventories(2)="Speed.UTSpeed"
+
  H3D_Inventories(3)="InsaneMOFO.UTBerserkMOFO"
+
  H3D_Inventories(4)="InvisibleR.UTInvisibilityR"
+
  H3D_Inventories(5)="Speed.UTSpeed"
+
  H3D_Inventories(6)="UTGameContent.UTJumpBoots"
+
  H3D_Inventories(7)="UTGameContent.UTInvisibility"
+
  H3D_Inventories(8)="UTGameContent.UTDeployableEMPMine"
+
  H3D_Inventories(9)="UTGameContent.UTDeployableEnergyShield"
+
  H3D_Inventories(10)="UTGameContent.UTDeployableShapedCharge"
+
  H3D_Inventories(11)="UTGameContent.UTDeployableSlowVolume"
+
  H3D_Inventories(12)="SwarmAvril.UTWeap_SwarmAvril_Content"
+
  H3D_Inventories(13)="UTGameContent.UTDeployableSpiderMineTrap"
+
  H3D_Inventories(14)="UTGameContent.UTUDamage"
+
  H3D_Inventories(15)="UTGameContent.UTJumpBoots"
+
  H3D_Inventories(16)="UTGameContent.UTInvisibility"
+
  H3D_Inventories(17)="UTGameContent.UTDeployableEMPMine"
+
  H3D_Inventories(18)="UTGameContent.UTDeployableEnergyShield"
+
  H3D_Inventories(19)="UTGameContent.UTDeployableShapedCharge"
+
  H3D_Inventories(20)="UTGameContent.UTDeployableSlowVolume"
+
  H3D_Inventories(21)="UTGameContent.UTDeployableSpiderMineTrap"
+
  H3D_Inventories(22)="UTGameContent.UTUDamage"
+
  H3D_Inventories(23)="PPC.UTWeap_PPC"
+
  H3D_Inventories(24)="H3D_Healer.H3D_Deployable_Healer"
+
 
+
  SpawnIntervalMin=10.000000
+
  SpawnIntervalMax=30.000000
+
  // PickupSound=SoundCue'H3D_Tag.Sounds.OmegaCue'
+
  GroupNames(0)="H3D_Inventories"
+
  Begin Object SpriteComponent Name=Sprite ObjName=Sprite Archetype=SpriteComponent'UTGame.Default__UTMutator:Sprite'
+
      ObjectArchetype=SpriteComponent'UTGame.Default__UTMutator:Sprite'
+
  End Object
+
  Components(0)=Sprite
+
  Name="Default__H3D_TagMutator"
+
  ObjectArchetype=UTMutator'UTGame.Default__UTMutator'
+
}
+
 
+
 
</uscript>
 
</uscript>
  
<uscript>
+
====Full Key====
//=============================================================================
+
* <sup>1</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 1]].
// Copyright 2008-Now Josh Lee a.k.a. Pendragon @ Hedstem.com
+
* <sup>2</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]].
// All rights Reserved.
+
* <sup>2+</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]], from this version onwards.
// This was created to add a make the game rock.
+
* <sup>2x</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]], starting with [[UT2004]].
//=============================================================================
+
* <sup>3</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]].
 
+
* <sup>3+</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]], starting with [[UT3]] patch 2.0.
class H3D_PickupFactory extends UTPowerupPickupFactory;
+
* <sup>3*</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]], starting with [[UDK]].
var SoundCue PickupSound;
+
* (no number) &ndash; {'''$Topic''' is relevant/available to/in} all Unreal Engine generations.
 
+
<br>
Function PickedUpBy( Pawn P ) {
+
====Enum Key====
TriggerEventClass(class'SeqEvent_PickupStatusChange', P, 1);
+
{{classgames|Vector}}<sup>--|</sup><br>
P.PlaySound( PickupSound );
+
{{classgames|Range}}<sup>--|'''2'''</sup><br>
if (P.Controller != None && P.Controller.MoveTarget == self) {
+
{{classgames|Vector2D}}<sup>--|'''3'''</sup><br>
P.SetAnchor(self);
+
{{classgames|Color}}<br>
P.Controller.MoveTimer = -1.0;
+
{{classgames|LinearColor}}<br>
}
+
<br>
remNode(Location);
+
====Class Key====
Destroy();
+
{{classgames|Actor}}<br>
}
+
{{classgames|Rook}}<br> - TribesV?
delegate remNode(vector MyLocation);
+
{{classgames|SoundCue}}<br>
 
+
{{classgames|UTGreedGame}}<br>
defaultproperties
+
{{classgames|LegendObjectComponent}}<br>
{
+
{{classgames|FluidSurfaceOscillator}}<br>
  PickupSound=SoundCue'H3D_Tag.Sound.OmegaCue'
+
{{classgames|Ammunition}}<br>
  Begin Object Class=SkeletalMeshComponent Name=VisualMesh ObjName=VisualMesh Archetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent'
+
{{classgames|Util}}<br>
      SkeletalMesh=SkeletalMesh'H3D_Tag.SkMesh.TheTag'
+
{{classgames|xUtil}} -UE2??<br>
      bUpdateSkelWhenNotRendered=False
+
{{classgames|UnrealPlayer}}<br>
      bUseAsOccluder=False
+
{{classgames|xPlayer}} -UE2??<br>
      bForceDirectLightMap=True
+
{{classgames|UTPlayerController}}<br>
      bCastDynamicShadow=False
+
{{classgames|WeaponFire}}
      CollideActors=False
+
<br>
      BlockRigidBody=False
+
====Keyword Key====
      Translation=(X=0.000000,Y=0.000000,Z=5.000000)
+
{{classgames|Expands}}<br>
      Name="VisualMesh"
+
{{classgames|Extends}}<br>
      ObjectArchetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent'
+
{{classgames|server}}<br>
  End Object
+
{{classgames|replicated}}<br>
  PickupMesh=VisualMesh
+
{{classgames|intrinsic}}<br>
 
+
  Begin Object Name=StaticMeshComponent1 ObjName=StaticMeshComponent1 Archetype=StaticMeshComponent'UTGame.Default__UTPowerupPickupFactory:StaticMeshComponent1'
+
      ObjectArchetype=StaticMeshComponent'UTGame.Default__UTPowerupPickupFactory:StaticMeshComponent1'
+
  End Object
+
 
+
  Spinner=StaticMeshComponent1
+
  InventoryType=Class'H3D_TagMutator.H3D_Inventory'
+
  Begin Object Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTPowerupPickupFactory:CollisionCylinder'
+
      ObjectArchetype=CylinderComponent'UTGame.Default__UTPowerupPickupFactory:CollisionCylinder'
+
  End Object
+
  CylinderComponent=CollisionCylinder
+
  Components(0)=CollisionCylinder
+
  Begin Object Name=PathRenderer ObjName=PathRenderer Archetype=PathRenderingComponent'UTGame.Default__UTPowerupPickupFactory:PathRenderer'
+
      ObjectArchetype=PathRenderingComponent'UTGame.Default__UTPowerupPickupFactory:PathRenderer'
+
  End Object
+
  Components(1)=PathRenderer
+
  Components(2)=PickupLightEnvironment
+
  Components(3)=VisualMesh
+
  Components(4)=None
+
  CollisionComponent=CollisionCylinder
+
    RemoteRole=ROLE_SimulatedProxy
+
    bStatic=False
+
    bHidden=False
+
    bNoDelete=False
+
    bNetInitialRotation=True
+
 
+
  Name="Default__H3D_PickupFactory"
+
  ObjectArchetype=UTPowerupPickupFactory'UTGame.Default__UTPowerupPickupFactory'
+
}
+
 
+
</uscript>
+

Latest revision as of 07:41, 6 October 2011

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 the last few hours (the last edit timestamp is 2011-10-06 07:41:16), 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 you removed.

Clean up after you're done!


// paste your code here

Full Key[edit]

  • 1 – {$Topic is relevant/available to/in} Unreal Engine 1.
  • 2 – {$Topic is relevant/available to/in} Unreal Engine 2.
  • 2+ – {$Topic is relevant/available to/in} Unreal Engine 2, from this version onwards.
  • 2x – {$Topic is relevant/available to/in} Unreal Engine 2, starting with UT2004.
  • 3 – {$Topic is relevant/available to/in} Unreal Engine 3.
  • 3+ – {$Topic is relevant/available to/in} Unreal Engine 3, starting with UT3 patch 2.0.
  • 3* – {$Topic is relevant/available to/in} Unreal Engine 3, starting with UDK.
  • (no number) – {$Topic is relevant/available to/in} all Unreal Engine generations.


Enum Key[edit]

Vector(RTNP, U1, UT, U2, U2XMP, UE2Runtime, UT2003, UT2004, UDK, UT3)--|
Range(U2, U2XMP, UE2Runtime, UT2003, UT2004)--|2
Vector2D(UDK, UT3)--|3
Color(RTNP, U1, UT, U2, U2XMP, UE2Runtime, UT2003, UT2004, UDK, UT3)
LinearColor(UDK, UT3)

Class Key[edit]

Actor(RTNP, U1, UT, U2, U2XMP, UE2Runtime, UT2003, UT2004, UDK, UT3)
Rook(no matching games found)
- TribesV? SoundCue(UDK, UT3)
UTGreedGame(UT3)
LegendObjectComponent(U2XMP)
FluidSurfaceOscillator(U2, U2XMP, UE2Runtime, UT2003, UT2004)
Ammunition(U2XMP, UE2Runtime, UT2003, UT2004)
Util(U2, U2XMP)
xUtil(no matching games found) -UE2??
UnrealPlayer(UT2003, UT2004)
xPlayer(no matching games found) -UE2??
UTPlayerController(UDK, UT3)
WeaponFire(UT2003, UT2004)

Keyword Key[edit]

Expands(no matching games found)
Extends(no matching games found)
server(no matching games found)
replicated(no matching games found)
intrinsic(no matching games found)