Author Topic: I'm having trouble with dm_spawnitem  (Read 1556 times)

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
I'm having trouble with dm_spawnitem
« on: August 08, 2010, 09:18:06 pm »


               This will seem very basic, and I hope that it is, but let me preface by saying I have used dm_spawnitem many times without trouble. Also, I'm running NWN Diamond, patched to 1.69, with CEP 2.3.

So, I am playing John McA's Shadows over Heliopolis and I want to spawn a custom item (a variant on a sword one of the merchants sells). I opened the module in the toolset and opened a similar item, right-clicked and chose "edit copy". I made the couple changes to the item then renamed it as "Sound Sucker" and changed the item tag and resref to "soundsucker". Then I saved the module, left the toolset, opened the game, and loaded a saved game.

Positioning the pointer over an empty spot of floor, I enter the following two lines at the console (opening it using the ` key before each line)

DebugMode 1
dm_spawnitem soundsucker


After each line is entered, the console responds "Success", but no item appears.

I am at a loss here. I have tried spawning both standard items (like a scroll of Resistance) and other custom items I have made (e.g. rings) and not had any trouble.

But I have had trouble with a couple items. As an example, when trying to figure this out, I tried to spawn a Spellstaff (from SoU) and that didn't work either, even though my character actually has one in her inventory because she's the same character I took through SoU and HotU.


UPDATE: Just to check if there was something module-specific about this, I open Shadows Over Heliopolis in the toolset, exported the item to an erf, then opened the OC, imported that erf into the OC and saved the OC. I quit the toolset and open the game. Loading an OC saved game, I had no trouble spawning the item using the same process as above. Is it possible that whether a particular item can be spawned is dependent on the module? Is there a workaround to this?
               
               

               


                     Modifié par MrZork, 08 août 2010 - 08:22 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
I'm having trouble with dm_spawnitem
« Reply #1 on: August 08, 2010, 10:00:07 pm »


               Your new item is not in your saved game. A saved game in NWN is a module by its self. So the item You saved your item is not the saved game you are playing. Try opening the saved game in the toolset. And editing the saved game. You can do that by renameing the saved game with a .mod extention and then placeing it in your module folder.


EDIT : another option to editing the saved gam, would be to get the blueprint of the item you made and place it in the override folder.  you would then be able to spawn the item after opening the saved game again. 
               
               

               


                     Modifié par Lightfoot8, 08 août 2010 - 09:03 .
                     
                  


            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
I'm having trouble with dm_spawnitem
« Reply #2 on: August 09, 2010, 03:07:35 am »


               Thanks for that info and advice. I didn't even know saved games could be edited in the toolset. ':blush:'

Is there a way to generate the blueprint of the item from the .erf file that was created when I exported the item from the toolset? (That may be a basic question, but I haven't created a blueprint before.)

Just so I understand, why was I able to spawn the item in the OC? I loaded that from a saved game (although it was an MP one) and the item didn't exist in that campaign before I spawned it using dm_spawnitem.

It turns out that I was able to work around this particular issue by spawning the item in the OC saved game that I loaded as a MP game, then saving that character, then loading my saved SOH game in MP mode using that OC character, then dropping the item, then saving the SOH game, then reloading that game as a MP game with my original SOH character, then picking up the dropped item, and finally saving that game which I can now load as single-player again. ':blink:' I don't know if all that switching from SP to MP and back will cause some sort of trouble, but it seems to be working for now.

Thanks again.
               
               

               


                     Modifié par MrZork, 09 août 2010 - 02:08 .
                     
                  


            

Legacy_NWN DM

  • Hero Member
  • *****
  • Posts: 661
  • Karma: +0/-0
I'm having trouble with dm_spawnitem
« Reply #3 on: August 09, 2010, 03:13:13 am »


               Just wanted to say, MrZork; excellent avatar picture. '<img'>
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
I'm having trouble with dm_spawnitem
« Reply #4 on: August 09, 2010, 07:45:54 am »


               You can just open the module you have the item in in the toolset. With the module still open in the Toolset find the temp0 folder in your moduels folder in the NWN folder. In the temp folder there will be a file with a the ResRef of the item followed by a .uti extention ( ResRef.uti) this is your item Blue print. Just copy that file into your override folder. you will then be able to DM spawn that ResRef into any module you are playing.

What happens when you open a module in the toolset, is all the resources that are in the module are unpacked into the temp0 folder. Note: it is only resorces in the module not the ones in Haks or the OC.

To try and answer your questions on the results you where getting.
To be able to spawn an item in the module it has to be one of the resources for that module.
resources come from several places thay are.
BIF files. (original content .bif)
Module file (.mod)
Override folder ( will override any OC or .Bif resource with the same name )
Hak (.hak will override any file of the same name, even the ones in the override folder)

now an item does not have to have a ResRef Or blueprint in the module in order to be there. It just has to have Blueprint in order for the module to create one from scratch. ( I think this was a 1.68 or 1.67 upgrade Befor my CC days)

When you start a new game NWN creates a new folder called 'currentgame' in the NWN folder and copys the module you are playing into it. It updates this new module with everything that happens in the game.

When you save a game it makes sure the game in the 'currentgame' folder is up to date and copies it to the saved game folder with a .sav extention.

Now when you open a saved game It just moves the copy or the file from the saved game folder to the 'Currentgame' folder. Hence the reason the changes you where making to the original module where never taking effect.

Now the OC games do act a little different. the saves for one of the OC games ae never full modules but just the changes that took place in the game. So when you open an OC saved game Any resources changes you made to the original .nwm file could possiable show up in the save reload. I have never tested it, but it sounds like what happened for you.

If you want biowares version of how this all works you could read 'Documentation: Key and BIF File Format pdf' here.
               
               

               


                     Modifié par Lightfoot8, 09 août 2010 - 06:48 .
                     
                  


            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
I'm having trouble with dm_spawnitem
« Reply #5 on: August 09, 2010, 06:48:40 pm »


               That was a very informative explanation, Lightfoot8. I guess I have gotten used to trying out new items in the OC, which is somewhat similar to other games I've played. Knowing how the toolset and saved games work will be very useful and save me a ton of frustration.

I just tried copying the items uti file into from the temp0 folder into the override folder and it worked like a charm.

Thanks for laying all of that out so clearly and for the Bioware link. '<img'>


PS: NWN DM, Thanks. I actually just used GIMP to put something together very quickly to test out the tutorial on uploading an avatar. Back when everyone from the old forums was migrating over and it seemed like everyone had the same handful of avatars, I just wanted something a bit different. I still think I want to use a brighter color for the swirl, but I'm happy with it for now.
               
               

               


                     Modifié par MrZork, 09 août 2010 - 05:59 .