Fixed Auto Doors example script mod

Cosmetic changes to the text descriptions in Perks.ini.
This commit is contained in:
NovaRain
2020-06-13 00:20:48 +08:00
parent 6c31cc43a0
commit cc9807344a
4 changed files with 48 additions and 55 deletions
+25 -32
View File
@@ -1,10 +1,9 @@
;This file handles modifications to perks and traits ;This file handles modifications to perks and traits
;When adding extra perks to a mod, it's advisable to use
; the fake perk scripting functions rather than make modifications ;When adding extra perks to a mod, it's advisable to use the fake perk scripting functions rather than make modifications
; in this file, as some perks have hardcoded effects which may ; in this file, as some perks have hardcoded effects which may catch you out
; catch you out
;Since traits need to be picked before any scripts run, they ;Since traits need to be picked before any scripts run, they have an additional NoHardcode option in this file which can
; have an additional NoHardcode option in this file which can
; be used to remove their hardcoded effects, and add new stat/skill effects ; be used to remove their hardcoded effects, and add new stat/skill effects
[PerksTweak] [PerksTweak]
@@ -31,31 +30,25 @@ WeaponHandlingBonus=3
;Set to 1 to enable the modifications for perks ;Set to 1 to enable the modifications for perks
Enable=0 Enable=0
;Name=The name of the perk (max 63 characters) ;Name: The name of the perk (max 63 characters)
;Desc=The description of the perk (max 255 characters) ;Desc: The description of the perk (max 255 characters)
;Image=The line number (0-indexed) of the corresponding FRM in skilldex.lst ;Image: The line number (0-indexed) of the corresponding FRM in skilldex.lst
;Ranks=The number of perk levels ;Ranks: The number of perk levels
;Level=The minimum required level ;Level: The minimum required level
;Type=If 0, the perk checks only Skill1 for skill requirements; if 1, it checks ;Type: If 0, the perk checks only Skill1 for skill requirements; if 1, it checks Skill1 or Skill2; if 2, it checks both Skill1 and Skill2
; Skill1 or Skill2; if 2, it checks both Skill1 and Skill2 ;Stat: The modified stat or -1 if you don't want to change any stats
;Stat=The modified stat or -1 if you don't want to change any stats ;StatMag: The increased/decreased value to the modified stat
;StatMag=The increased/decreased value to the modified stat
;Skill1=The first skill (or -1 for none) to check, but if you set a specific bit ;Skill1/Skill2: The first/second skill (or -1 for none) to check, but if you set a specific bit 0x4000000 (67108864), it checks GVAR.
; (67108864 or 0x4000000), it checks GVAR. For example, if Skill1=67108864, then ; For example, if Skill1=0x4000004, then the perk will check GVAR_BAD_MONSTER (0x4000000 + 4) on Skill1Mag value
; the perk will check GVAR_PLAYER_REPUTATION (67108864 + 0) on Skill1Mag value
;Skill1Mag=Positive value is used as the minimum requirements of the first ;Skill1Mag/Skill2Mag: Positive value is used as the minimum requirements of the first/second skill/GVAR, and a negative value is interpreted as the maximum requirement.
; skill/GVAR, and a negative value is interpreted as the maximum requirement. ; For example, with Skill1=0 and Skill1Mag=100, if player has small guns skill >= 100 and meets all other requirements, the perk will be available in the
; For example, with Skill1=0 and Skill1Mag=100, if player has small guns skill ; selection window; with Skill1=1 and Skill1Mag=-120, the perk will not be available if player has big guns skill >= 120
; >= 100 and meets all other requirements, the perk will be available in the
; selection window; with Skill1=1 and Skill1Mag=-120, the perk will not be ;STR-LCK: Positive values are used as minimum requirements of SPECIAL stats, and negative values are interpreted as maximum requirements.
; available if player has big guns skill >= 120 ; For some special perks processed by the engine (e.g. PERK_armor_powered and PERK_armor_combat), the values are not used as requirements
;Skill2=The second skill/GVAR (or -1 for none) to check ; but to add to corresponding SPECIAL stats
;Skill2Mag=Same as Skill1Mag, but for Skill2
;STR-LCK=Positive values are used as minimum requirements of SPECIAL stats, and
; negative values are interpreted as maximum requirements. For some special
; perks processed by the engine (e.g. PERK_armor_powered and PERK_armor_combat),
; the values are not used as requirements but to add to corresponding SPECIAL
; stats
;If the value is set to -99999, the variable will be ignored (similar to comment out that line) ;If the value is set to -99999, the variable will be ignored (similar to comment out that line)
@@ -63,7 +56,7 @@ Enable=0
;This is a modification to perk 119 ;This is a modification to perk 119
[119] [119]
Name=Example Name=Example
Desc=This is an example perk~Second line Desc=This is an example perk description
Image=72 Image=72
Ranks=1 Ranks=1
Level=1 Level=1
Binary file not shown.
@@ -1,14 +1,13 @@
/* /*
Auto Doors mod v1.1 for Fallout 2 by Mr.Stalin Auto Doors mod v1.2 for Fallout 2 by Mr.Stalin
---------------------------------------------- ----------------------------------------------
- allows the player to automatically open/walk through unlocked doors when not in combat - allows the player to automatically open/walk through unlocked doors when not in combat
Requires sfall 3.7b or higher Requires sfall 3.7b or higher
NOTE: this script requires compiler from sfall modderspack with -s option NOTE: this script requires compiler from sfall modderspack with -s option (short circuit evaluation)
(short circuit evaluation)
*/ */
@@ -30,8 +29,8 @@ procedure combatturn_handler;
#define PORTAL (0) #define PORTAL (0)
#define DOOR_FLAGS (0x24) #define DOOR_FLAGS (0x24)
variable only_once := 0; variable onlyOnce := 0;
variable arrayPid; variable pidDoors;
procedure start begin procedure start begin
if game_loaded then begin if game_loaded then begin
@@ -41,11 +40,11 @@ procedure start begin
set_global_script_repeat(40); // for sfall 3.x set_global_script_repeat(40); // for sfall 3.x
call map_enter_p_proc; call map_enter_p_proc;
end else begin end else begin
if (only_once == 1 and combat_is_initialized) then begin if (onlyOnce == 1 and combat_is_initialized) then begin
only_once := 2; onlyOnce := 2;
call set_door_flag(0); // reset flag when entering combat mode call set_door_flag(0); // reset flag when entering combat mode
end else if (only_once == 2 and not(combat_is_initialized)) then begin end else if (onlyOnce == 2 and not(combat_is_initialized)) then begin
only_once := 1; onlyOnce := 1;
if (sfall_ver_major >= 4) then set_global_script_repeat(0); if (sfall_ver_major >= 4) then set_global_script_repeat(0);
call set_door_flag(FLAG_WALKTHRU); // set flag after combat mode ends call set_door_flag(FLAG_WALKTHRU); // set flag after combat mode ends
end end
@@ -53,34 +52,35 @@ procedure start begin
end end
procedure map_enter_p_proc begin procedure map_enter_p_proc begin
if (arrayPid) then begin if (pidDoors) then begin
// when changing maps, delete the current array to create a new one // when changing the map, delete the current array to create a new one
free_array(arrayPid); free_array(pidDoors);
arrayPid := 0; pidDoors := 0;
end end
only_once := 1; onlyOnce := 1;
call set_door_flag(FLAG_WALKTHRU); // set flag when entering the map call set_door_flag(FLAG_WALKTHRU); // set flag when entering the map
end end
procedure set_door_flag(variable state) begin procedure set_door_flag(variable state) begin
variable objectMap, obj, objPid, i; variable objectMap, obj, objPid, i;
if (arrayPid) then begin if (pidDoors) then begin
call set_door_flag_array(state); call set_door_flag_array(state);
return; return;
end end
objectMap := list_as_array(LIST_SCENERY); objectMap := list_as_array(LIST_SCENERY);
arrayPid := create_array(0, 0); pidDoors := create_array(0, 0);
foreach (obj in objectMap) begin foreach (obj in objectMap) begin
objPid := obj_pid(obj); objPid := obj_pid(obj);
if (proto_data(objPid, sc_type) != PORTAL) or is_in_array(objPid, arrayPid) then if (proto_data(objPid, sc_type) != PORTAL or get_proto_data(objPid, DOOR_FLAGS) or is_in_array(objPid, pidDoors)) then begin
continue; // next object continue; // next object
end
resize_array(arrayPid, i + 1); resize_array(pidDoors, i + 1);
arrayPid[i] := objPid; pidDoors[i] := objPid; // add pid to array
i++; i++;
set_proto_data(objPid, DOOR_FLAGS, state); set_proto_data(objPid, DOOR_FLAGS, state);
end end
@@ -88,14 +88,14 @@ end
procedure set_door_flag_array(variable state) begin procedure set_door_flag_array(variable state) begin
variable objPid; variable objPid;
foreach (objPid in arrayPid) begin foreach (objPid in pidDoors) begin
set_proto_data(objPid, DOOR_FLAGS, state); set_proto_data(objPid, DOOR_FLAGS, state);
end end
end end
procedure combatturn_handler begin procedure combatturn_handler begin
if (only_once == 1) then begin if (onlyOnce == 1) then begin
only_once := 2; onlyOnce := 2;
call set_door_flag_array(0); call set_door_flag_array(0);
set_global_script_repeat(60); set_global_script_repeat(60);
end end
+1 -1
View File
@@ -18,7 +18,7 @@ The read_xxx functions take a memory address as the parameter and can read arbit
The get/set_pc_base/extra_stat functions are equivalent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat. The get/set_pc_base/extra_stat functions are equivalent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat.
The set_stat_max/min functions can be used to set the valid ranges on on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only effect the player, the set_npc_ functions only effect other critters, and the set_ functions effect both. The set_stat_max/min functions can be used to set the valid ranges on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only effect the player, the set_npc_ functions only effect other critters, and the set_ functions effect both.
The input functions are only available if the user has the input hook turned on in ddraw.ini. Use input_funcs_available to check. The input functions are only available if the user has the input hook turned on in ddraw.ini. Use input_funcs_available to check.