Trouble compiling a simple numeric change in NSS file

Greetings. I have no desire to learn any more than I need to for modding this game than I absolutely need to. I just want to be able to alter my gameplay to suit my desire. In this situation, I have been wanting to fiddle with the Crossroads Keep subgame.

I extracted the 21_module_load.NSS and did a simple numeric change to increase the number of initial peasants at module load and attempted to use the built-in script compiler with the toolset.

I receive an error that tells me I have an invalid declaration type on a script not even loaded, (kinc_globals.nss(1): ERROR: INVALID DECLARATION TYPE).
I have not changed any script functions, only altered the number 5 to 50.

My initial thoughts is that the original script was written using an older format that the game designers used which the subsequent mod community has improved upon, requiring syntax updates. Here is the NSS file for anyone magnanimous enough to peruse. Any enlightenment would be appreciated.

// 21_module_load
This is the custom on module load for Crossroad Keep.
It sets the starting variables for the Keep.
// FAB 9/29
// ChazM 10/03/05 - added initial Joiners.

#include “21_inc_cr_vars”
#include “ginc_debug”

void main()

int nCheck = GetGlobalInt( "21_Mod_Load" );

if ( nCheck == 0 )
	// Spawn the recruits who are in Crossroad Keep by default at the beginning.
	SetGlobalInt(JOIN_KANA		, 1);
	SetGlobalInt(JOIN_VEEDLE	, 1);
	SetGlobalInt(JOIN_WOLF		, 1);
	SetGlobalInt(JOIN_SAL		, 1);
	SetGlobalInt(JOIN_UNCUS		, 1);

	SetGlobalInt(UNIT_COUNT, 100);		// This is the number of troops at the start
	SetGlobalInt(PEASANTS, 500 );			// This is the number of peasants on the PC's lands
	SetGlobalInt(MERCHANTS, 10 );		// This is the number of merchants using the road
	SetGlobalInt(RECRUITING_BAR, 5);	// This is the default elite rating
	ChangeCivility( -1, 1);				// -1 is the starting civility of the Greycloak troops

	SetGlobalInt( "21_Mod_Load",1 );			// Don't run this "if" section again. 
	PrettyDebug( "Initial variables set." );

ExecuteScript( "k_mod_load",OBJECT_SELF );		// Continue with default loading script


I may be totally off here, so this is just a guess. It could be that in the include files there are yet other include files that are now missing when you try to compile it outside of the the module for the OC where you found the script.

1 Like

that’s my guess too.

‘21_inc_cr_vars’ #includes ‘kinc_globals’ which is in the OC Campaign folder. (beware there’s also a ‘kinc_globals’ in the MotB Campaign folder – but don’t go there)

To compile ‘21_module_load’ in the toolset you’d need to have an OC module open in the toolset (so that the files in the OC Campaign folder are available to the compiler).

edit: sometimes I get 0-byte NSS files in the installation folder so i guess it’s possible you’ve also got one there that’s mistakenly grabbing priority …

Thank you both for the quick reply. Loading the Whole module did the trick .
hat’s off

1 Like