Spellbook Injector V2
Here's most of the original description of this mod from r3m's posting, since I can't improve on it, updated for V2.
Mod Overview
The Spellbook Injector is a utility mod that loads custom spells into the game. These spells won't override any EAxian tuning, which ensures that creations from different modders will be compatible!
If you're a modder interested in making new spells for Spellcasters, then this is for you! The Spellbook Injector will take care of all the scripting required to inject a new spell, so you don't have to worry about maintaining a Python script. Instead you can focus on the tuning of you spell. For more details and documentation about developing your own spells, see r3m's original posting.
Features
Below is a list of what the Spellbook Injector (V2) actually does:
- injects spells developed by modders to the spellbook
- allows injected spells to be learned randomly through one of the following interactions:
- -- "Ask to Teach Spell"
- -- "Duel for Knowledge"
- -- "Practice Magic"
-
-makes custom magic tomes purchaseable in Caster's Alley's market stall-(This feature is currently disabled) - makes custom magic tomes findable through the "Search for Tomes" interaction
- unlocks custom spells for newly generated Sages
- allows injection of potential outcomes that result from the Curse of Scrambled Spells
- allows injection of interactions that are exclusive to spellcasters
Installation & Testing
If you had previously installed the original version of the Spellbook Injector, remove it before installing this version.
Spellbook_Injector_V2.zip is the main download meant for users. It contains 2 files, which must go (no deeper than one 1 folder) inside your "Mods" folder.
File | Description |
---|---|
r3m_spellbook_injector_V2.package | Required tuning for the Spellbook Injector |
r3m_spellbook_injector_V2.ts4script | Required script for the Spellbook Injector |
Readme.txt | Instructions for use |
Version 2 Notes
This fix is compatible with all spells that were written for V1 of the Spellbook Injector, as the changes I made to fix it were fairly minor. There is one bit of functionality that has been disabled for the time being: making custom magic tomes purchasable from Caster's Alley in the Magic Realm. Many users reported issues with being able to buy anything a the RoM market stalls while V1 of this mod was installed, so I disabled that for now.
TO ENSURE CONTINUE SUPPORT OF THIS MOD I have included the current Python source code within the .ts4script archive. If I vanish too, hopefully other modder can pick it back up and continue supporting it. This mod lets us do some cool things, and we should try to keep it around.
What exactly was 'fixed' in V2?
The error that V1 had been throwing originated in the spell loading code.
The main cause was the code that attempted to write directly to log files in the user's Mods folder. It ended up generating an invalid path on a Mac, so the code threw an error when it tried to log the spells that had been injected. I considered fixing the code that generated the log file paths to work correctly on a Mac, but in the end decided that it was better to use the Sims 4 built-in logging functionality. These logs aren't normally generated and viewable on a user's machine, but if you install Scumbumbo's Log Enabler, you can see all of them, including the Spellbook injector log.
So _tuning_loaded_callback in __init__.py changed from this:
@classmethod def _tuning_loaded_callback(cls) -> None: try: if Tuning.IS_WITCH_BUFF is None: msg = f'{cls}: no tuning for the witch interactions. Check both the package and ts4script were installed properly.' logger.error(msg) raise ValueError(msg) if cls.witch_interactions is not None: cls.inject_witch_interactions() else: logger.info(f'{cls}: no witch interactions.') except BaseException: msg = f'{cls}: exception ocurred while processing' logger.error(msg) with open(get_log_file(), get_log_mode()) as infile: infile.write(msg) infile.write(traceback.format_exc()) infile.write('\n\n')
To this:
@classmethod def _tuning_loaded_callback(cls) -> None: try: if Tuning.IS_WITCH_BUFF is None: msg = f'{cls}: no tuning for the witch interactions. Check both the package and ts4script were installed properly.' logger.error(msg) raise ValueError(msg) if cls.witch_interactions is not None: cls.inject_witch_interactions() else: logger.info(f'{cls}: no witch interactions.') except BaseException: msg = f'{cls}: exception occurred while processing' logger.error(msg)
The same change was made to spells.py in _tuning_loaded_callback:
@classmethod def _tuning_loaded_callback(cls) -> None: try: if cls.spells: for (spell, injection_data) in cls.spells.items(): cls.inject_spell(spell, injection_data) cls.sort_entries() logger.info(f'{cls}: loaded {len(cls.spells)} spells.') else: logger.info(f'{cls}: no spells loaded.') super()._tuning_loaded_callback() except BaseException: msg = f'{cls}: exception ocurred while processing' logger.error(msg) with open(get_log_file(), get_log_mode()) as infile: infile.write(msg) infile.write(traceback.format_exc()) infile.write('\n\n') return with open(get_log_file(), get_log_mode()) as infile: infile.write(f'{cls}: processed correctly.
New code:
@classmethod def _tuning_loaded_callback(cls) -> None: try: if cls.spells: for (spell, injection_data) in cls.spells.items(): cls.inject_spell(spell, injection_data) cls.sort_entries() logger.info(f'{cls}: loaded {len(cls.spells)} spells.') else: logger.info(f'{cls}: no spells loaded.') super()._tuning_loaded_callback() except BaseException: msg = f'{cls}: exception occurred while processing' logger.error(msg) return logger.info(f'{cls}: processed correctly.')
Finally, in the inject_spell function in spells.py, I commented out the call to inject the custom tomes into the market stalls in Caster's Alley until I get time to look into why it causes problems.
# if injection_data.learning.magic_tome.can_be_bought: # SpellbookInjector.inject_to_purchase_tomes(injection_data.learning.magic_tome.definition)
Spellbook_Injector_V2.zip
Download
Uploaded: 3rd Sep 2021, 23.5 KB.
85,822 downloads.
|
||||||||
For a detailed look at individual files, see the Information tab. |
Install Instructions
1. Download: Click the File tab to see the download link. Click the link to save the .rar or .zip file(s) to your computer.
Read the upload description for installation instructions. If nothing else is specified, do the following:
2. Extract: Use WinRAR (Windows) to extract the .package file(s) (if included, ts4script as well) from the .rar or .zip file(s).
3. Cut and paste the .package file(s) (if included, ts4script as well) into your Mods folder
- Windows XP: Documents and Settings\(Current User Account)\My Documents\Electronic Arts\The Sims 4\Mods\
- Windows Vista/7/8/8.1: Users\(Current User Account)\Documents\Electronic Arts\The Sims 4\Mods\
Need more information?
- Anyone can use both .rar and .zip files easily! On Windows, use WinRAR.
- If you don't have a Mods folder, just make one.
- Mod still not working? Make sure you have script mods enabled
Loading comments, please wait...
Updated: 31st Oct 2021 at 9:28 PM
-
by DrAnimaniac 2nd Jul 2019 at 7:25pm , updated 26th Feb 2021 at 5:35pm
154 87.4k 298 -
by siriussimmer 19th Aug 2021 at 6:51pm , updated 30th Aug 2021 at 1:10am
+1 packsCottage Living -
by Simsonian Library 31st Oct 2021 at 7:31pm , updated 12th Dec 2021 at 7:24pm
+7 packsOutdoor RetreatCats and DogsSeasonsCottage LivingHorse RanchJungle AdventureRealm of Magic -
by Meep62 23rd Dec 2021 at 1:41pm , updated 22nd Aug 2022 at 4:10am
47 121.1k 150 -
by Tralfaz482 30th Jan 2023 at 10:28am , updated 29th Oct 2024 at 10:59pm
+1 packsGet to Work -
by Tralfaz482 30th Jan 2023 at 10:32am , updated 11th Aug 2024 at 2:35am
+1 packsGet to Work -
by SimmingWithP&J 21st Jun 2023 at 2:24pm , updated 30th Jun 2023 at 3:27am
12 14.1k 20 -
by peco 5th Aug 2023 at 10:01pm , updated 12th Jun 2024 at 4:42pm
42 38.9k 118 -
by TURBODRIVER 16th Oct 2024 at 11:27am , updated 23rd Nov 2024 at 11:43am
5 6.7k 13
-
by Simsonian Library 21st Mar 2022 at 2:33pm , updated 27th Jul 2022 at 10:22pm
The Magazine Kit adds functional magazines to the Sims 4. more...
-
by Simsonian Library 2nd Apr 2022 at 10:25pm , updated 3rd Jan 2023 at 3:30pm
The Simsco Canning Factory can be loaded with produce and dairy ingredients, then used to convert them into boxes of more...
+2 packsCity LivingCottage Living -
by Simsonian Library 5th Sep 2021 at 11:35pm
The last thing you want to worry about when you’re scaling Mt Komorebi or charting the unknown depths of the more...
+1 packsEco Lifestyle -
by Simsonian Library 29th Dec 2021 at 4:24pm
Pirate Treasure is my take on treasure maps and buried treasure chests. more...
+1 packsIsland Living -
by Simsonian Library 19th Aug 2021 at 4:44am
No matter where you are, or what you do, you need to eat. more...
+1 packsDiscover University -
Food & Beverage Supplier License
by Simsonian Library 6th Apr 2022 at 3:49pm , updated 27th Jul 2022 at 10:26pm
The Food & Beverage Supplier License is available in the Aspiration Rewards Store for 500 satisfaction points. more...
25 22.9k 60 -
by Simsonian Library 31st Oct 2021 at 5:35pm , updated 2nd Nov 2021 at 2:13am
Are you a wizard with too many chores around the house to have enough time for wizarding? Try the new more...
+2 packsDiscover UniversityRealm of Magic -
by Simsonian Library 18th Apr 2022 at 5:49am
This download includes versions of 14 kitchen cabinets found in the base game and various packs modified to each have more...
+1 packsVampires -
by Simsonian Library 31st Oct 2021 at 7:31pm , updated 12th Dec 2021 at 7:24pm
The Classic RPG Spells collection contains a selection of Sims 4 spells inspired by old school role playing games, with more...
+7 packsOutdoor RetreatCats and DogsSeasonsCottage LivingHorse RanchJungle AdventureRealm of Magic -
by Simsonian Library 12th Jun 2021 at 1:38am , updated 1st Sep 2022 at 3:34am
The Archaeology Kit mod expands the Sims 4 archaeology features from Jungle Adventure to work in every region (even Batuu). more...
+17 packsGet to WorkGet TogetherCity LivingCats and DogsSeasonsGet FamousIsland LivingDiscover UniversityDine OutEco LifestyleSnowy EscapeVampiresBowling Night StuffJungle AdventureRealm of MagicNifty Knitting StuffParanormal Stuff
Packs Needed
Base Game | |
---|---|
Sims 4 |
Game Pack | |
---|---|
Realm of Magic |