Announcement

Collapse
No announcement yet.

UT04 "correct" explosive bullet code.(troubleshooting)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UT04 "correct" explosive bullet code.(troubleshooting)

    I am a mad weapons modder loved the ease of the cut and pasteyness of Uscript 03 had quirks but 04 is giving me no end of pain,

    I been working on this awhile got some leads but my scripting skills have withered in the last year or 2 since I was modding...of coarse I was always a hack but sheesh I is stpid now LOL

    Anyway lets start of with this I am using the Wiki MinigunHE as my starting point.



    What I am doing is trying to get this complied into 04 it worked under 03 but not under 04.

    Code:
    function ExtendedHurtRadius(vector HitLocation, vector AimDir, Actor HitActor)
    {
      local Actor Victims;
      local float damageScale, dist, damageAmount;
      local vector dir;
      
      DamageAmount = RandRange(DamageMin, DamageMax) * DamageAtten;
      foreach Weapon.VisibleCollidingActors(class'Actor', Victims, DamageRadius + 200, HitLocation) {
        // don't let blast damage affect fluid - VisibleCollisingActors doesn't really work for them - jag
        if (Victims != self && Victims.Role == ROLE_Authority && !Victims.IsA('FluidSurfaceInfo')) {
          dist = DistToCylinder(Victims.Location - HitLocation, Victims.CollisionHeight, Victims.CollisionRadius);
          if ( dist > DamageRadius )
            continue;
          dir = Normal(Victims.Location - HitLocation);
          if (Victims == HitActor)
            dir = Normal(dir + AimDir);
          damageScale = 1 - FMax(0, dist / DamageRadius);
          Victims.TakeDamage(damageScale * DamageAmount, Instigator, Victims.Location - 0.5 * (Victims.CollisionHeight + Victims.CollisionRadius) * dir, damageScale * Momentum * dir, DamageType);
          if (Vehicle(Victims) != None && Vehicle(Victims).Health > 0)
            Vehicle(Victims).DriverRadiusDamage(DamageAmount, DamageRadius, Instigator.Controller, DamageType, Momentum, HitLocation);
        }
      }
    }
    
    /**
    Calculates a point's distance to a cylinder.
    */
    static final function float DistToCylinder(vector CenterDist, float HalfHeight, float Radius)
    {
      CenterDist.X = VSize(vect(1,1,0) * CenterDist) - Radius;
      if (CenterDist.X < 0)
        CenterDist.X = 0;
      
      CenterDist.Y = 0;
      
      if (CenterDist.Z < 0)
        CenterDist.Z *= -1;
      
      CenterDist.Z -= HalfHeight;
      if (CenterDist.Z < 0)
        CenterDist.Z = 0;
      
      return VSize(CenterDist);
    }
    I know the altfire class needs to updated to ExtendedHurtRadius and not HurtRadius but I cannot trouble shoot past bad linking, I have tried making a new class and extending instantfire and jsut adign it tot he fire mode class itelf but I am at a loss here.

    Also...whats the best weapon replacement mut?
    I get mixed results using the example thats in the MinigunHE.

    #2
    What is the compiler error you get?

    Comment


      #3
      Originally posted by .:..: View Post
      What is the compiler error you get?
      Error: C:\Unreal Anthology\UT2004\ZippyUT4k\Classes\InstantFireX.uc (13) : Error, Call to 'VisibleCollidingActors': bad or missing parameter 3
      when I compile as a standalone extending instant fire.
      Error: C:\Unreal Anthology\UT2004\ZippyUT4k\Classes\MinigunHEAltFir e.uc(54) : Error, Unrecognized member 'ExtendedHurtRadius' in class 'Pawn'
      when I compile it in the fire mode using Instigator.ExtendedHurtRadius.

      Error: C:\Unreal Anthology\UT2004\ZippyUT4k\Classes\MinigunHEAltFir e.uc(54) : Error, Call to 'ExtendedHurtRadius': type mismatch in parameter 1
      using ExtendedHurtRadius

      Comment


        #4
        Parameter 3 (as listed in the posted code) is DamageRadius, the compiler message would seem to indicate that you have not declared that variable in your instantfireX class (and it is not declared in any parent classes). Add something like 'var float damageradius' to your instantfireX class and then set it to some value in the default properties.

        ExtendedHurtRadius is not a function or variable of pawn (instigator is of type pawn), so instigator.extendedHurtRadius does not make any sense (this is why the compiler does not recognize it). Don't bother placing the 'Instigator.' in front.

        And in the final error, it would appear that you are attempting to pass ExtendedHurtRadius something other than a vector for the first argument when this function is being called at line 54 in your MinigunHEAltFire class, could you post that bit of code?

        Comment


          #5
          Originally posted by meowcat View Post
          Parameter 3 (as listed in the posted code) is DamageRadius, the compiler message would seem to indicate that you have not declared that variable in your instantfireX class (and it is not declared in any parent classes). Add something like 'var float damageradius' to your instantfireX class and then set it to some value in the default properties.

          ExtendedHurtRadius is not a function or variable of pawn (instigator is of type pawn), so instigator.extendedHurtRadius does not make any sense (this is why the compiler does not recognize it). Don't bother placing the 'Instigator.' in front.

          And in the final error, it would appear that you are attempting to pass ExtendedHurtRadius something other than a vector for the first argument when this function is being called at line 54 in your MinigunHEAltFire class, could you post that bit of code?
          first off how would be the the best way to compile this?

          For 03 I just exstened or added to instant fire and ti complied and I merely changed hurtradius to extend hurtradius.

          Interesting I copied instsantfire to my mod folder and added the code to it

          heres the error I got
          Error: C:\Unreal Anthology\UT2004\ZippyUT4k\Classes\InstantFire.uc( 104) : Error, Call to 'VisibleCollidingActors': bad or missing parameter 3

          heres the instantfire code wit it added that gave the above error
          Code:
          class InstantFire extends WeaponFire;
          
          var class<DamageType> DamageType;
          var int DamageMin, DamageMax;
          var float TraceRange;
          var float Momentum;
          
          function float MaxRange()
          {
              if (Instigator.Region.Zone.bDistanceFog)
                  TraceRange = FClamp(Instigator.Region.Zone.DistanceFogEnd, 8000, default.TraceRange);
              else
              	TraceRange = default.TraceRange;
          
          	return TraceRange;
          }
          
          function DoFireEffect()
          {
              local Vector StartTrace;
              local Rotator R, Aim;
          
              Instigator.MakeNoise(1.0);
          
              // the to-hit trace always starts right in front of the eye
              StartTrace = Instigator.Location + Instigator.EyePosition();
              Aim = AdjustAim(StartTrace, AimError);
          	R = rotator(vector(Aim) + VRand()*FRand()*Spread);
              DoTrace(StartTrace, R);
          }
          
          function DoTrace(Vector Start, Rotator Dir)
          {
              local Vector X, End, HitLocation, HitNormal, RefNormal;
              local Actor Other;
              local int Damage;
              local bool bDoReflect;
              local int ReflectNum;
          
          	MaxRange();
          
              ReflectNum = 0;
              while (true)
              {
                  bDoReflect = false;
                  X = Vector(Dir);
                  End = Start + TraceRange * X;
          
                  Other = Weapon.Trace(HitLocation, HitNormal, End, Start, true);
          
                  if ( Other != None && (Other != Instigator || ReflectNum > 0) )
                  {
                      if (bReflective && Other.IsA('xPawn') && xPawn(Other).CheckReflect(HitLocation, RefNormal, DamageMin*0.25))
                      {
                          bDoReflect = true;
                          HitNormal = Vect(0,0,0);
                      }
                      else if ( !Other.bWorldGeometry )
                      {
          				Damage = DamageMin;
          				if ( (DamageMin != DamageMax) && (FRand() > 0.5) )
          					Damage += Rand(1 + DamageMax - DamageMin);
                          Damage = Damage * DamageAtten;
          
          				// Update hit effect except for pawns (blood) other than vehicles.
                         	if ( Other.IsA('Vehicle') || (!Other.IsA('Pawn') && !Other.IsA('HitScanBlockingVolume')) )
          					WeaponAttachment(Weapon.ThirdPersonActor).UpdateHit(Other, HitLocation, HitNormal);
          
                         	Other.TakeDamage(Damage, Instigator, HitLocation, Momentum*X, DamageType);
                          HitNormal = Vect(0,0,0);
                      }
                      else if ( WeaponAttachment(Weapon.ThirdPersonActor) != None )
          				WeaponAttachment(Weapon.ThirdPersonActor).UpdateHit(Other,HitLocation,HitNormal);
                  }
                  else
                  {
                      HitLocation = End;
                      HitNormal = Vect(0,0,0);
          			WeaponAttachment(Weapon.ThirdPersonActor).UpdateHit(Other,HitLocation,HitNormal);
                  }
          
                  SpawnBeamEffect(Start, Dir, HitLocation, HitNormal, ReflectNum);
          
                  if (bDoReflect && ++ReflectNum < 4)
                  {
                      //Log("reflecting off"@Other@Start@HitLocation);
                      Start = HitLocation;
                      Dir = Rotator(RefNormal); //Rotator( X - 2.0*RefNormal*(X dot RefNormal) );
                  }
                  else
                  {
                      break;
                  }
              }
          }
          
          function ExtendedHurtRadius(vector HitLocation, vector AimDir, Actor HitActor)
          {
            local Actor Victims;
            local float damageScale, dist, damageAmount;
            local vector dir;
          
            DamageAmount = RandRange(DamageMin, DamageMax) * DamageAtten;
            foreach Weapon.VisibleCollidingActors(class'Actor', Victims, DamageRadius + 200, HitLocation) {
              // don't let blast damage affect fluid - VisibleCollisingActors doesn't really work for them - jag
              if (Victims != self && Victims.Role == ROLE_Authority && !Victims.IsA('FluidSurfaceInfo')) {
                dist = DistToCylinder(Victims.Location - HitLocation, Victims.CollisionHeight, Victims.CollisionRadius);
                if ( dist > DamageRadius )
                  continue;
                dir = Normal(Victims.Location - HitLocation);
                if (Victims == HitActor)
                  dir = Normal(dir + AimDir);
                damageScale = 1 - FMax(0, dist / DamageRadius);
                Victims.TakeDamage(damageScale * DamageAmount, Instigator, Victims.Location - 0.5 * (Victims.CollisionHeight + Victims.CollisionRadius) * dir, damageScale * Momentum * dir, DamageType);
                if (Vehicle(Victims) != None && Vehicle(Victims).Health > 0)
                  Vehicle(Victims).DriverRadiusDamage(DamageAmount, DamageRadius, Instigator.Controller, DamageType, Momentum, HitLocation);
              }
            }
          }
          
          /**
          Calculates a point's distance to a cylinder.
          */
          static final function float DistToCylinder(vector CenterDist, float HalfHeight, float Radius)
          {
            CenterDist.X = VSize(vect(1,1,0) * CenterDist) - Radius;
            if (CenterDist.X < 0)
              CenterDist.X = 0;
          
            CenterDist.Y = 0;
          
            if (CenterDist.Z < 0)
              CenterDist.Z *= -1;
          
            CenterDist.Z -= HalfHeight;
            if (CenterDist.Z < 0)
              CenterDist.Z = 0;
          
            return VSize(CenterDist);
          }
          
          
          
          
          function SpawnBeamEffect(Vector Start, Rotator Dir, Vector HitLocation, Vector HitNormal, int ReflectNum)
          {
          }
          
          
          defaultproperties
          {
               TraceRange=10000.000000
               Momentum=1.000000
               NoAmmoSound=ProceduralSound'WeaponSounds.PReload5.P1Reload5'
          }
          the point of the code is to make raduis damage more efficant for damaging the player as well as actors/pawns.

          sorry if I am not overly helpful this is more advanced than I can handle thus why I am seeking halp =0-o=!

          Comment


            #6
            hmm, well you shouldn't create your own InstantFire class with the exact same name as a pre-existing class. Based on your second post I thought you were simply extending the instantfire class (with your InstantFireX class as listed in the error message).

            And even though you are declaring the function, you have not declared the DamageRadius variable anywhere in the code so you will still get the same compile error (see how DamageMin, Tracerange etc are declared at the beginning of the class, and how damageScale and Victims are declared at the beginning of the ExtendedHurtRadius function?)

            Comment


              #7
              the above code is used as a exstenion of instafire the damage/radius and whatnot is put into the fire mode.

              I have gone stupid over this(like I was so bright before LOL)

              The weapon I am using this with is the Minigun HE

              What I really need is someone to just give me a working example of what to do to get this to work.

              Comment

              Working...
              X