-
-
Notifications
You must be signed in to change notification settings - Fork 4
Critical Hits
The feature Critical Hits (GFA_CRITICALHITS
) implements critical hits for ranged weapons. The customization allows to define which body parts are weak spots and what happens when a critical hit occurs (event like screen print, sound jingle, additional XP, ...).
List config functions GFA_GetCriticalHitDefinitions |
This function is called every time (any kind of) NPC is hit by a projectile (arrows and bolts) to determine, whether a critical hit occurred; but only if free aiming is enabled and GFA_TRUE_HITCHANCE == true
. For critical hits without free aiming (or scattering) see GFA_GetCriticalHitAutoAim below.
This function here defines the critical hit zone (weak spot) based on the NPC that it hit or the weapon used. A weak spot is defined by the name of a bone of the model and modified damage. This function is dynamic: It is called on every hit and the weak spot and damage can be calculated individually differently every time.
Note: This function is specific to free aiming. For critical hits without free aiming see GFA_GetCriticalHitAutoAim below.
Note: This function only defines the critical hits. It is called every time an NPC is hit, regardless of whether it is a critical hit. To start an event when a critical hit actually occurs, see GFA_StartCriticalHitEvent below.
Ideas: incorporate weapon-specific stats, head shot talent, dependency on target, ...
Examples are given inside the function, but commented out to serve as inspiration of what is possible.
By default, weak spots for all Gothic 1 and Gothic 2 monsters are defined as head shots.
func void GFA_GetCriticalHitDefinitions(C_Npc target, C_Item weapon, int talent, int damage, int damageType, ...)
target |
The NPC that is hit by the projectile. |
weapon |
The ranged weapon that the shooter used (might be empty if unequipped immediately!). |
talent |
The talent value of the shooter depending on the ranged weapon. |
damage |
Base damage (damage of the ranged weapon), not the final damage! This value is an integer float. |
damageType |
Damage type of the projectile. |
returnPtr |
Instance pointer to the weak spot definition. |
This function is called every time (any kind of) NPC is hit by a projectile (arrows and bolts) to determine, whether a critical hit occurred; but only if free aiming is disabled, not active (game settings) or GFA_TRUE_HITCHANCE == false
. For critical hits with free aiming see GFA_GetCriticalHitDefinitions above.
This function here allows to define a critical hit chance even for the standard auto aiming. Although not existing in the original Gothic 2, this is important here to balance the damage output between free aiming and auto aiming, as the player can switch between them anytime during a running game in the game menu.
Note: This is not necessary for Gothic 1, as it already has critical hits for auto aiming by default. Nevertheless, the original critical hit calculation of Gothic 1 is disabled and replaced by this function. This way, the critical hit chance can be manipulated if desired. The lines of code below for Gothic 1 are the same as default by Gothic.
Note: This function is only called if free aiming is disabled, not active (game settings) or GFA_TRUE_HITCHANCE == false
. For critical hits with free aiming see GFA_GetCriticalHitDefinitions above.
Ideas: scale critical hit chance with player skill and distance, ...
Examples are given inside the function (section of Gothic 2), but commented out to serve as inspiration of what is possible.
func int GFA_GetCriticalHitAutoAim(C_Npc target, C_Item weapon, int talent)
target |
The NPC that is hit by the projectile. |
weapon |
The ranged weapon that the shooter used (might be empty if unequipped immediately!). |
talent |
The talent value of the shooter depending on the ranged weapon. |
returns | Percentage (chance level or hit chance), where 0 is no critical hit ever and and 100 always causes a critical hit. Everything in between is dependent on a respective probability. To disable this feature, simply have the function always return 0. |
This function is called when a critical hit occurs and can be used to print something to the screen, play a sound jingle or, as done here by default, show a hit marker. Leave this function blank for no event.
This function is also called when free aiming is disabled, depending on the configuration in GFA_GetCriticalHitAutoAim, see above.
Idea: The critical hits could be counted here to give an XP reward after 25 head shots, print to screen, ...
Examples are given inside the function, but commented out to serve as inspiration of what is possible.
func void GFA_StartCriticalHitEvent(C_Npc target, C_Item weapon, int freeAimingIsEnabled)
target |
The NPC that is hit by the projectile. |
weapon |
The ranged weapon that the shooter used (might be empty if unequipped immediately!). |
freeAimingIsEnabled |
Indicator whether free aiming is currently active. |
Table of Contents
Features
Youtube Trailer
Demo Modifications
Installation & Requirements
Gothic 1
Gothic 2
Features & Configuration
Free Aiming
Ranged Combat
Spells
Re-usable Projectiles
Custom Collisions
Critical Hits
Hit Probability NEW
Creating a Mod File
Project Architecture
Debugging & Console Commands
Download
Free Aiming Patch
Settings for Players
Changelog
FAQ
Support this project
Acknowledgements
Contact & Discussion