Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 33

Thread: Cool Upcoming java Prog. by Me :)

  1. #11
    Join Date
    Feb 2005
    Posts
    139
    Rep Power
    0

    Default

    Ok, here's the function i overrided(polymorphisezed) from returning a single deathstring to return multiple deathstrings.

    ------------------ORIGINAL--------------------
    Code:
    //DeathMessage Function
    //===========================================================================
    static function string DeathMessage(PlayerReplicationInfo Killer, PlayerReplicationInfo Victim)
    {
    	return Default.DeathString;
    }
    //===========================================================================
    ------------------------MY VERSION-------------------------
    Code:
    //DeathMessage Function
    //==========================================================================
    static function string DeathMessage(PlayerReplicationInfo Killer, PlayerReplicationInfo Victim)
    {
         local float f;
         local String NewDeathStringA;
         local String NewDeathStringB;
         local String NewDeathStringC;
    
         NewDeathStringA = "%o was eviscerated by %k's Plasma-Fletchette Rifle.";
         NewDeathStringB = "%o was sliced-n-diced by %k's Plasma-Fletchette Rifle.";
         NewDeathStringC = "%k's Plasma-Fletchette Rifle tore %o a new one!";
         f = FRand();
    
         if (f < 0.32)
         {
              DeathString = NewDeathStringA;
              return Default.DeathString;
         }
         else if (f < 0.73)
         {
              Default.DeathString = NewDeathStringB;
              return Default.DeathString;
         }
         else
         {
              Default.DeathString = NewDeathStringC;
              return Default.DeathString;
         }
    }
    //===========================================================================
    my version uses the FRand() function to return a random number from 0.0 to 1.0. Originally you could only see 1 predefined string used. my version randomizes between 3 strings. I think it a cool addition and also a cool use of polymorphism.
    Do not live your life in fear, 'cuz if you do, you will never live your life.

  2. #12
    Join Date
    Feb 2005
    Posts
    139
    Rep Power
    0

    Default

    I'll add a self destruct mutator later.
    Do not live your life in fear, 'cuz if you do, you will never live your life.

  3. #13
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    I think this is very cool. You can create more effects. Using high level function calling, you could achieve so much more in that game.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  4. #14
    Join Date
    Feb 2005
    Posts
    139
    Rep Power
    0

    Default

    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
    Do not live your life in fear, 'cuz if you do, you will never live your life.

  5. #15
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    I am interested, not like most people, but to each his own.

    I will install this combo, if I get a little info on how to do that, please. I have UT2004 + ECE Editor's choice vehicles and maps + more downloaded maps.

    I would also what to know what more could I get in that game. Could I write a program that gives the bots a new attack formation, like setting groups of three with different mission objectives? Could I load a plane with a bigger explosion when it crashes, so if you are in the plane and your life is low, you can crash into and kill your enemy?
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  6. #16
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    Oh shoots if you have any exams, me can wait. Got lots of stuff to do myself
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  7. #17
    Join Date
    Feb 2005
    Posts
    139
    Rep Power
    0

    Default

    Well, i have a history SBA due friday so i'll write a tut on how to compile a UT2k4 package.it simply really.

    About what you said.
    1- To have a bigger explosion when a aircraft crashes
    You could just spawn a explosion mesh already meade in ut and and use the DrawScale and triple it.

    2- Multiple teams.
    You would have to write a new gametype class and maybe a new gameinfo class. The Gametype close to what youre talking is Assault. You could get some good pointers from looking in Assaoult gametype class.

    The SelfDestruct is from the Combo Pack package im making. Even though im still quite a noob at UScript it pretty simple once you get the gist. I gonna relaese the combopack with 5 new combos, an Adrenaline rush mutator(gives 20 in each adrenaline capsule than 2) and my new plasmaFletchette Rifle. the 5 combos are
    1-SelfDestruct (Starts the sequence and in 5 seconds eveything goes boom!)
    2-TimeDie (Slows down time for everyone except you)
    3-Loaded (Regenerates ammo for all your current weapons)
    4-Transformation(youll only have my new gun as weapon)
    5-One-Shot-1-Kill (1 shot kills any enimies, but if you miss you die)

    If there are anymore ill add. Also, do you know of any new good java book that has SWT and all the new stuff in Java2?
    Do not live your life in fear, 'cuz if you do, you will never live your life.

  8. #18
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    I found this on SWT (It takes minutes to load)
    http://help.eclipse.org/help30/index...e/swt/SWT.html
    Its an online list, without much explanation, of the functions in eclipse SWT

    and this 3MB pdf (did not veiw it)
    The "Standard Widget Toolkit" chapter in the Programmer's Guide for Eclipse

    Reference

    Nothing much either on Java 2, but here goes
    From sun, the SDK documentation is here
    http://java.sun.com/docs/index.html
    The Deitel book
    http://www.deitel.com/training/java/java_4.html
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  9. #19
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default

    Here is a bunch of tutorials on swt and eclipse http://www.cs.umanitoba.ca/~eclipse/ . You dont need Eclipse to program swt, but they do go hand in hand. Youll need the swt libraries and the swt dll's for windows and "so" library files for linux if you intend to use another ide.

  10. #20
    Join Date
    Feb 2005
    Posts
    139
    Rep Power
    0

    Default

    Thanks ill check it out. Im almost done with my combo pack. Just a few bugs and weak coding needs to be fixed/changed. Ill send it to you when it done crosswire and also how to set it up. Ill try to change the code of my Java proj to swt and well take it from there.
    Do not live your life in fear, 'cuz if you do, you will never live your life.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •