PDA

View Full Version : What XML file contains encounter/NPC token locations?



ravenloft713
April 18th, 2017, 12:11
I'm having trouble figuring out how to edit a module data when it comes to encounter/NPC token locations. What campaign file is this information kept in?

I have another individuals .mod file and I inserted new maps (replacing the old ones--I didn't like them) into the .mod/.zip file. I noticed the push pins were off and moved those and did a bit of copy/paste from one .xml file within my campaign folder into the db.xml file at the root of the .mod file which now loads the correct locations for new campaigns.

The issue I have is the NPC tokens are still loading in the original author's locations (and thus placing some tokens outside the boundaries of the walled area of map). In my campaign "delme2" I have moved the tokens and when I exit/reenter the campaign or reload the encounter, it has my locations (which I want) but I cannot find the information within the .xml files so I can copy/paste and make it a permanent part of the .mod file for future campaigns.

Please advise.

Zacchaeus
April 18th, 2017, 12:39
The location of each NPC on the map is contained in the db.xml of the campaign. You should see a tag <npclist> and within that you'll find a <maplink> with an <imagx> and an <imagey> indication the positions of the tokens.

ravenloft713
April 18th, 2017, 13:03
My campaign is 'Delme2'. Would I find this information within the file C:\ProgramData\Fantasy Grounds\campaigns\delme2\db.xml? If so, I don't have any <npclist> tags. I have reopened the delme2 campaign and loaded my modified encounter (which was the original author's but then I clicked the check marks of each NPC and then redrug/scaled the tokens) and it loads as expected and is perfect.

I found information in one file to the effect of encounter.id-007@module <coords>

I am going from memory so that is not the exact syntax. Do I need to locate that info and copy it into the db.xml at the root of the module?

Talyn
April 18th, 2017, 13:57
Easiest thing is just to take the new map, put Encounter or NPC pins where you want them, then exit FG (or use the /save command) and the new image data with pin shortcuts will be in the campaign or moduledb (depending what you're doing) db.xml. You can copy/paste that section and replace the bits you're trying to edit manually. That's faster than guesswork at pixel locations.

Trenloe
April 18th, 2017, 15:09
If you're modifying data from a module you won't find that modified data in the campaign db.xml file. You'll find it within the moduledb directory within your campagin directory. The xml file will be the same name as the module.

ravenloft713
April 18th, 2017, 23:33
Sure enough, I found the NPC token locations within <module>.xml. Somehow I kept missing it including searching via Notepad++ so yeah...

What is the difference between the files "<module>.xml" and "<module>_1492246997.xml"?

With regards to the "permanent" NPC/token locations, do I simply copy/paste from <module>.xml to db.xml? If I'm moving things around, do I need to do a followup and more copy/paste with the timestamped/session/collision ID files?

Zacchaeus
April 18th, 2017, 23:41
The time stamped files are backup files. You don't need to do anything with them unless you db.xml gets lost in some way

ravenloft713
April 19th, 2017, 05:43
Maybe I'm editing encounter information different than I'm suppose to. I'll explain how I'm doing it, and hopefully you can provide where I'm going wrong. I'll also post some XML from two files to show my copy/paste issue.

Scenario: I load another author's module and want to make changes. I replace the map (opening up the .mod file and save over the file) because the original was black and white and I have/make a color version or poor quality and we can assume the map isn't exactly the same size as the original and I want to shift all tokens left 1 (onscreen) inch.

How I'm editing the NPC token locations:
1) I open the map and images and locate my map (which opens fine).
2) I open the encounter and load into the combat tracker. The original author's tokens load over my map, but the location is 1 inch too far to the right.
3) I unlock the encounter (padlock)
4) Click the checkmark icons below each NPC (skeletons for instance) until I have all small token icons (no longer checkmarks)
5) erase the original author's tokens from the map
6) Drag and drop the small token icons onto the map (1 inch left of the original location)
7) lock the encounter (padlock)
8) remove everything from the combat tracker
9) load the encounter. all entries load into the combat tracker fine, as well as load on the map in my desired area
10) close Fantasy Grounds
11) open Fantasy Grounds
12) reload the encounter--stuff stays where I want and we are good.
13) How to make my information saved into the original module db.xml file...

There's the problem! It's step 13. No wonder.

Here is a XML snippet from the c:\programdata\fantasy grounds\campaigns\delme2\moduledb\<module>.xml


<token>
<prototype>tokens/C.png@DD5E SRD Bestiary</prototype>
<id>145</id>
<x>424</x>
<y>200</y>
<scale>2.56</scale>
<name>Concealed Pit 1</name>
<unmodifiable />
<visibilitylocked>off</visibilitylocked>
</token>
<token>
<prototype>tokens/C.png@DD5E SRD Bestiary</prototype>
<id>146</id>
<x>424</x>
<y>600</y>
<scale>2.56</scale>
<name>Concealed Pit 2</name>
<unmodifiable />
<visibilitylocked>off</visibilitylocked>
</token>


Here is a XML snippet from the original author's module's db.xml

<id-00007>
<count type="number">2</count>
<faction type="string">foe</faction>
<link type="windowreference">
<class>npc</class>
<recordname>npc.id-00005</recordname>
</link>
<maplink>
<id-00001>
<imageref type="windowreference">
<class>imagewindow</class>
<recordname>image.id-00003.image</recordname>
</imageref>
<imagex type="number">464</imagex>
<imagey type="number">602</imagey>
</id-00001>
<id-00002>
<imageref type="windowreference">
<class>imagewindow</class>
<recordname>image.id-00003.image</recordname>
</imageref>
<imagex type="number">464</imagex>
<imagey type="number">202</imagey>
</id-00002>
</maplink>
<name type="string">Concealed Pit</name>
<token type="token">tokens/C.png@DD5E SRD Bestiary</token>
</id-00007>

Both snippets are for two NPC's named Concealed Pit, or Concealed Pit 1 and Concealed Pit 2. The copy and paste issue is each file packages the data using two different methods.

To be clear, the end goal is I can take a module and move the NPCs around (replace a skeleton with slightly more powerful one, say... a lich...) and save the data into a .mod file so there-on-out, I use my version.

I'm willing to edit the encounters using a different process (just name it) but I want to ensure I don't end up with twice as many encounters in the file (original author's I won't use) and mine. Or lose some original encounters if I felt that some, but not all the encounters were good.

Please advise.

Trenloe
April 19th, 2017, 13:33
It's hard to see exactly where the data is located as the snippet doesn't include all of the record. Is your first snippet from an <image> record? Whereas the second is from a <battle> (encounter) record? If you want to change the original encounter placement then you'll need to copy over like-for-like data. Look for a <battle> entry in your c:\programdata\fantasy grounds\campaigns\delme2\moduledb\<module>.xml file.