I was trying to make the normal .44 revolver cost more AP for reloading, since I don't think reloading revolver with speedloader should be "faster" (i.e. cost less AP) than semi-auto pistol with magazine. The default setting of .44 revolvers makes Desert Eagle a less favorable choice in FO2 IMO.
The first thing comes to my mind is changing the effect of "weapon fast reload" perk to increase reload AP by 1, so that I can reassign the perk on normal .44 revolver. But I don't know how to change weapon perks, and there's no similar mod for reference for a dummy like me. Then I remembered Magnus's F2WR changes the AP cost of unarmed special attacks, might be worth checking out, I thought. After spending a few days reading documents, trying to understand the meaning of the code (I have almost zero programming experience), and lots of try & error (with some funny/stupid results), I managed to get what I want.
So here's the code, based on Magnus's F2WR script:
(Special thanks to Magnus and Timeslip.)
I know, the 'if' statement for checking .44 revolver pid is a mess, but at least it did the trick. I did some basic tests, but still not quite sure if it also works for NPCs though. It could be better organized and expanded to make more weapons have their own custom reload AP.
Is there any other way to implement the idea? Or making the code cleaner/simpler? Any suggestions are appreciated.
The first thing comes to my mind is changing the effect of "weapon fast reload" perk to increase reload AP by 1, so that I can reassign the perk on normal .44 revolver. But I don't know how to change weapon perks, and there's no similar mod for reference for a dummy like me. Then I remembered Magnus's F2WR changes the AP cost of unarmed special attacks, might be worth checking out, I thought. After spending a few days reading documents, trying to understand the meaning of the code (I have almost zero programming experience), and lots of try & error (with some funny/stupid results), I managed to get what I want.
So here's the code, based on Magnus's F2WR script:
(Special thanks to Magnus and Timeslip.)
Code:
// hs_calcapcost.ssl
procedure start;
#include "sfall.h"
#include "DEFINE.H"
procedure start begin
variable critter, type, aimed, i;
if not init_hook then begin
critter:=get_sfall_arg;
type:=get_sfall_arg;
aimed:=get_sfall_arg;
i:=-1;
if (type == ATKTYPE_PALMSTRIKE) or (type == ATKTYPE_PIERCINGSTRIKE) or (type == ATKTYPE_JAB) then begin
i:=4 - (has_trait(TRAIT_PERK, dude_obj, PERK_bonus_hth_attacks) > 0);
end
if (type == ATKTYPE_HIPKICK) or (type == ATKTYPE_HOOKKICK) or (type == ATKTYPE_PIERCINGKICK) then begin
i:=5 - (has_trait(TRAIT_PERK, dude_obj, PERK_bonus_hth_attacks) > 0);
end
if ((type == hit_left_weapon_reload) or (type == hit_right_weapon_reload)) and ((obj_pid(critter_inven_obj(critter, INVEN_TYPE_RIGHT_HAND)) == PID_44_MAGNUM_REVOLVER) or (obj_pid(critter_inven_obj(critter, INVEN_TYPE_LEFT_HAND)) == PID_44_MAGNUM_REVOLVER)) then begin
i:=3;
end
if i != -1 then begin
if aimed then i++;
set_sfall_return(i);
end
end
end
Is there any other way to implement the idea? Or making the code cleaner/simpler? Any suggestions are appreciated.
