1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Duplicate Projectiles

Discussion in 'Programming' started by damaestrio, Mar 7, 2004.

  1. damaestrio

    damaestrio New Member

    Joined:
    Aug 30, 2001
    Messages:
    25
    Likes Received:
    0
    I'm trying to write in a function to spawn a projectile in a weapon. I can't subclass from the original projectilefire, so I've written this code:

    Code:
    function SpawnProjectile(Vector Start, Rotator Dir)
    {
      local UETFWeapon Fweapon;
      local Projectile p;
    
      FWeapon=UETFWeapon(Weapon);
    
      if (Role < Role_Authority)
         return;
        
      if (Fweapon.BulletsInClip<=0){
         Super.ModeDoReload();
         return;
      }
    
      if (p==None){
         p = Spawn(ProjectileClass,,, Start, Dir);
      }
    }
    
    However, this code creates 2 projectiles each time it's called instead of one.
    I believe only one projectile is actually replicated-the other doesn't seem to do damage.

    Any help with getting rid of the second projectile?

    -Maestro
     
    Last edited by a moderator: Mar 7, 2004
  2. Mr Evi1

    Mr Evi1 New Member

    Joined:
    Mar 22, 2002
    Messages:
    336
    Likes Received:
    0
    Fire modes are spawned on both client and server, thus your check for role will always be true. Check weapon.role instead.
     

Share This Page