I'm a doctor, not a mechanic

Difference between revisions of "Unreal Wiki:Scratchpad"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(testing against different UE games)
Line 8: Line 8:
  
 
<uscript>
 
<uscript>
// paste your code here
+
class TestPawn extends Pawn;
 +
 
 +
var DynamicLightEnvironmentComponent LightEnvironment;
 +
 
 +
defaultproperties
 +
{
 +
  WalkingPct=+0.4
 +
  CrouchedPct=+0.4
 +
  BaseEyeHeight=38.0
 +
  EyeHeight=38.0
 +
  GroundSpeed=440.0
 +
  AirSpeed=440.0
 +
  WaterSpeed=220.0
 +
  AccelRate=2048.0
 +
  JumpZ=322.0
 +
  CrouchHeight=29.0
 +
  CrouchRadius=21.0
 +
  WalkableFloorZ=0.78
 +
 
 +
  //Components.Remove(Sprite)
 +
 
 +
  Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
 +
      bSynthesizeSHLight=TRUE
 +
      bIsCharacterLightEnvironment=TRUE
 +
      bUseBooleanEnvironmentShadowing=FALSE
 +
  End Object
 +
  Components.Add(MyLightEnvironment)
 +
  LightEnvironment=MyLightEnvironment
 +
 
 +
  Begin Object Class=SkeletalMeshComponent Name=WPawnSkeletalMeshComponent
 +
      //Your Mesh Properties
 +
      SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
 +
      AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
 +
      PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
 +
      AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
 +
      Translation=(Z=8.0)
 +
      Scale=1.075
 +
      //General Mesh Properties
 +
      bCacheAnimSequenceNodes=FALSE
 +
      AlwaysLoadOnClient=true
 +
      AlwaysLoadOnServer=true
 +
      bOwnerNoSee=false
 +
      CastShadow=true
 +
      BlockRigidBody=TRUE
 +
      bUpdateSkelWhenNotRendered=false
 +
      bIgnoreControllersWhenNotRendered=TRUE
 +
      bUpdateKinematicBonesFromAnimation=true
 +
      bCastDynamicShadow=true
 +
      RBChannel=RBCC_Untitled3
 +
      RBCollideWithChannels=(Untitled3=true)
 +
      LightEnvironment=MyLightEnvironment
 +
      bOverrideAttachmentOwnerVisibility=true
 +
      bAcceptsDynamicDecals=FALSE
 +
      bHasPhysicsAssetInstance=true
 +
      TickGroup=TG_PreAsyncWork
 +
      MinDistFactorForKinematicUpdate=0.2
 +
      bChartDistanceFactor=true
 +
      RBDominanceGroup=20
 +
      //MotionBlurScale=0.0
 +
      bUseOnePassLightingOnTranslucency=TRUE
 +
      bPerBoneMotionBlur=true
 +
  End Object
 +
  Mesh=WPawnSkeletalMeshComponent
 +
  Components.Add(WPawnSkeletalMeshComponent)
 +
 
 +
  Begin Object Name=CollisionCylinder
 +
      CollisionRadius=+0021.000000
 +
      CollisionHeight=+0044.000000
 +
  End Object
 +
  CylinderComponent=CollisionCylinder
 +
}
 +
</uscript>
 +
 
 +
<uscript>
 +
class TestPlayerController extends PlayerController;
 +
 
 +
simulated function PostBeginPlay()
 +
{
 +
    Super.PostBeginPlay();
 +
}
 +
 
 +
exec function StartFire( optional byte FireModeNum )
 +
{
 +
    local Vector Vec;
 +
   
 +
    `log("StartFire" @ FireModeNum);
 +
   
 +
    Vec.X = Location.X - 5.0;
 +
    Vec.Y = Location.Y;
 +
    Vec.Z = Location.Z;
 +
 
 +
    SetLocation(Vec); // Doesn't do anything
 +
    ShowTargetInfo();
 +
}
 +
 
 +
exec function StopFire( optional byte FireModeNum )
 +
{
 +
    `log("StopFire" @ FireModeNum);
 +
}
 +
 
 +
function DrawHUD(HUD H)
 +
{
 +
local float CrosshairSize;
 +
   
 +
super.DrawHUD(H);
 +
 
 +
H.Canvas.SetDrawColor(0,255,0,255);
 +
 
 +
CrosshairSize = 12;
 +
 
 +
H.Canvas.SetPos(H.CenterX - CrosshairSize, H.CenterY);
 +
H.Canvas.DrawRect(2 * CrosshairSize + 1, 1);
 +
 
 +
H.Canvas.SetPos(H.CenterX, H.CenterY - CrosshairSize);
 +
H.Canvas.DrawRect(1, 2 * CrosshairSize + 1);
 +
}
 +
 
 +
