Added "combat_data" script function

Added a new argument to HOOK_COMBATDAMAGE.
Removed the check for valid objects from get/set_object_data functions.
Some code fixes.
This commit is contained in:
NovaRain
2020-10-08 13:49:58 +08:00
parent 2f750a8a4b
commit c71ca95665
10 changed files with 35 additions and 30 deletions
+1
View File
@@ -294,6 +294,7 @@
#define art_cache_clear sfall_func0("art_cache_clear")
#define attack_is_aimed sfall_func0("attack_is_aimed")
#define car_gas_amount sfall_func0("car_gas_amount")
#define combat_data sfall_func0("combat_data")
#define create_win(winName, x, y, w, h) sfall_func5("create_win", winName, x, y, w, h)
#define create_win_flag(winName, x, y, w, h, flag) sfall_func6("create_win", winName, x, y, w, h, flag)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
+2 -1
View File
@@ -174,6 +174,7 @@ int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.
int arg10 - Number of bullets actually hit the target (1 for melee attacks)
int arg11 - The amount of knockback to the target
int arg12 - Attack Type (see ATKTYPE_* constants)
mixed arg13 - computed attack data (see C_ATTACK_* for offsets and use get/set_object_data functions to get/set the data)
int ret1 - The damage to the target
int ret2 - The damage to the attacker
@@ -619,7 +620,7 @@ int arg8 - bonus ranged damage from the perk
int arg9 - damage multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2; for critical hits, the value is taken from the critical table; with Silent Death perk and the corresponding attack conditions, the value will be doubled)
int arg10 - combat difficulty multiplier (125 - rough, 100 - normal, 75 - wimpy; for player or party members it's always 100)
int arg11 - the calculated amount of damage (usually 0, required when using multiple hook scripts to calculate damage and using the set_sfall_arg function)
mixed arg12 - computed attack results (see C_ATTACK_* for offsets and use get/set_object_data functions to get/set the data)
mixed arg12 - computed attack data (see C_ATTACK_* for offsets and use get/set_object_data functions to get/set the data)
int ret1 - the returned amount of damage
+9 -4
View File
@@ -468,13 +468,13 @@ Some utility/math functions are available:
- NOTE: all keys and their values will be of String type
> int sfall_func0("car_gas_amount")
- returns current amount of fuel in player's car (between 0 and 80000)
- returns the current amount of fuel in player's car (between 0 and 80000)
- to change fuel amount, use vanilla function: metarule(METARULE_GIVE_CAR_GAS, amount) - amount can be positive or negative
> void sfall_func1("set_car_intface_art", int artIndex)
- changes the interface art (index in LST file) for the car image on worldmap screen
- should be called before going to worldmap
- vanilla art index is 0x1B1
- changes the interface art (index in intrface.lst) for the car image on the world map interface
- should be called before going to the world map
- vanilla art index is 433
> int sfall_func0("get_cursor_mode")
- returns the current cursor mode (0 - movement cursor, 1 - command cursor, 2 - targeting cursor)
@@ -769,6 +769,11 @@ optional arguments:
0x2000000 - fills the background of the text with black color, the 'textnofill' compiler constant (works the other way around)
- width (optional): the maximum width of the text. The text will be wrapped to fit within the specified width
> mixed sfall_func0("combat_data")
- returns a pointer to the C_ATTACK_* data for the current combat attack turn (see defined constants in define_extra.h)
- can be used in conjunction with the get_object_data and set_object_data functions
example: sfall_func3("set_object_data", sfall_func0("combat_data"), C_ATTACK_UNUSED, 255);
------------------------
------ MORE INFO -------
------------------------