Aller au contenu

Photo

Campaign Editor (External)?


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
The Fred

The Fred
  • Members
  • 2 516 messages
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.

#2
Morbane

Morbane
  • Members
  • 1 883 messages
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
The Fred

The Fred
  • Members
  • 2 516 messages
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
SkywingvL

SkywingvL
  • Members
  • 351 messages
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).

#5
The Fred

The Fred
  • Members
  • 2 516 messages
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.

#6
SkywingvL

SkywingvL
  • Members
  • 351 messages
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.

#7
The Fred

The Fred
  • Members
  • 2 516 messages
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
SkywingvL

SkywingvL
  • Members
  • 351 messages
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.