Page 1 of 1

Cheats UC?

PostPosted: Thu Oct 19, 06 9:04 pm
by {17}Ales
Hey how would you use cheats like tantalus in uc for something like a tantalus gun.

PostPosted: Fri Oct 20, 06 12:12 am
by Bob
Forgive my ignorance, but what is UC?

PostPosted: Fri Oct 20, 06 12:26 am
by Allan
Unreal Console? or Unreal Code(Script)?

PostPosted: Fri Oct 20, 06 8:58 am
by Mastakilla
Why make a gun that uses a tantalus cheat, why not just make it a very high hitdamage.

PostPosted: Fri Oct 20, 06 10:47 am
by MainMan
So what you're saying is... you want a gun, that kills people? 'Cause that's a new idea... :P

PostPosted: Fri Oct 20, 06 3:22 pm
by Gishank
Ales, what IS the point in having a gun which tantalus's people...

PostPosted: Fri Oct 20, 06 4:25 pm
by Cozmo
So it can kill invincible stuff as well? And that boomy effect. :roll:

PostPosted: Fri Oct 20, 06 5:36 pm
by {17}Ales
~Cozmo~ wrote:So it can kill invincible stuff as well? And that boomy effect. :roll:

Its was an example now is there anyway to do this?

PostPosted: Fri Oct 20, 06 6:43 pm
by Mastakilla
If you mean a weapon that can give the effect of a cheat, then yeah probably.

If you mean a weapon that cheats, then your out of your mind.

PostPosted: Fri Oct 20, 06 9:53 pm
by MainMan
Yeah it is possible. Just take a look at the code in exec function tantalus in the player class, and put it into the processtracehit() in the weapon class. Hang on I'll find the code for ya.

PostPosted: Fri Oct 20, 06 9:56 pm
by Spiderbot01
Make me a gun that flys around and tries to tantalus me and I will truly be impressed.

PostPosted: Fri Oct 20, 06 10:09 pm
by MainMan
From the player class we can extract:

Code: Select all
exec function Tantalus()
{
   local Actor            hitActor;
   local Vector           hitLocation, hitNormal;
   local Vector           position, line;
   local ScriptedPawn     hitPawn;
   local DeusExMover      hitMover;
   local DeusExDecoration hitDecoration;
   local bool             bTakeDamage;
   local int              damage;

   if (!bCheatsEnabled)
      return;

   bTakeDamage = false;
   damage      = 1;
   position    = Location;
   position.Z += BaseEyeHeight;
   line        = Vector(ViewRotation) * 4000;

   hitActor = Trace(hitLocation, hitNormal, position+line, position, true);
   if (hitActor != None)
   {
      hitMover = DeusExMover(hitActor);
      hitPawn = ScriptedPawn(hitActor);
      hitDecoration = DeusExDecoration(hitActor);
      if (hitMover != None)
      {
         if (hitMover.bBreakable)
         {
            hitMover.doorStrength = 0;
            bTakeDamage = true;
         }
      }
      else if (hitPawn != None)
      {
         if (!hitPawn.bInvincible)
         {
            hitPawn.HealthHead     = 0;
            hitPawn.HealthTorso    = 0;
            hitPawn.HealthLegLeft  = 0;
            hitPawn.HealthLegRight = 0;
            hitPawn.HealthArmLeft  = 0;
            hitPawn.HealthArmRight = 0;
            hitPawn.Health         = 0;
            bTakeDamage = true;
         }
      }
      else if (hitDecoration != None)
      {
         if (!hitDecoration.bInvincible)
         {
            hitDecoration.HitPoints = 0;
            bTakeDamage = true;
         }
      }
      else if (hitActor != Level)
      {
         damage = 5000;
         bTakeDamage = true;
      }
   }

   if (bTakeDamage)
      hitActor.TakeDamage(damage, self, hitLocation, line, 'Tantalus');
}



Therefore, the bits we are interested in are:

