I want to make a simple program which can add modules to campaigns, maybe do other stuff, but external to the toolset.
The simplest thing to do would be to patch the module into the .CAM file, but I don't know enough about the format to do that (I might just experiment and hope something works).
I figured another alternative would be to use the NWN2 DLLs; we already have the in-toolset campaign editor so it shouldn't be hard to use the same functionality to add modules to the campaign. The issue here is that I know nothing of C# (it just looks like funny Java to me) and have zero experience of NWN2 plugins. I can't even see the campaign editor source (don't know how big Obsidian are on decompiling but I can't find anything free and good anyway).
So, I was hoping someone might know enough to be able to point me in the right direction, at least. I've done some programming and stuff before, but I just don't really know where to go with this.
Campaign Editor (External)?
Débuté par
The Fred
, mai 15 2011 03:40
#1
Posté 15 mai 2011 - 03:40
#2
Posté 18 mai 2011 - 10:30
You might try to contact the people that built/designed nssclc - they use the base compiler but to run it externally they linked in the necessary dll's and exe's or the like.
#3
Posté 18 mai 2011 - 03:35
I did read over the NSSCLC source code, and read up a bit on C#. As far as I can tell, I can write a piece of code which links to the DLLs just fine. However, I can't understand enough of them to be able to see how to do what I want, and the NSSCLC works a bit differently (the main issue is, it calls NWN2's compile function on a script file which it already knows; I don't know how to find the campaign file to add the module to).
#4
Posté 21 mai 2011 - 06:00
Should you wish to make an external tool (not a toolset plugin) to do this, you could use the NWN2 Datafile Accessor library support for editing GFFs (NWN2DataLib's GffFileReader/GffFileWriter) for this purpose.
Campaigns are linked to a module by a "Campaign_ID" VOID GFF field (16 bytes, actually a GUID) in module.ifo. This must match the "GUID" VOID GFF field in the associated campaign.cam file that functions as the campaign descriptor.
NWN2DataLib's ResourceManager::LoadCampaign shows how the campaign loading search strategy works (with the CampaignID argument being the value from the associated module.ifo's "Campaign_ID" field).
Campaigns are linked to a module by a "Campaign_ID" VOID GFF field (16 bytes, actually a GUID) in module.ifo. This must match the "GUID" VOID GFF field in the associated campaign.cam file that functions as the campaign descriptor.
NWN2DataLib's ResourceManager::LoadCampaign shows how the campaign loading search strategy works (with the CampaignID argument being the value from the associated module.ifo's "Campaign_ID" field).
#5
Posté 22 mai 2011 - 06:31
Thanks, Skywing. I did download your library a while back, I'll see if I can get my head around it.
I think there are two parts to linking a module to a campaign, adding the module to the campaign and setting the module to use the campaign (kinda like adding the campaign to the module). Ideally I would like to be able to do the latter (which is what's contained in the module.ifo I think, as you say) but what I want to do most is add modules to the campaign.cam file. I don't know if this is actually necessary, though, since I seem to remember setting a module to use a campaign without adding it, and all the resources showed up just fine and everything, so I'm not sure if this actually does anything.
I think there are two parts to linking a module to a campaign, adding the module to the campaign and setting the module to use the campaign (kinda like adding the campaign to the module). Ideally I would like to be able to do the latter (which is what's contained in the module.ifo I think, as you say) but what I want to do most is add modules to the campaign.cam file. I don't know if this is actually necessary, though, since I seem to remember setting a module to use a campaign without adding it, and all the resources showed up just fine and everything, so I'm not sure if this actually does anything.
#6
Posté 22 mai 2011 - 07:20
I believe the list module list in campaign.cam isn't used by the server for mechanics purposes (rather the module specifies which campaign it wishes based on the GUID).
That being said, if you want to adjust the list in the campaign.cam file for display purposes, there's a ModNames list of structs (type 0), which contain a single CExoString member named "ModuleName". This member supplies the resource name of the module.
GffFileReader/GffFileWriter are usable for editing campaign.cam as it is a GFF file, as is module.ifo.
That being said, if you want to adjust the list in the campaign.cam file for display purposes, there's a ModNames list of structs (type 0), which contain a single CExoString member named "ModuleName". This member supplies the resource name of the module.
GffFileReader/GffFileWriter are usable for editing campaign.cam as it is a GFF file, as is module.ifo.
#7
Posté 25 mai 2011 - 11:10
OK well what I'm trying to do is create a little thing which will add modules to a campaign, so you could add custom modules dynamically. If the modules list in the campaign file is ignored, then I probably don't even need to do anything, since the modules could be set to use the campaign when they're being built. However, it sounds farily simple to do so I might have a go anyway, just as soon as I can wrap my head around this C++ business.
#8
Posté 25 mai 2011 - 02:38
If you want a reference, you could look at the UpdateModTemplates sample program included with the library drop, which demonstrates how to load up GFF files, modify their contents, and save the modified versions back.





Retour en haut






