Hauptseite | Damage vs. Distance - Forum | Registrieren | Login
[ Neue Beiträge · User · Suche · RSS ]

Seite 1 von 11
Forum » Mapping & Modding » Mapping & Modding » Damage vs. Distance

Damage vs. Distance
DAMAGE vs. DISTANCE

Weapon damage is reduced at far distances (for all (onscoped) bullet
weapons).

The damage is reduced for distances over 1500 units. There is a linear fall
off from normal damage at 1500 units till half damage at 2500 units
distance. The damage never falls under 50%. Afaik, 1 unit equals 1 inch, so
this leads to:
0.0m - 38.4m: 100% damage
38.4m - 64.0m: 100% - 50% damage
>64.0m : 50% damage

Here the source from the file g_weapon.c, function Bullet_Fire_Extended:

Code

        if( distance_falloff ) {
            vec_t dist;
            vec3_t shotvec;

            //VectorSubtract( tr.endpos, start, shotvec );
            VectorSubtract( tr.endpos, muzzleTrace, shotvec );
            dist = VectorLengthSquared( shotvec );

            if( dist > Square(1500.f) ) {
                reducedDamage = qtrue;

                if( dist > Square(2500.f) ) {
                    damage *= 0.5f;
                } else {
                    float scale = 1.f - 0.5f * (Square(1000.f) / (dist - Square(1000.f)));

                    damage *= scale;
                }
            }
        }

submitted by Ragnar-X-

Forum » Mapping & Modding » Mapping & Modding » Damage vs. Distance
Seite 1 von 11
Suche:

Copyright etpro.de © 2008-2016 . Toolbar | Impressum | Kontakt

Bookmark and Share