Code: Select all
      hitMover = DeusExMover(hitActor);
      hitPawn = ScriptedPawn(hitActor);
      hitDecoration = DeusExDecoration(hitActor);
      if (hitMover != None)
      {
         if (hitMover.bBreakable)
         {
            hitMover.doorStrength = 0;
            bTakeDamage = true;
         }
      }
      else if (hitPawn != None)
      {
         if (!hitPawn.bInvincible)
         {
            hitPawn.HealthHead     = 0;
            hitPawn.HealthTorso    = 0;
            hitPawn.HealthLegLeft  = 0;
            hitPawn.HealthLegRight = 0;
            hitPawn.HealthArmLeft  = 0;
            hitPawn.HealthArmRight = 0;
            hitPawn.Health         = 0;
            bTakeDamage = true;
         }
      }
      else if (hitDecoration != None)
      {
         if (!hitDecoration.bInvincible)
         {
            hitDecoration.HitPoints = 0;
            bTakeDamage = true;
         }
      }
      else if (hitActor != Level)
      {
         damage = 5000;
         bTakeDamage = true;
      }
   }

   if (bTakeDamage)
      hitActor.TakeDamage(damage, self, hitLocation, line, 'Tantalus');


These deal with the checking if what you tantalused was a pawn, a mover (door) or a decoration.



Next we can place it into the weapon class. Firstly I had a look at the ProcessTraceHit function:

Code: Select all
simulated function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
   local float        mult;
   local name         damageType;
   local DeusExPlayer dxPlayer;

   if (Other != None)
   {
      // AugCombat increases our damage if hand to hand
      mult = 1.0;
      if (bHandToHand && (DeusExPlayer(Owner) != None))
      {
         mult = DeusExPlayer(Owner).AugmentationSystem.GetAugLevelValue(class'AugCombat');
         if (mult == -1.0)
            mult = 1.0;
      }

      // skill also affects our damage
      // GetWeaponSkill returns 0.0 to -0.7 (max skill/aug)
      mult += -2.0 * GetWeaponSkill();

      // Determine damage type
      damageType = WeaponDamageType();

      if (Other != None)
      {
         if (Other.bOwned)
         {
            dxPlayer = DeusExPlayer(Owner);
            if (dxPlayer != None)
               dxPlayer.AISendEvent('Futz', EAITYPE_Visual);
         }
      }
      if ((Other == Level) || (Other.IsA('Mover')))
      {
         if ( Role == ROLE_Authority )
            Other.TakeDamage(HitDamage * mult, Pawn(Owner), HitLocation, 1000.0*X, damageType);

         SelectiveSpawnEffects( HitLocation, HitNormal, Other, HitDamage * mult);
      }
      else if ((Other != self) && (Other != Owner))
      {
         if ( Role == ROLE_Authority )
            Other.TakeDamage(HitDamage * mult, Pawn(Owner), HitLocation, 1000.0*X, damageType);
         if (bHandToHand)
            SelectiveSpawnEffects( HitLocation, HitNormal, Other, HitDamage * mult);

         if (bPenetrating && Other.IsA('Pawn') && !Other.IsA('Robot'))
            SpawnBlood(HitLocation, HitNormal);
      }
   }
   if (DeusExMPGame(Level.Game) != None)
   {
      if (DeusExPlayer(Other) != None)
         DeusExMPGame(Level.Game).TrackWeapon(self,HitDamage * mult);
      else
         DeusExMPGame(Level.Game).TrackWeapon(self,0);
   }
}


We can see that the part here calling the damage is:

Code: Select all
      if ((Other == Level) || (Other.IsA('Mover')))
      {
         if ( Role == ROLE_Authority )
            Other.TakeDamage(HitDamage * mult, Pawn(Owner), HitLocation, 1000.0*X, damageType);

         SelectiveSpawnEffects( HitLocation, HitNormal, Other, HitDamage * mult);
      }
      else if ((Other != self) && (Other != Owner))
      {
         if ( Role == ROLE_Authority )
            Other.TakeDamage(HitDamage * mult, Pawn(Owner), HitLocation, 1000.0*X, damageType);
         if (bHandToHand)
            SelectiveSpawnEffects( HitLocation, HitNormal, Other, HitDamage * mult);

         if (bPenetrating && Other.IsA('Pawn') && !Other.IsA('Robot'))
            SpawnBlood(HitLocation, HitNormal);
      }




Therefore, when I put in code based on the tantalus command, the completed function will look like:

