Announcement

Collapse
No announcement yet.

Projectiles don't appear(Fixed)

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

    Projectiles don't appear(Fixed)

    I've had this problem before and it is really frustrating me. I fixed a hammer projectile and it gets displayed but it doesn't deal any damage when it hits the enemy.

    Code:
    //==============================================
    //BricklauncherHammerprojectile
    //==============================================
    class bricklauncherprojectiletwo extends projectile;
    
    #exec OBJ LOAD FILE=BrickLauncher.utx
    
    simulated function PostBeginPlay()
    {
        Super.PostBeginPlay();
    
        if (Role == ROLE_Authority)
        {
            Velocity = Vector(Rotation) * Speed;
        }
    }
    
    defaultproperties
    {
       DrawScale3D=(X=1,Y=1,Z=1)
       Physics=PHYS_Projectile
       bFixedRotationDir=true
       DesiredRotation=(Pitch=12000,Yaw=5666,Roll=2334)
       Rotation=(Pitch=50,Yaw=0,Roll=0)
       Rotationrate=(Pitch=-45000,Yaw=0,Roll=0)
       DrawType=DT_StaticMesh
       StaticMesh=StaticMesh'BrickLauncher.Hammerprj'
       MaxSpeed=2750
       CollisionHeight=20
       CollisionRadius=7
       Speed=2050
       Damage=150
       LifeSpan=18
    }
    The hammer displays but it doesn't hit.

    My bricks however used to display but now after tweaking them a bit they don't display anymore. It doesn't make any sence because the codes are so similar.

    Code:
    //==============================================
    //Bricklauncherprojectile
    //==============================================
    class bricklauncherprojectile extends projectile;
    
    #exec OBJ LOAD FILE=BrickLauncher.utx
    
    var xEmitter NewTrail;
    
    simulated function PostNetBeginPlay()
    {
             Super.PostNetBeginPlay();
    }
    
    
    
    simulated function Destroyed()
    {
        if (NewTrail != None)
        {
           NewTrail.destroy();
        }
        Super.Destroyed();
    }
    
    defaultproperties
    {
       DrawScale3D=(X=1,Y=1,Z=1)
       StaticMesh=StaticMesh'BrickLauncher.Brickprj'
       Physics=PHYS_Falling
       DrawType=DT_StaticMesh
       acceleration=-10
       MaxSpeed=1750
       Speed=1500
       Damage=40
       bBounce=false
       LifeSpan=12
       CollisionHeight=50
       CollisionRadius=80
    }
    Any help would be appreciated, Thanks in advance.

    #2
    You're missing a few functions reguarding damage. Heres the code for my shotgun pellets. As far as the not displaying goes, are you sure it is in fact being spawned? You can verify this with a simple log in PostBeginPlay. If it is being spawned then you might want to up the drawscale, perhaps its too small to be seen.

    Code:
    var float DamageAtten;
    
    simulated function PostBeginPlay()
    {
        Velocity = Vector(Rotation) * (Speed);
        if (PhysicsVolume.bWaterVolume)
            Velocity *= 0.65;
    
        SetRotation(RotRand());
    
        Super.PostBeginPlay();
    }
    
    simulated function ProcessTouch (Actor Other, vector HitLocation)
    {
        if ( (Weapon_MossbergProjectile(Other) == None) && ((Physics == PHYS_Falling) || (Other != Instigator)) )
        {
            speed = VSize(Velocity);
            if ( speed > 200 )
            {
                if ( Role == ROLE_Authority )
    			{
    				if ( Instigator == None || Instigator.Controller == None )
    					Other.SetDelayedDamageInstigatorController( InstigatorController );
    
                    Other.TakeDamage( Max(5, Damage - DamageAtten*FMax(0,(default.LifeSpan - LifeSpan - 1))), Instigator, HitLocation,
                        (MomentumTransfer * Velocity/speed), MyDamageType );
    			}
            }
            Destroy();
        }
    }
    
    simulated function Landed( Vector HitNormal )
    {
        SetPhysics(PHYS_None);
        Destroy();
    }
    
    simulated function HitWall( vector HitNormal, actor Wall )
    {
        if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
        {
            if ( Level.NetMode != NM_Client )
                Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), MyDamageType);
            Destroy();
            return;
        }
        SetPhysics(PHYS_Falling);
        Destroy();
    }
    
    simulated function PhysicsVolumeChange( PhysicsVolume Volume )
    {
        if (Volume.bWaterVolume)
        {
            if ( Trail != None )
                Trail.mRegen=False;
            Velocity *= 0.65;
        }
    }

    Comment


      #3
      I have no idea what happend but when i put in a logger for testing means all of a sudden the brick appeared again. I don't know why that happend it just did.
      Code:
      //==============================================
      //BricklauncherFire
      //==============================================
      class bricklauncherFire extends ProjectileFire;
      
        function int Holdtimeboost(int number)
        {
         number = 0;
         if (Holdtime <= 3)
         log(" Wow it worked ");
         else
         return 0;
        }
      
      defaultproperties
      {
        FireRate=.75
        AmmoClass=class'XWeapons.LinkAmmo'
        AmmoPerFire=-1
        bFireOnRelease=true
      
        ProjectileClass=class'bricklauncherprojectile'
        ProjSpawnoffset=(X=25,Y=12,Z=-6);
      
      
      }
      Whatever anyways I typed in the code you posted however i am confused with one line of code.

      Code:
      simulated function ProcessTouch (Actor Other, vector HitLocation)
      {
          if ( (Weapon_bricklauncherProjectile(Other) == None) && ((Physics == PHYS_Falling) || (Other != Instigator)) )
          {
              speed = VSize(Velocity);
              if ( speed > 200 )
              {
                  if ( Role == ROLE_Authority )
      			{
      				if ( Instigator == None || Instigator.Controller == None )
      					Other.SetDelayedDamageInstigatorController( InstigatorController );
      
                      Other.TakeDamage( Max(5, Damage - DamageAtten*FMax(0,(default.LifeSpan - LifeSpan - 1))), Instigator, HitLocation,
                          (MomentumTransfer * Velocity/speed), MyDamageType );
      			}
              }
              Destroy();
          }
      }
      Also how do you bring the log up. I think it was automatic in ut2003 but i could be wrong.

      Comment


        #4
        showlog

        Comment


          #5
          Simple enough thanks.

          Comment


            #6
            I am starting to get frustrated when i recompiled the brick with the new damage code it dissapeared again!

            Here are the codes that seem to influince whether the bricks appears or not.
            Code:
            //==============================================
            //Bricklauncherprojectile
            //==============================================
            class bricklauncherprojectile extends projectile;
            
            #exec OBJ LOAD FILE=BrickLauncher.utx
            
            var xEmitter NewTrail;
            var float DamageAtten;
            
            simulated function PostNetBeginPlay()
            {
                     Super.PostNetBeginPlay();
                       
                       if (Role == ROLE_Authority)
                       {
                           Velocity = Vector(Rotation) * Speed;
                       }
            }
            
            simulated function ProcessTouch (Actor Other, vector HitLocation)
            {
                if ( (bricklauncherProjectile(Other) == None) && ((Physics == PHYS_Falling) || (Other != Instigator)) )
                {
                    speed = VSize(Velocity);
                    if ( speed > 200 )
                    {
                        if ( Role == ROLE_Authority )
            			{
            				if ( Instigator == None || Instigator.Controller == None )
            					Other.SetDelayedDamageInstigatorController( InstigatorController );
            
                            Other.TakeDamage( Max(5, Damage - DamageAtten*FMax(0,(default.LifeSpan - LifeSpan - 1))), Instigator, HitLocation,
                                (MomentumTransfer * Velocity/speed), MyDamageType );
            			}
                    }
                    Destroy();
                }
            }
            
            simulated function Landed( Vector HitNormal )
            {
                SetPhysics(PHYS_None);
                Destroy();
            }
            
            simulated function HitWall( vector HitNormal, actor Wall )
            {
                if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
                {
                    if ( Level.NetMode != NM_Client )
                        Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), MyDamageType);
                    Destroy();
                    return;
                }
                SetPhysics(PHYS_Falling);
                Destroy();
            }
            
            simulated function PhysicsVolumeChange( PhysicsVolume Volume )
            {
                if (Volume.bWaterVolume)
                {
                    //if ( Trail != None )
                      //  Trail.mRegen=False;
                    Velocity *= 0.65;
                }
            }
            
            
            
            simulated function Destroyed()
            {
                if (NewTrail != None)
                {
                   NewTrail.destroy();
                }
                Super.Destroyed();
            }
            
            defaultproperties
            {
               DrawScale3D=(X=1,Y=1,Z=1)
               StaticMesh=StaticMesh'BrickLauncher.Brickprj'
               Physics=PHYS_Falling
               DrawType=DT_StaticMesh
               acceleration=-10
               MaxSpeed=1750
               Speed=1500
               Damage=40
               bBounce=false
               LifeSpan=12
               CollisionHeight=7
               CollisionRadius=18
            }
            
            //==============================================
            //BricklauncherFire
            //==============================================
            class bricklauncherFire extends ProjectileFire;
            
              function int Holdtimeboost(int number)
              {
              number = 3;
                      if (Holdtime <= 1)
                         {
                          log(" Wow it worked ");
                          return 0;
                         }
               else
               {
                   return 0;
               }
            
              }
            
            defaultproperties
            {
              FireRate=.75
              AmmoClass=class'XWeapons.LinkAmmo'
              AmmoPerFire=-1
              bFireOnRelease=true
            
              ProjectileClass=class'bricklauncherprojectile'
              ProjSpawnoffset=(X=25,Y=12,Z=-6);
            
            
            }
            Also when i put the same code for the hammer projectile It gets mad at a line i didn't even change.

            Code:
            simulated function ProcessTouch (Actor Other, vector HitLocation)
            {
                if ( (bricklauncherProjectiletwo(Other) == None) && ((Physics == PHYS_Falling) || (Other != Instigator)) )
                {
                    speed = VSize(Velocity);
                    if ( speed > 200 )
                    {
                        if ( Role == ROLE_Authority )
            			{
            				if ( Instigator == None || Instigator.Controller == None )
            					Other.SetDelayedDamageInstigatorController( InstigatorController );
            
                            Other.TakeDamage( Max(5, Damage - DamageAtten*FMax(0,(default.LifeSpan - LifeSpan - 1))), Instigator, HitLocation,
                                (MomentumTransfer * Velocity/speed), MyDamageType );
            			}
                    }
                    Destroy();
                }
            }
            If someone told showed me a link to a tutorial that helps on this kind of thing.

            Edit///////////////////////////////////
            Acgh when i added the fixed code to my hammer projectile the projectile stoped appearing.

            Edit2///////////////////////////////////////
            The destroy functions were getting rid of the projectile. but now it works. However now the projectiles just fall

            Comment


              #7
              I believe the projectile is hitting the Insitagor when it is spawed, thus destroying itself.


              when the projectile is spawned its physics is PHYS_Falling, so when code execution gets to this statement:
              (Physics == PHYS_Falling) || (Other != Instigator )
              it doesn't care if it hits the Instigator or not because the first statement is always true when it is first spawned. Changing the (||) to an (&&) should fix this.

              Comment

              Working...
              X