Edits to hookscripts.txt

Added weapon argument to HOOK_CALCAPCOST.
This commit is contained in:
NovaRain
2021-02-24 11:59:04 +08:00
parent 797de4bc0e
commit 5b3a83df91
+29 -28
View File
@@ -26,7 +26,7 @@ end
There are script functions available, specific to hook scripts:
> int init_hook()
The hook script equivalent of game_loaded; it returns 2 when the script is first loaded, 1 when the player reloads and 0 otherwise.
The hook script equivalent of game_loaded; it returns 1 when the script is loaded for the first time or when the player reloads the game, and 0 otherwise.
> mixed get_sfall_arg()
Gets the next argument from sfall. Each time it's called it returns the next argument, or otherwise it returns 0 if there are no more arguments left.
@@ -81,8 +81,8 @@ Runs when Fallout is calculating the chances of an attack striking a target
Runs after the hit chance is fully calculated normally, including applying the 95% cap
int arg0 - The hit chance (capped)
critter arg1 - The attacker
critter arg2 - The target of the attack
Critter arg1 - The attacker
Critter arg2 - The target of the attack
int arg3 - The targeted bodypart
int arg4 - Source tile (may differ from attacker's tile, when AI is considering potential fire position)
int arg5 - Attack Type (one of ATKTYPE_*)
@@ -98,14 +98,14 @@ HOOK_AFTERHITROLL (hs_afterhitroll.int)
Runs after Fallout has decided if an attack will hit or miss
int arg0 - If the attack will hit. (0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit)
critter arg1 - The attacker
critter arg2 - The target of the attack
Critter arg1 - The attacker
Critter arg2 - The target of the attack
int arg3 - The bodypart
int arg4 - The hit chance
int ret0 - Override the hit/miss
int ret1 - Override the targeted bodypart
critter ret2 - Override the target of the attack
Critter ret2 - Override the target of the attack
-------------------------------------------
@@ -115,10 +115,11 @@ Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player's hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.
You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj().
critter arg0 - The critter performing the action
Critter arg0 - The critter performing the action
int arg1 - Attack Type (see ATKTYPE_* constants)
int arg2 - Is aimed attack (1 or 0)
int arg3 - The normal AP cost
Item arg4 - The weapon
int ret0 - The new AP cost
@@ -130,8 +131,8 @@ Runs before Fallout tries to calculate the death animation. Lets you switch out
Does not run for critters in the knockdown/out state.
int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
critter arg1 - The attacker
critter arg2 - The target
Critter arg1 - The attacker
Critter arg2 - The target
int arg3 - The amount of damage
int arg4 - Unused, always -1. Use this if you are using the same procedure for HOOK_DEATHANIM1 and HOOK_DEATHANIM2 (since sfall 4.1/3.8.24)
@@ -145,9 +146,9 @@ Runs after Fallout has calculated the death animation. Lets you set your own cus
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with obj_art_fid == 0x20001F5.
Does not run for critters in the knockdown/out state.
item arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
critter arg1 - The attacker
critter arg2 - The target
Item arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
Critter arg1 - The attacker
Critter arg2 - The target
int arg3 - The amount of damage
int arg4 - The death anim id calculated by Fallout
@@ -162,8 +163,8 @@ Runs when:
2) AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.
Does not run for misses, or non-combat damage like dynamite explosions.
critter arg0 - The target
critter arg1 - The attacker
Critter arg0 - The target
Critter arg1 - The attacker
int arg2 - The amount of damage to the target
int arg3 - The amount of damage to the attacker
int arg4 - The special effect flags for the target (use bwand DAM_* to check specific flags)
@@ -206,16 +207,16 @@ NOTE: The engine can choose targets by the following criteria:
3) The enemy that attacked an NPC from the same team as the attacker.
4) The enemy that is attacked by an NPC from the same team as the attacker.
critter arg0 - The attacker
critter arg1 - A possible target
critter arg2 - A possible target
critter arg3 - A possible target
critter arg4 - A possible target
Critter arg0 - The attacker
Critter arg1 - A possible target
Critter arg2 - A possible target
Critter arg3 - A possible target
Critter arg4 - A possible target
critter ret0 - The first choice of target
critter ret1 - The second choice of target
critter ret2 - The third choice of target
critter ret3 - The fourth choice of target
Critter ret0 - The first choice of target
Critter ret1 - The second choice of target
Critter ret2 - The third choice of target
Critter ret3 - The fourth choice of target
-------------------------------------------
@@ -247,7 +248,7 @@ This is fired before the object is used, and the relevant use_obj script procedu
NOTE: you can't remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
Critter arg0 - The user
int arg1 - The object used
Obj arg1 - The object used
int ret0 - overrides hard-coded handler and selects what should happen with the item (0 - place it back, 1 - remove it, -1 - use engine handler)
@@ -258,7 +259,7 @@ HOOK_REMOVEINVENOBJ (hs_removeinvenobj.int)
Runs when an object is removed from a container or critter's inventory for any reason
Obj arg0 - the owner that the object is being removed from
item arg1 - the item that is being removed
Item arg1 - the item that is being removed
int arg2 - the number of items to remove
int arg3 - The reason the object is being removed (see RMOBJ_* constants)
Obj arg4 - The destination object when the item is moved to another object, 0 otherwise
@@ -456,7 +457,7 @@ NOTE: when replacing a previously wielded armor or weapon, the unwielding hook w
If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
Critter arg0 - critter
Obj arg1 - item being wielded or unwielded (weapon/armor)
Item arg1 - item being wielded or unwielded (weapon/armor)
int arg2 - slot (INVEN_TYPE_*)
int arg3 - 1 when wielding, 0 when unwielding
int arg4 - 1 when removing an equipped item from inventory, 0 otherwise
@@ -484,7 +485,7 @@ HOOK_COMBATTURN (hs_combatturn.int)
Runs before and after each turn in combat (for both PC and NPC).
int arg0 - event type: 1 - start of turn, 0 - normal end of turn, -1 - combat ends abruptly (by script or by pressing Enter during PC turn), -2 - combat ends normally (hook always runs at the end of combat)
int arg1 - critter doing the turn
Critter arg1 - critter doing the turn
bool arg2 - 1 at the start/end of the player's turn after loading a game saved in combat mode, 0 otherwise
int ret0 - pass 1 at the start of turn to skip the turn, pass -1 at the end of turn to force end of combat
@@ -614,7 +615,7 @@ Does not run for misses, non-combat damage like dynamite explosions, or if one o
Critter arg0 - the attacker
Critter arg1 - the target
Obj arg2 - the weapon used in the attack
Item arg2 - the weapon used in the attack
int arg3 - attack type (see ATKTYPE_* constants)
int arg4 - number of bullets actually hit the target (1 for melee attacks)
int arg5 - target's Damage Resistance (DR) value (affected by critical hit effects, perks, traits, and special unarmed attacks)