Code: Select all
simulated function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
   local float        mult;
   local name         damageType;
   local DeusExPlayer dxPlayer;

   local ScriptedPawn     hitPawn;
   local DeusExMover      hitMover;
   local DeusExDecoration hitDecoration;

   local bool             bTakeDamage;

   if (Other != None)
   {
      if (Other != Self)
      {
         //MM: ADDED===
         hitMover = DeusExMover(hitActor);
         hitPawn = ScriptedPawn(hitActor);
         hitDecoration = DeusExDecoration(hitActor);
         //=======

         if (Other.bOwned)
         {
            dxPlayer = DeusExPlayer(Owner);
            if (dxPlayer != None)
               dxPlayer.AISendEvent('Futz', EAITYPE_Visual);
         }
      }

      //MM: ADDED=======
      if (hitMover != None)
      {
         if (hitMover.bBreakable)
         {
            hitMover.doorStrength = 0;
            bTakeDamage = true;
         }
         SelectiveSpawnEffects( HitLocation, HitNormal, Other, 5000);
      }
      //==========




      //MM: ADDED=======
      else if ( (hitPawn != None) && (hitPawn != Pawn(Owner) )
      {
         if (!hitPawn.bInvincible)
         {
            hitPawn.HealthHead     = 0;
            hitPawn.HealthTorso    = 0;
            hitPawn.HealthLegLeft  = 0;
            hitPawn.HealthLegRight = 0;
            hitPawn.HealthArmLeft  = 0;
            hitPawn.HealthArmRight = 0;
            hitPawn.Health         = 0;
            bTakeDamage = true;
         }

         if (bHandToHand)
            SelectiveSpawnEffects( HitLocation, HitNormal, Other, 5000);

         SpawnBlood(HitLocation, HitNormal);
      }
      //===========


      //MM: ADDED=======
      else if (hitDecoration != None)
      {
         if (!hitDecoration.bInvincible)
         {
            hitDecoration.HitPoints = 0;
            bTakeDamage = true;
         }
      }
      //=======


      //MM: ADDED=======
      if (bTakeDamage)
      {
         //MM: Take Damage must be called on the server (that's what Role_authority means)
         if(Role == ROLE_Authority)
         {
            Other.TakeDamage(5000, self, hitLocation, line, 'Tantalus');
         }
      }
      //======

   }
   if (DeusExMPGame(Level.Game) != None)
   {
      if (DeusExPlayer(Other) != None)
         DeusExMPGame(Level.Game).TrackWeapon(self,5000);
      else
         DeusExMPGame(Level.Game).TrackWeapon(self,0);
   }
}


Hope it helped!

PostPosted: Fri Oct 20, 06 10:31 pm
by ~ô¿ô~Nobody~
I doubt it will have helped him.

PostPosted: Fri Oct 20, 06 10:32 pm
by MainMan
~[A]Nobody~ wrote:I doubt it will have helped him.

Why? :?

PostPosted: Fri Oct 20, 06 10:33 pm
by ~ô¿ô~Nobody~
Because he is not that experienced at coding. He cannot use the code without knowing the basics.

PostPosted: Fri Oct 20, 06 10:35 pm
by MainMan
~[A]Nobody~ wrote:Because he is not that experienced at coding. He cannot use the code without knowing the basics.


Yes, but I was just explaining what I was doing, to try and help him learn. But at the end, I just gave him a block of code that he can copy-and-paste, without understanding.

PostPosted: Fri Oct 20, 06 10:46 pm
by ~ô¿ô~Nobody~
hmm. i see.

PostPosted: Fri Oct 20, 06 11:00 pm
by ICE
~[A]Nobody~ wrote:Because he is not that experienced at coding. He cannot use the code without knowing the basics.

heh i know abit |:

PostPosted: Fri Oct 20, 06 11:03 pm
by MainMan
ICE wrote:
~[A]Nobody~ wrote:Because he is not that experienced at coding. He cannot use the code without knowing the basics.

heh i know abit |:

Just copy and paste the last bit into your weapon script dude. Try to read my explanation of how I made that code too, though - it will help you to learn :)

PostPosted: Sat Oct 21, 06 12:27 am
by Mastakilla
I still think making it a really high hitdamage would've been easyer.

PostPosted: Sat Oct 21, 06 4:26 am
by clyzm
Spiderf[A]g01 wrote:Make me a gun that flys around and tries to tantalus me and I will truly be impressed.


Actually that's easy. Just change a player class mesh to "pistol" or whatever, make its weapon the "tantaluspistol" (coding it beforehand) and unlimited ammo.

Either that or just make the GM or GF meshes invincible so that the third person mesh is viewable only.