Author Topic: bringing a custom spell into a saved game ?  (Read 909 times)

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« on: August 14, 2010, 04:08:46 am »


               (This thread is somewhat of a follow-up question to that in the earlier "I'm having trouble with dm_spawnitem" thread.)

How does one get a custom spell into a campaign without starting the campaign anew? Should the approach of adding blueprints and compiled script files (which seems to work for items) to the override folder work for scrolls?

Here's the situation: I created a level 7 wizard spell (basically a variation on Firebrand), including the two icons, the script, two modified .2da files (spells.2da and iprp_spells.2da) and added lines to a talk file (cep2_v1.tlk, which I saved as SunShards_cep2_v1.tlk). I packaged a .hak file with the two .tga icon files and two .2da files. I start the toolset and open the Shadows Over Heliopolis mod, enter the script into the script editor and compile it, then add my little hak file to the haks the mod uses, change the .tlk file to my modified tlk file, and use the item wizard to create a scroll that casts the spell. All of that seems to go well. (I even grabbed the .ncs and .uti files for the script and scroll, along with the exported script .erf, for future use). The only slightly odd thing is that, when creating the scroll item, my spell shows up in the cast spell list as Sun Shards, rather than as Sun Shards (13). In other words, it doesn't have the caster level after the spell name as most of the other spells do in that list.

When I start the mod fresh, there seems to be no problem. I can choose my spell as a new wizard spell when leveling up, I can dm_spawn the scroll and both cast from it and learn the spell from it, the scroll icon and spell icon are correct, the scroll/spell names are right and the description shows up fine. Woohoo!

But there is trouble getting the spell into a saved game. When I tried to use the same process as above on a saved game (the .sav file renamed as .mod and moved to the modules folder), the toolset does let me create the new scroll. But, when I save everything, rename the .mod file as .sav, put it back in its save folder, then try to load the game, it crashes. There's one little bar in the load progress indicator and then it locks. This may be an issue with the new .tlk file, though I'm not sure exactly why. I experimented a bit and just changing the .tlk file (not adding the hak and not creating the scroll item) results in a crash. I haven't tried changing anything else to see if there is some more general problem with loading saved games that have been edited as mods.

When I tried the other approach of putting the scroll blueprint .uti file and .ncs file in the override folder, I can load a saved game and spawn the scroll, but the name and description are generic. More importantly, I can try to learn the spell from the scroll, but it never shows up in the character's spellbook. And, I can't cast from the scroll either.

I also tried the trick that initially worked earlier in this thread of spawning the scroll in a fresh game, then both having the character learn the spell there and keep a copy of the scroll in her inventory, saving that character, then using the multiplayer approach to bring that character into a saved game. But, that doesn't work in this case. The scroll turns generic (and uncastable) in the loaded saved game and the character's spell book does not show the spell, even though the game reports that she already knows the spell if I try to learn it from the scroll.

Is there a way to do introduce a new spell into a saved game? I was hoping the modify-the-saved-game-as-a-mod-in-the-toolset approach would work, but I must be doing something wrong because it crashes consistently.

