Skip to content

Commit

Permalink
Edits to documents
Browse files Browse the repository at this point in the history
Minor code edits to PartyMemberNoEarlyLevelUp.
  • Loading branch information
NovaRain committed Jun 2, 2024
1 parent f7bf341 commit 1848710
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions artifacts/ddraw.ini
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ TownMapHotkeysFix=1
;Set to 1 to disable the Horrigan encounter
DisableHorrigan=0

;Set to 1 to disable the random element in party member levelling
;This will prevent party members from randomly leveling up "earlier" and instead level up in defined regular intervals
;Set to 1 to disable the random element in party member leveling
;This will prevent party members from randomly leveling up 'earlier' and instead level them up at defined regular intervals
PartyMemberNoEarlyLevelUp=0

;Change the initial starting location and world map viewport
Expand Down
10 changes: 5 additions & 5 deletions artifacts/scripting/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@
- name: set_fake_perk
detail: void set_fake_perk(string name, int level, int image, string desc)
opcode: 0x81bb
doc: Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in `skilldex.lst`. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
doc: Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric ID that corresponds to an entry in `skilldex.lst`. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
- name: set_fake_trait
detail: void set_fake_trait(string name, int active, int image, string desc)
opcode: 0x81bc
doc: Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in `skilldex.lst`. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
doc: Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric ID that corresponds to an entry in `skilldex.lst`. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.

- name: set_selectable_perk
detail: void set_selectable_perk(string name, int active, int image, string desc)
Expand Down Expand Up @@ -563,7 +563,7 @@
detail: int play_sfall_sound(string file, int mode)
opcode: 0x822b
doc: |
Used to play `mp3/wav/wma` files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don't wish to loop, `play_sfall_sound` returns 0. If you do loop, it returns an id which can be passed back to `stop_sfall_sound` when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. Does not require `AllowDShowSound` to be set to 1 in `ddraw.ini`.
Used to play `mp3/wav/wma` files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don't wish to loop, `play_sfall_sound` returns 0. If you do loop, it returns an ID which can be passed back to `stop_sfall_sound` when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. Does not require `AllowDShowSound` to be set to 1 in `ddraw.ini`.
Starting from sfall 4.2.8/3.8.28, you can pass a value in the `mode` argument for a reduced sound volume. To set the volume, You need to convert the number to hexadecimal and use the argument format `0xZZZZ000Y`, where `ZZZZ` is the volume reduction value in range from 0 to 32767 (the value 32767 is mute), and `Y` is the playback mode.
- name: stop_sfall_sound
Expand Down Expand Up @@ -1774,7 +1774,7 @@
- name: get_window_under_mouse
detail: int get_window_under_mouse()
opcode: 0x821f
doc: "Returns internal ID of a top-most window under mouse cursor."
doc: "Returns the internal ID of the top-most window under mouse cursor."
- name: create_win
detail: void create_win(string winName, int x, int y, int width, int height, int flags)
doc: "`flags` argument is optional. Works just like vanilla `CreateWin` function, but creates a window with `MoveOnTop` flag if the flags argument is not specified, and allows to set additional flags for the created window. `MoveOnTop` flag allows the created window to be placed on top of the game interface."
Expand All @@ -1789,7 +1789,7 @@
- `attrType`: `0` - checks and returns a value of 1 if the specified interface window is created by the game (same as without the argument)
`1` - X position, `2` - Y position (relative to the top-left corner of the game screen)
`3` - interface width size, `4` - interface height size
`5` - window ID (to compare with get_window_under_mouse)
`5` - window ID (to compare with the `get_window_under_mouse` function)
`-1` - returns an associative array of keys (left, top, right, bottom) and values that define the position of the window rectangle
(use standard syntax to access array values, e.g. `winRect.top`, `winRect.bottom`)
- returns -1 if the specified attribute cannot be obtained
Expand Down
7 changes: 4 additions & 3 deletions artifacts/scripting/sfall function notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The `set_pickpocket_max` and `set_hit_chance_max` affect all critters rather tha

The `set_skill_max` can't be used to increase the skill cap above 300. The `set_perk_level_mod` sets a modifier between +25 and -25 that is added/subtracted from the player's level for the purposes of deciding which perks can be chosen.

The `set_fake_trait` and `set_fake_perk` can be used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in **skilldex.lst**. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
The `set_fake_trait` and `set_fake_perk` can be used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric ID that corresponds to an entry in **skilldex.lst**. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.

The `has_fake_trait` and `has_fake_perk` return the number of levels the player has of the perks/traits with the given name or ID of extra perk.

Expand All @@ -70,10 +70,10 @@ The `get_proto_data` and `set_proto_data` are used to manipulate the in memory c

