Combat
Subcategories
Functions
- attack_is_aimed
- block_combat
- combat_data
- disable_aimed_shots
- force_aimed_shots
- get_attack_type
- get_bodypart_hit_modifier
- get_combat_free_move
- get_critical_table
- get_critter_current_ap
- get_last_attacker
- get_last_target
- reset_critical_table
- set_bodypart_hit_modifier
- set_combat_free_move
- set_critical_table
- set_critter_burst_disable
- set_critter_current_ap
- set_spray_settings
attack_is_aimed
sfall.h
bool attack_is_aimed()
Returns 1 if the aimed attack mode is selected, 0 otherwise.
block_combat
void block_combat(bool value)
Deny the player to enter combat mode.
combat_data
mixed combat_data
- returns a pointer to the
C_ATTACK_*
data for the current combat attack process (see defined constants in define_extra.h) - can be used in conjunction with the
get_object_data
andset_object_data
functions example:sfall_func3("set_object_data", sfall_func0("combat_data"), C_ATTACK_UNUSED, 255);
disable_aimed_shots
void disable_aimed_shots(int pid)
Allows overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) stops a weapon from making aimed shots even if it normally coulld. Affects player and NPCs alike. The list of edited weapons is not saved over game loads, so you need to call the function once at each reload. Use a pid of 0 to represent unarmed.
force_aimed_shots
void force_aimed_shots(int pid)
Allows overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) Will allow a weapon to make aimed shots even if it normally couldn’t. Affects player and NPCs alike. Does not override the effects of the fast shot trait. The list of edited weapons is not saved over game loads, so you need to call the function once at each reload. Use a pid of 0 to represent unarmed.
get_attack_type
int get_attack_type
get_bodypart_hit_modifier
int get_bodypart_hit_modifier(int bodypart)
Gets the hit percentage modifiers for aiming at specific bodyparts. Valid bodypart id’s are from 0 to 8.
get_combat_free_move
sfall.h
int get_combat_free_move()
Returns available “bonus move” points of the current critter’s turn. For NPCs, this is always 0 unless changed by set_combat_free_move
get_critical_table
int get_critical_table(int crittertype, int bodypart, int level, int valuetype)
Gets current critical table. For details see critical hit tables. Requires OverrideCriticalTable
to be enabled in ddraw.ini
(already enabled by default).
get_critter_current_ap
int get_critter_current_ap(CritterPtr)
Should only be used during the target critters turn while in combat. Calling it outside of combat typically returns the critters max ap, but don’t rely on that behaviour. (Specifically, if the critter has never before entered combat, it will probably return the critters base ap ignoring any extra bonuses from perks etc.)
get_last_attacker
ObjectPtr get_last_attacker(ObjectPtr critter)
Will return the last critter to deliberately launch an attack against the argument critter. If a critter has not launched/received an attack, it will return 0. Outside of combat always returns 0.
get_last_target
ObjectPtr get_last_target(ObjectPtr critter)
Will return the last critter to be deliberately attacked. Outside of combat always returns 0.
reset_critical_table
void reset_critical_table(int crittertype, int bodypart, int level, int valuetype)
Resets the critical table to default (or to the contents of CriticalOverrides.ini
, if it exists). For details see ‘http://falloutmods.wikia.com/wiki/Critical_hit_tables’. Requires OverrideCriticalTable
to be set to 1 in ddraw.ini
. (Disabled by default, because it noticably increases loading times.)
set_bodypart_hit_modifier
void set_bodypart_hit_modifier(int bodypart, int value)
Alters the hit percentage modifiers for aiming at specific bodyparts. Valid bodypart id’s are from 0 to 8. Changes are not saved, and will reset to the defaults (or to the values specified in ddraw.ini if they exist) at each reload.
set_combat_free_move
sfall.h
void set_combat_free_move(int value)
Allows changing “bonus move” points (yellow lights on the interface bar) that can only be used for movement, not attacking
- Can be called from
HOOK_COMBATTURN
at the start of the turn (will not work ondude_obj
) - Can be called from
HOOK_STDPROCEDURE
withcombat_proc
event (will work on both NPCs anddude_obj
)
set_critical_table
void set_critical_table(int crittertype, int bodypart, int level, int valuetype, int value)
Used for modifying the critical table. For details see critical hit tables. Changes are not saved, and will reset to the defaults (or to the contents of CriticalOverrides.ini
, if it exists) at each game reload. Requires OverrideCriticalTable
to be enabled in ddraw.ini
(already enabled by default).
set_critter_burst_disable
void set_critter_burst_disable(int critter, int disable)
set_critter_current_ap
void set_critter_current_ap(CritterPtr, int ap)
Should only be used during the target critters turn while in combat.
set_spray_settings
sfall.h
void set_spray_settings(int centerMult, int centerDiv, int targetMult, int targetDiv)
Allows changing the multipliers and divisors for the bullet distribution of burst attacks dynamically. All settings are automatically reset to default values (ComputeSpray_* settings in ddraw.ini) after each attack action
- Should be called before the calculation of the bullet distribution (e.g. in
HOOK_TOHIT
orHOOK_AMMOCOST
) centerDiv/targetDiv
: the minimum value of divisor is 1centerMult/targetMult
: multiplier values are capped at divisor values- NOTE: refer to the description of ComputeSpray_* settings in ddraw.ini for details of the bullet distribution of burst attacks