Skip to content

Free Aiming For Ranged Combat

szapp edited this page Oct 30, 2017 · 7 revisions

The feature Free Aiming for Ranged Combat (GFA_RANGED) offers quite some configuration regarding damage and accuracy adjustments.

For adjustments to the reticle, see reticle adjustments.
 

List of setting constants

GFA_TRUE_HITCHANCE
GFA_UPDATE_RET_SHOOT
GFA_TRAJECTORY_ARC_MAX
GFA_PROJECTILE_GRAVITY
GFA_MAX_RECOIL

The constants can be found in the file config/settings.d.
 

List of config functions

GFA_GetDrawForce
GFA_GetAccuracy
GFA_GetRecoil
GFA_GetInitialBaseDamage

The configuration of this feature is found in the file config/ranged.d.

GFA_TRUE_HITCHANCE

Enable hit chance by accuracy and physical scattering of shots (true), or disable to use Gothic's default hit chance calculated by hitchance and distance (Gothic 2) or dexterity and distance (Gothic 1).

GFA_UPDATE_RET_SHOOT

Also update the reticle while the shooting/reloading animation plays. If set to false, the reticle will remain the same in between shots.

GFA_TRAJECTORY_ARC_MAX

Maximum time (ms) after which a projectile trajectory drops off with gravity.

GFA_PROJECTILE_GRAVITY

Amount of gravity to apply to a projectile after [GFA_TRAJECTORY_ARC_MAX](#gfa_trajectory_arc_max) ms.

GFA_MAX_RECOIL

Visual angle (in degrees) of maximum recoil (when is recoil = 100%).


GFA_GetDrawForce

This function is called at the point of shooting a bow or a crossbow. The return value scales the gravity of the projectile in percent, where 0 is fast gravity drop-off and 100 is the straightest shot possible. Regardless of the percentage, however, all shots are impacted by gravity at the latest after GFA_TRAJECTORY_ARC_MAX milliseconds.

This function is also well-suited to be called by the other functions below.

Ideas: incorporate factors like e.g. a quick-draw talent, weapon-specific stats, ...

By default, for example, bows are scaled with longer draw time (how long has the bow been drawn), whereas crossbows are scaled with shorter aiming time (how long was the aim held steady). This results in slower build up once per aiming for bows and faster build up for crossbows, but restarts every time the mouse moves. Additionally, crossbows have recoil, see GFA_GetRecoil below. All of this is a design choice and can be changed in these functions.

func int GFA_GetDrawForce(C_Item weapon, int talent)
weapon Ranged weapon in use.
talent Talent value depending on the ranged weapon.
returns Draw force in percent (0 = no drop, 100 = maximum drop in gravity).

 

GFA_GetAccuracy

This function is called at the point of shooting a bow or a crossbow. The return value scales the accuracy of the projectile in percent, where 0 is maximum scattering and 100 is precisely on target.

Note: This function is only used, if [GFA_TRUE_HITCHANCE](#gfa_true_hitchance) == true. Otherwise, Gothic's default hit chance calculation (based on skill and distance from target) is used and the accuracy defined here does not take effect!

Ideas: incorporate factors like e.g. weapon-specific accuracy stats, weapon spread, accuracy talent, ...

By default, for example, the accuracy is scaled by talent and by draw force (see function above).
Note: For Gothic 1, instead of the talent, the dexterity is used (as is default for Gothic 1).

func int GFA_GetAccuracy(C_Item weapon, int talent)
weapon Ranged weapon in use.
talent Talent value depending on the ranged weapon.
returns Accuracy in percent (0 = worst, 100 = best).

 

GFA_GetRecoil

This function is called at the point of shooting a bow or a crossbow. The return value scales the recoil of the weapon in percent, where 0 is no recoil and 100 is maximum recoil.

Ideas: incorporate factors like e.g. weapon-specific recoil stats, weapon draw force, strength attribute, ...

By default, for example, the recoil is scaled with strength and is only active for crossbows, to counterbalance the shorter aiming time (better draw force), see GFA_GetDrawForce above.

func int GFA_GetRecoil(C_Item weapon, int talent)
weapon Ranged weapon in use.
talent Talent value depending on the ranged weapon.
returns Recoil in percent (0 = no recoil, 100 = most recoil).

 

GFA_GetInitialBaseDamage

This function is called at the point of shooting a bow or crossbow. It may be used to alter the base damage at time of shooting (if weapon has one damage type only). This should never be necessary, as all damage specifications should be set in the item script of the weapon. However, here the initial damage may be scaled by draw force or accuracy (see functions above). The return value is the base damage (equivalent to the damage in the item script of the weapon).

Ideas: incorporate factors like e.g. weapon-specific damage stats, draw force, ...

By default, for example, the damage is scaled by draw force to yield less damage when the bow is only briefly drawn, or the crossbow only briefly held steady.

func int GFA_GetInitialBaseDamage(int baseDamage, int damageType, C_Item weapon, int talent, int aimingDistance)
baseDamage Weapon damage as found in the weapon instance script.
damageType Damage type of the weapon (only one is allowed).
weapon Ranged weapon in use.
talent Talent value depending on the ranged weapon.
aimingDistance Aiming distance to the nearest obstacle. Note: This is not necessarily the distance to a target NPC!
returns New base damage for this shot.