The `list_xxx` functions can be used to loop over all items on a map. `list_begin` takes an argument telling sfall what you want to list (defined in **sfall.h**). It returns a list pointer, which you iterate through with `list_next`. Finally, when you've finished with the list use `list_end` on it. Not calling `list_end` will result in a memory leak. Alternatively, use `list_as_array` to get the whole list at once as a temp array variable, which can be looped over using `len_array` and which you don't need to remember to free afterwards.

The `play_sfall_sound` and `stop_sfall_sound` are used to play **mp3/wav/wma** files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don't wish to loop, `play_sfall_sound` returns 0. If you do loop, it returns an id which can be passed back to `stop_sfall_sound` when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. These functions do not require **AllowDShowSound** to be set to 1 in **ddraw.ini**.
The `play_sfall_sound` and `stop_sfall_sound` are used to play **mp3/wav/wma** files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don't wish to loop, `play_sfall_sound` returns 0. If you do loop, it returns an ID which can be passed back to `stop_sfall_sound` when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. These functions do not require **AllowDShowSound** to be set to 1 in **ddraw.ini**.
Starting from sfall 4.2.8/3.8.28, you can pass a value in the **mode** argument for a reduced sound volume. To set the volume, You need to convert the number to hexadecimal and use the argument format `0xZZZZ000Y`, where `ZZZZ` is the volume reduction value in range from 0 to 32767 (the value 32767 is muted), and `Y` is the playback mode.

Arrays are created and manipulated with the `xxx_array` functions. An array must first be created with `create_array` or `temp_array`, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The ID returned by `create_array` or `temp_array` can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call `create_array` from one script, and then use the returned ID from another script.) They are also saved across savegames. Arrays created with `temp_array` will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad id or trying to access out of range elements will not crash the script. `create_array` is the only function that returns a permanent array, all other functions which return arrays (`string_split`, `list_as_array`, etc,) all return temp arrays. You can use `fix_array` to make a temp array permanent.\
Arrays are created and manipulated with the `xxx_array` functions. An array must first be created with `create_array` or `temp_array`, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The ID returned by `create_array` or `temp_array` can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call `create_array` from one script, and then use the returned ID from another script.) They are also saved across savegames. Arrays created with `temp_array` will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad ID or trying to access out of range elements will not crash the script. `create_array` is the only function that returns a permanent array, all other functions which return arrays (`string_split`, `list_as_array`, etc,) all return temp arrays. You can use `fix_array` to make a temp array permanent.\
__NOTE:__ refer to **arrays.md** for detailed description of the array behavior and function usage.

The `force_aimed_shots` and `disable_aimed_shots` allow 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.) `force_aimed_shots` will allow a weapon to make aimed shots even if it normally couldn't, and `disable_aimed_shots` stops a weapon from making aimed shots even if it normally could. Both of these functions affect player and NPCs alike. `force_aimed_shots` 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 functions once at each reload. Use a pid of 0 to represent unarmed.
Expand Down Expand Up @@ -978,6 +978,7 @@ sfall_funcX metarule functions
0 - checks and returns a value of 1 if the specified interface window is created by the game (same as without the argument)\
1 - X position, 2 - Y position (relative to the top-left corner of the game screen)\
3 - interface width size, 4 - interface height size\
5 - window ID (to compare with the `get_window_under_mouse` function)\
-1 - returns an associative array of keys (left, top, right, bottom) and values that define the position of the window rectangle (use standard syntax to access array values, e.g. `win.top`, `win.bottom`)
- Returns -1 if the specified attribute cannot be obtained

Expand Down
8 changes: 4 additions & 4 deletions sfall/Modules/PartyControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,11 @@ void PartyControl::OrderAttackPatch() {
}

static void PartyMemberNoEarlyLevelUpPatch() {
if (IniReader::GetConfigInt("Misc", "PartyMemberNoEarlyLevelUp", 0) != 0) {
dlogr("Applying PartyMemberNoEarlyLevelUp patch.", DL_INIT);
if (IniReader::GetConfigInt("Misc", "PartyMemberNoEarlyLevelUp", 0)) {
dlogr("Applying no early level-up patch for party members.", DL_INIT);
// if (numLevels % level_up_every) != 0, skip random "early level up" roll and continue to the next party member instead
SafeWrite8(0x495CFD, CodeType::Jump); // JMP
SafeWrite32(0x495CFE, 0x14F); // jumps to 0x495E51
__int64 data = 0x014FE9; // jmp 0x495E51
SafeWriteBytes(0x495CFD, (BYTE*)&data, 5);
}
}

Expand Down

0 comments on commit 1848710

Please sign in to comment.