• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code [Help] Zed Gun - Coding Alternative to "MotionDetectionThreat"

StarArk99

Active member
Aug 25, 2012
33
0
I want to code/modify the Z.E.D Gun to track all kinds of specimens, instead of just weak, medium, strong and boss specimens. The problem with that is the "MotionDetectionThreat" variable. Specimens use that variable to set of pipebombs; The Flesh Pounds MDT Variable is "5", while the Crawlers is "0.34" and from experience, I know that in order to set off pipebombs, the MDT Var. must be at least 1.

The ZED Gun recognizes specimens by using this bit of code:

Code:
 // Update the motion tracker screen
    if ( ROLE == ROLE_Authority && Instigator != none )
 {
  if( EnemyUpdateTime <= 0 )
  {
            EnemyUpdateTime = 0.2;
            TeamIndex = Instigator.GetTeamNum();
         KFPC = KFPlayerController(Instigator.Controller);
         if ( KFPC != none  )
            {
          foreach Instigator.CollidingActors(class'Pawn', EnemyPawn, 1875)
          {
           if ( EnemyPawn.Health > 0 && EnemyPawn.GetTeamNum() != TeamIndex )
           {
            EnemyPawnLocations[i] = EnemyPawn.Location;
            // Set the Z location to threat level so we can use that on the client
                        if( KFMonster(EnemyPawn) != none )
            {
                EnemyPawnLocations[i].Z = KFMonster(EnemyPawn).MotionDetectorThreat * 1000;
                if( KFMonster(EnemyPawn).MotionDetectorThreat > MaxThreat ||
                                (KFMonster(EnemyPawn).MotionDetectorThreat >= 3.0 && (VSize(EnemyPawn.Location - Instigator.Location) < HighestThreatDist)) )
                {
                    HighestThreatDist = VSize( EnemyPawn.Location - Instigator.Location );
                                MaxThreat = KFMonster(EnemyPawn).MotionDetectorThreat;

Midway through trying to code it, I realized that if I used the current ZED Gun MDT system, then I'd have to change the "MotionDetectionThreat" of every specimen for each and everyone of them to be displayed on the ZED Gun Radar (Which would be a REALLY BAD THING, as I also want to be able to track a special specimen species I call "Energy Specimens, which CAN NOT set off pipebombs". I just want to be able to

In otherwords, I'd like to code a different variable (Possibly called "MotionTrackIndex") to use in Each of my Custom Specimens Files order to track their positions that are displayed on the custom ZED Gun. If the Numbers match or fit between a certain number value, then it would be displayed as an Abbreviation on my Custom Zed Gun variants radar.

I'd also like to have the screen display a more detailed location of the specimens, so I included the code snippet below, modified to how I think it might work:

Code:
 simulated event RenderTexture(ScriptedTexture Tex)
{
 local KFPlayerController KFPC;
 local rotator KFPCRotation, EnemyRotation;
 local vector EnemyLocation;
 local int i;
 local float Threat;
 local color ScreenEnemyColor;
    local texture ScreenEnemyTexture;
    Tex.DrawTile(0, 0, Tex.USize, Tex.VSize, 0, 0, 512, 512, ScriptedScreenBack, ScreenBackgroundColor); // Draws the tile background
 KFPC = KFPlayerController(Instigator.Controller);
 if ( KFPC != none && KFPC.Pawn != none )
 {
  KFPCRotation.Yaw = KFPC.Rotation.Yaw;
  for ( i = 0; i < 16; i++ )
  {
   if ( KFPC.EnemyLocation[i].X != 0.0 || KFPC.EnemyLocation[i].Y != 0.0 )
   {
    // Decompress the threat level of this monster
// THREAT LEVEL LIST
// Crawlers  = 1.0
//  Swarm Mother = 1.4
//   Swarm  = 1.5
//  Replicators  = 1.6
// Clots  = 2.0
//  Shivers  = 2.6
// Stalkers  = 3.0
//  Banshess  = 3.6
//  Blinds  = 3.8
// Bloats  = 4.0
// Siren  = 5.0
// Scrakes  = 6.0
// Flesh Pounds  = 7.0
// BOSS's  = 10.0
                Threat = KFPC.EnemyLocation[i].Z/1000;
                if( Threat <= 1.0 )
                {
                    ScreenEnemyTexture = ScreenEnemyTextureCrawler;
                }
                else if( Threat <= 1.4 )
                {
                    ScreenEnemyTexture = ScreenEnemyTextureSwarmMother;
                }
                else if( Threat <= 1.5 )
                {
                    ScreenEnemyTexture = ScreenEnemyTextureSwarm;
                }
  else if( Threat <= 1.6 )
                {
                    ScreenEnemyTexture = ScreenEnemyTextureReplicator;
                }
                else
                {
                    ScreenEnemyTexture = ScreenBossEnemyTexture;
                }
                ScreenEnemyColor = class'HUD'.default.WhiteColor;
                EnemyLocation = (KFPC.EnemyLocation[i] - KFPC.Pawn.Location) / 2500;
    EnemyLocation.Z = 0;
    EnemyRotation.Yaw = rotator(EnemyLocation).Yaw + 16384;
    EnemyLocation.X = VSize(EnemyLocation);
    EnemyLocation.Y = 0;
    EnemyLocation = (EnemyLocation * 768) >> (EnemyRotation - KFPCRotation);
    Tex.DrawTile(512 - EnemyLocation.X - (ScreenEnemyTexture.USize / 2), 1024 - EnemyLocation.Y - (ScreenEnemyTexture.VSize / 2), ScreenEnemyTexture.USize, ScreenEnemyTexture.VSize, 0, 0, ScreenEnemyTexture.USize, ScreenEnemyTexture.VSize, ScreenEnemyTexture, ScreenEnemyColor);
   }
  }
 }
}
Would that make the screen more intricate?
NOTE: 512 was originally 256, and 1024 was originally 512.
Any help please would be nice.