OK, here's what. Im gonna check out SWT. Ive got a bunch of java books in chm and pdf (over 100mbs), however the lastest 1 is Learning Java 2nd Ed. by Orielly. I really only wanted to learn Java because UnrrealScript is an OOP language. But i found it to be very cool so i continued. Ill look up swt and try to write the new code for the the GUI. Im using IntelliJ IDEA and just dled the Java 2 SDK. Anyway, lookj at this selfDestruct Combo i wrote for UT2k4.
Code:
//=================================================================================
//NAME:ComboSelfDestruct
//INFO:You self destruct, killing yourself and EVERYONE around you!
//=================================================================================
class ComboSelfDestruct extends Combo;
//Class Variables
//It seems Class variables cant be assigned values. im still scratching my head..
//===============================================================================
var xEmitter Effect;
var int i;
var localized String ScreenMessage;
var Pawn P;
var vector Start;
//===============================================================================
//When "Self-Destruct Sequwnce" is execute, the player will be easily recognized:
//1 - Red Overlay on player who has initiated the sequence
//2 - Numbers over their head showing how much time is left
//===============================================================================
function StartEffect(xPawn P)
{
local Pawn newP;
local Material M;
newP = Pawn(Owner);
M = TexPanner'XGameShaders.PlayerShaders.PlayerTransPanRed';
if (P.Role == ROLE_Authority)
{
/*
Effect = Spawn(Class'SelfDestructEffect5', P,, Start, P.Rotation);
Effect.SetBase(P, Start);
Effect.bHardAttach = true;
*/
newP.OverlayMaterial = M;
newP.OverlayTimer=7.56000;
}
SetTimer(1.5, true);
Timer();
}
//===============================================================================
//Realized using "Effect = Spawn(..." cant be done in Timer(). Cool anyway, just
//create my own instance method err, i mean function :) java, still in my head.
//===============================================================================
function Timer()
{
local vector deathVector;
deathVector = P.Location;
deathVector.Z = deathVector.Z + 25;
Log("Entered Timer()");
P = Pawn(Owner);
if(i == 0) //lol :), just like java. Class variables are automatically
{i=6;} //initialized to 0, or sumthing like that....
//Could/Should have used PostBeginPlay()
if (P.Role == ROLE_Authority)
{
if (i == 6)
{
SecondsLeft(Class'SelfDestructEffect5');
Default.ScreenMessage="SELF DESTRUCT IN 5...";
P.ReceiveLocalizedMessage(class'SelfDestructDisplay');
i--;
}
else if (i == 5)
{
SecondsLeft(Class'SelfDestructEffect4');
Default.ScreenMessage="4...";
P.ReceiveLocalizedMessage(class'SelfDestructDisplay');
i--;
}
else if (i == 4)
{
SecondsLeft(Class'SelfDestructEffect3');
Default.ScreenMessage="3...";
P.ReceiveLocalizedMessage(class'SelfDestructDisplay');
i--;
}
else if (i == 3)
{
SecondsLeft(Class'SelfDestructEffect2');
Default.ScreenMessage="2...";
P.ReceiveLocalizedMessage(class'SelfDestructDisplay');
i--;
}
else if (i == 2)
{
SecondsLeft(Class'SelfDestructEffect1');
Default.ScreenMessage="1...";
P.ReceiveLocalizedMessage(class'SelfDestructDisplay');
i--;
}
else if (i == 1)
{
//SecondsLeft(Class'SelfDestructEffectBoom'); you'll be dead, so cant use this
Spawn(Class'SelfDestructEffectBoom',, , deathVector, P.Rotation);
Default.ScreenMessage="BOOM!!!";
P.ReceiveLocalizedMessage(class'SelfDestructDisplay');
Boom();
}
}
}
//===============================================================================
//Takes in a xEmitter class(really my subclass), assigns it as effect and sets
//it above player.
//===============================================================================
function SecondsLeft(class<SelfDestructTime> EffectClass)
{
P = Pawn(Owner);
Start = P.Location;
Start.Z = Start.Z + 75; //in UU i.e. Unreal Units. (65536 uu == 360)
//Not sure how height in inches/cm works...
/*
Spawn() Function Params
1-Class'' -> REQUIRED
2-Owner -> OPTIONAL
3-Tag -> OPTIONAL
4-Location -> REQUIRED
5-Rotation -> REQUIRED
*/
Effect = Spawn(EffectClass, P, , Start, P.Rotation);
Effect.SetBase(P, Start);
Effect.bHardAttach = true;
//What Do I Need To Make This Stay Over The Pawn's Head???
//Answer, Ask on BeyondUnreal forums ([-_-])
}
//===============================================================================
//Spawn Redeemer Miscle, Hide it and Call Explode function ;)
//===============================================================================
function Boom()
{
local Projectile Proj;
local vector HitNormal;
P = Pawn(Owner);
Proj = Spawn(Class'SelfDestructBomb',, , P.Location, P.Rotation);
Proj.bHidden = true;
Proj.Explode(P.Location, HitNormal);
}
//===============================================================================
//I dont think i'll need this, lifespan matches timer() >1.500000<
//===============================================================================
function StopEffect(xPawn P)
{
if (Effect != None)
{
Effect.Destroy();
}
else
{}
}
//===============================================================================
//Not using ExecMessage. Created my own class to send localized messages to pawn
//===============================================================================
defaultproperties
{
Keys(0)=1 //BACK
Keys(1)=2 //FORWARD
Keys(2)=1 //BACK
Keys(3)=2 //FORWARD
//ExecMessage="" Ill not use this
ScreenMessage = "INSERT TEXT HERE" //Called with "Default."
Duration=7.560000
}
//-BloodLust
I know this in not a UnrealScript forum, but if many people are intrested maybe we could ask for 1