Also, maybe changing the .tlk file isn't what caused the saved game to crash, but I don't feel confident that I am doing that correctly. Is there a guide telling how to properly modify a .tlk file, like the CEP one I used? When I did it, I just used TlkEdit to add the  lines to the top of cep2_v1.tlk, which (as far as I can tell) is the file the mod is using. That was what I thought I was supposed to do, looking at the example in Hugie's spell creation guide. And, it seemed to work when I start a fresh campaign, but I am worried that that isn't always the right place to change a .tlk file.
               
               

               


                     Modifié par MrZork, 14 août 2010 - 03:12 .
                     
                  


            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« Reply #1 on: August 14, 2010, 04:14:15 am »


               (PS: Why is the editor for these posts so crummy, garbling the posts with extra paragraph marks that were not in the text I typed and not in anything I pasted?) :-(
               
               

               
            

Legacy_HipMaestro

  • Hero Member
  • *****
  • Posts: 2849
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« Reply #2 on: August 14, 2010, 05:09:10 am »


               

MrZork wrote...

 The only slightly odd thing is that, when creating the scroll item, my spell shows up in the cast spell list as Sun Shards, rather than as Sun Shards (13). In other words, it doesn't have the caster level after the spell name as most of the other spells do in that list.
 

My experience with the CEP is zero.  However, how is your new spell string listed in the tlk file... with or without the casting level appended?  I believe they extract the string directly form the tlk for in-game and for some scrolls there can be different caster levels for the same spell depending on how they are spawned.

edit: Pasting into forum posts is insane.  It adds extra line breaks and white space all over the place. Why? It's new and improved.  Can't you tell?':pinched:'
               
               

               


                     Modifié par HipMaestro, 14 août 2010 - 04:14 .
                     
                  


            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« Reply #3 on: August 14, 2010, 08:11:18 am »


               Thanks for that. I didn't realize that the Name entries in IPRP_SPELLS.2da referred (or could refer) to a different line than the Name entry in spells.2da. I added a couple lines to my custom talk file, updated  IPRP_SPELLS.2da and the .hak file, and now the item list shows the right caster level for the spell.



But, I still don't know how to get the spell into a campaign without restarting the module from scratch...
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« Reply #4 on: August 16, 2010, 05:05:10 am »


               Hmm, Good question. The Problem you are running into here is that the content you are changing is in the haks So placeing something into the override folder will not override it. Since the haks override the override folder.

The problem with changing the .mod file to a .sav file is that the saved game has more information in it then the module file. when you opened the saved game up in the toolset and resaved it. Some of that information may not have gotten saved. the Toolset does filter some files out that it will not save into the game file. This creats a problem with changing the hak list or adding a new talk file to the module.


I guess your best bet to get the new spell into the game already in progress is to modify the haks that the game is already useing. cep2_v1.tlk and the 2da in your CEP_top_vXX.hak. The blueprint for the spell should still be able to be placed in the override folder since there is nothing in the haks that will override it.

I would just suggest that you make backup's of the original hak's and cep talk just in case you run into trouble later. I dout you will though. Most of the stuff in the hak you are changing is Server loaded resources only. Meaning even if you log onto a server online the game will still be useing the 2da's from the server and not the ones out of your modified hak. This is not true for all 2da's but for the one you are modifing here you should not have a problem.

As a closeing note: This topic is off topic for this board. Techinical support is more about people who are having trouble getting the standaed system to run. The questions you are asking are more of a custom content nature. You will get better and faster answers if you post your questions on the CC board.

NwN 1 Custom Content and Community Expansion Pack

Or even the general board.



NwN 1 General Discussion Forum (No Spoilers Allowed)

               
               

               


                     Modifié par Lightfoot8, 16 août 2010 - 04:07 .
                     
                  


            

Legacy_Daybringer

  • Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« Reply #5 on: August 16, 2010, 08:51:32 am »


               Just tossing this out there, you can if your really in the need of this one spell just add all your files into your top most hak in the saved module (probably the CEP Top thing XD)... when the module loads the hak, all the files should be there and you should get by without issue (including the script for the spell and so on) meaning permanently buggering up your .hak file ~ however not having to restart the mod or play with odd save files or anything dreadful... as to learning the spell.. if it appears on the spell list when you level you just have to reach level 8.. no?


(scripts and everything really save for your .tlk edits)
               
               

               


                     Modifié par Daybringer, 16 août 2010 - 07:52 .
                     
                  


            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
bringing a custom spell into a saved game ?
« Reply #6 on: August 16, 2010, 09:55:43 pm »


               Thanks so much for the replies.

Lightfoot8: Good note about the distinction between the data stored in saved games and mods. I figured there was something like that happening because the saved game was about 25MB before twiddling it with the toolset and about 18MB after saving it from the toolset. My experience with other games is that the saved games have a lot of state data (things like current hit points, magic effects present, etc.) that are created during gameplay and by scripts that aren't in the mod, where everything is assumed to start fresh.

I may try the approach you suggested of modifying the hacks that are already part of the mod. Initially, I was worried that I would mess up the existing haks and have a hard time getting everything back to normal. But, going through this process (creating the little hak for my spell, modifying the 2das and talk file, etc.) has given me some confidence that I could do it without too much fuss.

Also, sorry about posting in the wrong forum.


Daybringer, modifying cep2_top_v1.hak (I think that's the one the mod uses) is a good option, similar to Lightfoot8's suggestion. My worry is that I will still have to get the actual item blueprint and code into the game, though I suppose that may be done by dropping the uti and ncs files into override.

BTW, I am a little confused by this: "as to learning the spell.. if it appears on the spell list when you
level you just have to reach level 8.. no?" I'm not sure what level 8 you refer to. It's a seventh level spell, so I would first get a chance to learn it (as a wizard) at level thirteen. But, Shadows Over Heliopolis is an epic level mod (post-HotU) anyway, so my character (who finished HotU as a Rogue 3 / Wizard 25) could learn it whenever she levels up as a wizard. Or if I can get the scroll blueprint to work in the override folder, I could spawn the scroll and learn it from that even before leveling up.


Another possibility that occurs to me is that this is something that might be done using Leto. It looks like it may well be able to add haks, erfs, utis, change tlk files, etc. in a saved game. For that sort of thing, it looks like Leto may provide some toolset functionality (with a different interface, of course), without all the cleaning out of the state data in the saved game that the toolset does. I will muck with that a bit.


In the end, I'm not 100% sure I am going to be able to do this. But, I have learned quite a bit in the process and that has been worth it, even if it wasn't exactly what I set out to do. Meanwhile, I restarted the mod, just as a backup plan in case I couldn't get things working with the saved game. I have had so much fun going through it again that I really won't be disappointed if I have to replay the whole thing.