function ShowTargetInfo()
 +
{
 +
local vector loc, norm, end;
 +
local TraceHitInfo hitInfo;
 +
local Actor traceHit;
 +
 
 +
end = Location + normal(vector(Rotation)) * 32768; // trace to "infinity"
 +
traceHit = trace(loc, norm, end, Location, true,, hitInfo);
 +
 
 +
ClientMessage("");
 +
 
 +
if (traceHit == none)
 +
{
 +
ClientMessage("Nothing found, try again.");
 +
return;
 +
}
 +
 
 +
// Play a sound to confirm the information
 +
ClientPlaySound(SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_TargetLock');
 +
 
 +
// By default only 4 console messages are shown at the time
 +
ClientMessage("Hit: "$traceHit$"  class: "$traceHit.class.outer.name$"."$traceHit.class);
 +
ClientMessage("Location: "$loc.X$","$loc.Y$","$loc.Z);
 +
ClientMessage("Material: "$hitInfo.Material$"  PhysMaterial: "$hitInfo.PhysMaterial);
 +
ClientMessage("Component: "$hitInfo.HitComponent);
 +
}
 +
 
 +
defaultproperties
 +
{
 +
}
 +
</uscript>
 +
 
 +
<uscript>
 +
class TestGame extends GameInfo;
 +
 
 +
event InitGame(string Options, out string ErrorMessage)
 +
{
 +
    //local Pawn p;
 +
   
 +
    //p = Spawn(class'Pawn');
 +
}
 +
 
 +
event PlayerController Login(string Portal, string Options, const UniqueNetID UniqueID, out string ErrorMessage)
 +
{
 +
local PlayerController PC;
 +
 
 +
PC = super.Login(Portal, Options, UniqueID, ErrorMessage);
 +
ChangeName(PC, "EXetoC", True);
 +
    return PC;
 +
}
 +
 
 +
event PostLogin(PlayerController NewPlayer)
 +
{
 +
    super.PostLogin(NewPlayer);
 +
    NewPlayer.ClientMessage("Welcome to the grid " $ NewPlayer.PlayerReplicationInfo.PlayerName);
 +
    NewPlayer.ClientMessage("Point at an object and press the left mouse button to retrieve the target's information");
 +
}
 +
 
 +
defaultproperties
 +
{
 +
  PlayerControllerClass=class'Test.TestPlayerController'
 +
  DefaultPawnClass=class'Test.TestPawn'
 +
  HUDType=class'Test.TestHUD'
 +
  bDelayedStart=False
 +
}
 +
</uscript>
 +
 
 +
<uscript>
 +
class TestHUD extends HUD;
 +
 
 +
function DrawHUD()
 +
{
 +
local string ScoreString;
 +
local float XL, YL;
 +
 +
super.DrawHUD();
 +
 
 +
Canvas.SetDrawColor(190, 20, 20);
 +
ScoreString = "TEST1";
 +
Canvas.StrLen(ScoreString, XL, YL);
 +
Canvas.SetPos(Canvas.SizeX / 2 - XL, Canvas.SizeY / 2 - YL);
 +
Canvas.DrawText(ScoreString);
 +
Canvas.SetPos(Canvas.SizeX / 2 - XL, Canvas.SizeY / 2 - YL + YL);
 +
Canvas.DrawText("TEST2" @ "TEST3");
 +
}
 +
 
 +
defaultproperties
 +
{
 +
}
 
</uscript>
 
</uscript>
  

Revision as of 06:50, 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 06:50:03), 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!


class TestPawn extends Pawn;
 
var DynamicLightEnvironmentComponent LightEnvironment;
 
defaultproperties
{
   WalkingPct=+0.4
   CrouchedPct=+0.4
   BaseEyeHeight=38.0
   EyeHeight=38.0
   GroundSpeed=440.0
   AirSpeed=440.0
   WaterSpeed=220.0
   AccelRate=2048.0
   JumpZ=322.0
   CrouchHeight=29.0
   CrouchRadius=21.0
   WalkableFloorZ=0.78
 
   //Components.Remove(Sprite)
 
   Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
      bSynthesizeSHLight=TRUE
      bIsCharacterLightEnvironment=TRUE
      bUseBooleanEnvironmentShadowing=FALSE
   End Object
   Components.Add(MyLightEnvironment)
   LightEnvironment=MyLightEnvironment
 
   Begin Object Class=SkeletalMeshComponent Name=WPawnSkeletalMeshComponent
       //Your Mesh Properties
      SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
      AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
      PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
      AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
      Translation=(Z=8.0)
      Scale=1.075
      //General Mesh Properties
      bCacheAnimSequenceNodes=FALSE
      AlwaysLoadOnClient=true
      AlwaysLoadOnServer=true
      bOwnerNoSee=false
      CastShadow=true
      BlockRigidBody=TRUE
      bUpdateSkelWhenNotRendered=false
      bIgnoreControllersWhenNotRendered=TRUE
      bUpdateKinematicBonesFromAnimation=true
      bCastDynamicShadow=true
      RBChannel=RBCC_Untitled3
      RBCollideWithChannels=(Untitled3=true)
      LightEnvironment=MyLightEnvironment
      bOverrideAttachmentOwnerVisibility=true
      bAcceptsDynamicDecals=FALSE
      bHasPhysicsAssetInstance=true
      TickGroup=TG_PreAsyncWork
      MinDistFactorForKinematicUpdate=0.2
      bChartDistanceFactor=true
      RBDominanceGroup=20
      //MotionBlurScale=0.0
      bUseOnePassLightingOnTranslucency=TRUE
      bPerBoneMotionBlur=true
   End Object
   Mesh=WPawnSkeletalMeshComponent
   Components.Add(WPawnSkeletalMeshComponent)
 
   Begin Object Name=CollisionCylinder
      CollisionRadius=+0021.000000
      CollisionHeight=+0044.000000
   End Object
   CylinderComponent=CollisionCylinder
}
class TestPlayerController extends PlayerController;
 
