OSP Code SP [WB] BookZ OSP

正在查看此主题的用户

Lav

Sergeant Knight at Arms
Moar BookZ

A medium-complexity scripting OSP pack to provide you tons of randomized books in the game.

Download and Gallery Link
mb0.jpg

Includes the ability to name a real existing NPC as a book author (yep, player too).

Seven different book types (of which only 6 currently make sense as the seventh is intended for scripting).

Archive available via the link above contains the modified Native Module System files. You can copy them over Native Module System and compile. Note that you will also need to move Data/item_modifiers.txt file to your module folder. If you want to adapt this to your own mod - all changes in the files are marked with comments:
插入代码块:
# BOOKZ MODIFICATIONS START
# BOOKZ MODIFICATIONS END

Initialization of the OSP.

You need to run the following code anywhere once:

插入代码块:
  (call_script, "script_bookz_initialize", 4, imod_boring, imod_dull, imod_interesting, imod_rare),
  (call_script, "script_bookz_add_author_range", "str_bookz_author_00", 60),

The first line will initialize the BookZ pack and mark 4 imod-fields for it's use.

The second line is used to randomly generate author names from the list. There are 60 possible author names, but you can add more by calling scripts "bookz_add_author" and "bookz_add_author_range". There is no need for all author names to be a single chunk of strings, but each separate chunk must be added individually.

Then you need to call script "bookz_setup_book" for each book item/imod combination you wish to have. Note that most parameters of this script can be randomized to make your gameplay more unpredictable. Example:

插入代码块:
  (call_script, "script_bookz_setup_book", "itm_book_bookz_01", imod_dull, bookz_modify_skill, "str_dummy_title", BOOKZ_RANDOMIZE_ALL),

This will add a new book with a dummy title. Once player will finish reading this book, it will serve as a handy reference for him, increasing a random skill (determined during call to setup script) for as long as the book is in player's inventory.

Naturally, you will need to provide your own book titles, as they depend a lot on book class.

There are seven book classes available:

bookz_increase_skill - when read, book will increase player's skill
bookz_modify_skill - when read, book will serve as bonus to skill
bookz_increase_weapon - when read, book will increase weapon proficiency
bookz_increase_xp - when read, book will provide player with some xp
bookz_increase_faction_rel - when read, book will provide a one-time bonus to relations with all lords and ladies of a single kingdom
bookz_increase_family_rel - when read, book will provide a one-time bonus to relations with all lords and ladies of a single major family.
bookz_unlock_location - this was intended to use in combination with some scripting as a quest starter. If you don't need this, don't initialize any books of this class.

Code replaces the book selection dialog with a dialog, where player is contemplating what book does he wish to read. :smile:

Code is fully compatible with Native books and bookreading. However it introduces a trigger to refresh bookseller's inventories just like all other merchants, and Native books are currently not generated.

Adding the code to a mod should be fully savegame compatible, just make sure to initialize it, and your booksellers should immediately enjoy some new gold and inventory.

Code contains support for creating books dynamically during the game, naming real NPCs or even player as book authors. However it currently lacks a planned script which would take hero's stats into account and generate the actual book, which would then become available for sale throughout Calradia. In fact, this is why support for imod-values have been added at all, to indicate the quality of resulting work. Without this feature, there's no real need to use imod-values, as they provide nothing but some name variability, which can be just as easily achieved by cloning item records.

Enjoy!

P. S.

Examples

1. Initializing the mod without using imod-values.

插入代码块:
  (call_script, "script_bookz_initialize", 0),

2. Creating a specific skill-increasing book variant.

A book will increase Riding by +2, however it will be very difficult and long to read.

插入代码块:
  (call_script, "script_bookz_setup_book", "itm_book_bookz_03", imod_plain, bookz_increase_skill, "str_book_title", "str_book_author", "skl_riding", 2, 20, 26, 192000),

Parameters are: book item, book imod-variant, book class, book title, book author, affected entity (for skill books it's the skill reference), affect strength (for skill books, it's the skill bonus), required INT (what INT player must have to be able read the book at all), optimal INT (what INT player must have to read at full speed), reading time (in hours, multiplied by 1000, so 192000 == 192 hours = 8 days).

3. Same as above, but with randomized author and reading prereqisites and time.

插入代码块:
  (call_script, "script_bookz_setup_book", "itm_book_bookz_03", imod_plain, bookz_increase_skill, "str_book_title", BOOKZ_RANDOM, "skl_riding", 2, BOOKZ_RANDOMIZE_ALL),
 
后退
顶部 底部