simulated function PostBeginPlay()
{
    Super.PostBeginPlay();
}
 
exec function StartFire( optional byte FireModeNum )
{
    local Vector Vec;
 
    `log("StartFire" @ FireModeNum);
 
    Vec.X = Location.X - 5.0;
    Vec.Y = Location.Y;
    Vec.Z = Location.Z;
 
    SetLocation(Vec); // Doesn't do anything
    ShowTargetInfo();
}
 
exec function StopFire( optional byte FireModeNum )
{
    `log("StopFire" @ FireModeNum);
}
 
function DrawHUD(HUD H)
{
	local float CrosshairSize;
 
	super.DrawHUD(H);
 
	H.Canvas.SetDrawColor(0,255,0,255);
 
	CrosshairSize = 12;
 
	H.Canvas.SetPos(H.CenterX - CrosshairSize, H.CenterY);
	H.Canvas.DrawRect(2 * CrosshairSize + 1, 1);
 
	H.Canvas.SetPos(H.CenterX, H.CenterY - CrosshairSize);
	H.Canvas.DrawRect(1, 2 * CrosshairSize + 1);
}
 
function ShowTargetInfo()
{
	local vector loc, norm, end;
	local TraceHitInfo hitInfo;
	local Actor traceHit;
 
	end = Location + normal(vector(Rotation)) * 32768; // trace to "infinity"
	traceHit = trace(loc, norm, end, Location, true,, hitInfo);
 
	ClientMessage("");
 
	if (traceHit == none)
	{
		ClientMessage("Nothing found, try again.");
		return;
	}
 
	// Play a sound to confirm the information
	ClientPlaySound(SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_TargetLock');
 
	// By default only 4 console messages are shown at the time
 	ClientMessage("Hit: "$traceHit$"  class: "$traceHit.class.outer.name$"."$traceHit.class);
 	ClientMessage("Location: "$loc.X$","$loc.Y$","$loc.Z);
 	ClientMessage("Material: "$hitInfo.Material$"  PhysMaterial: "$hitInfo.PhysMaterial);
	ClientMessage("Component: "$hitInfo.HitComponent);
}
 
defaultproperties
{
}
class TestGame extends GameInfo;
 
event InitGame(string Options, out string ErrorMessage)
{
    //local Pawn p;
 
    //p = Spawn(class'Pawn');
}
 
event PlayerController Login(string Portal, string Options, const UniqueNetID UniqueID, out string ErrorMessage)
{
	local PlayerController PC;
 
	PC = super.Login(Portal, Options, UniqueID, ErrorMessage);
	ChangeName(PC, "EXetoC", True);
    return PC;
}
 
event PostLogin(PlayerController NewPlayer)
{
    super.PostLogin(NewPlayer);
    NewPlayer.ClientMessage("Welcome to the grid " $ NewPlayer.PlayerReplicationInfo.PlayerName);
    NewPlayer.ClientMessage("Point at an object and press the left mouse button to retrieve the target's information");
}
 
defaultproperties
{
   PlayerControllerClass=class'Test.TestPlayerController'
   DefaultPawnClass=class'Test.TestPawn'
   HUDType=class'Test.TestHUD'
   bDelayedStart=False
}
class TestHUD extends HUD;
 
function DrawHUD()
{	
	local string ScoreString;
	local float XL, YL;
 
	super.DrawHUD();
 
	Canvas.SetDrawColor(190, 20, 20);
	ScoreString = "TEST1";
	Canvas.StrLen(ScoreString, XL, YL);
	Canvas.SetPos(Canvas.SizeX / 2 - XL, Canvas.SizeY / 2 - YL);
	Canvas.DrawText(ScoreString);
	Canvas.SetPos(Canvas.SizeX / 2 - XL, Canvas.SizeY / 2 - YL + YL);
	Canvas.DrawText("TEST2" @ "TEST3");
}
 
defaultproperties
{
}

Full Key

  • 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

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

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

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)