Adding Covert Ops Buggered All of Them

Tvol

Chieftain
Joined
Nov 6, 2014
Messages
13
Well, except for Establish Network. :rolleyes:

I'm trying to make the covert ops system suck less, and part of that is adding two new ops that do nothing other than increase intrigue. Problem is, it seems that adding them seriously screwed with every op save for Establish Network. From what I've read, this is reminiscent of the ID problems that occurred in Civ 5, but I've got no clue on how to go about cleaning-up the mess I've made.

The effect I'm seeing in-game is that all ops are greyed-out, but have their correct images. They all have no titles, say "Difficulty: Very Easy", LVL 0, and the tooltips are blank.

Here's the source for the relevant XML:

Code:
<GameData>
	<CovertOperations>
		<Update>
			<Where>
				<Type>COVERT_OPERATION_SIPHON_ENERGY</Type>
			</Where>
			<Set>
				<ScriptName>SiphonEnergyCovertOperationBCO</ScriptName>
				<BaseTurns>10</BaseTurns>
				<BaseIntrigue>10</BaseIntrigue>
			</Set>
		</Update>
		<Update>
			<Where>
				<Type>COVERT_OPERATION_STEAL_RESEARCH</Type>
			</Where>
			<Set>
				<ScriptName>StealResearchCovertOperationBCO</ScriptName>
				<BaseTurns>10</BaseTurns>
				<BaseIntrigue>10</BaseIntrigue>
			</Set>
		</Update>
		<Update>
			<Where>
				<Type>COVERT_OPERATION_HACK_SATELLITES</Type>
			</Where>
			<Set>
				<BaseDifficulty>50</BaseDifficulty>
				<BaseIntrigue>20</BaseIntrigue>
			</Set>
		</Update>
		<Row>
			<Type>COVERT_OPERATION_OPS_PREPARATION</Type>
			<ScriptName>OpsPreparationCovertOperationBCO</ScriptName>
			<Description>TXT_KEY_COVERT_OPERATION_OPS_PREPARATION_DESCRIPTION</Description>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>COVERT_OPS_ATLAS</IconAtlas>
			<BaseTurns>12</BaseTurns>
			<BaseDifficulty>30</BaseDifficulty>
			<BaseIntrigue>25</BaseIntrigue>
			<BaseRequiredIntrigueLevel>0</BaseRequiredIntrigueLevel>
		</Row>
		<Row>
			<Type>COVERT_OPERATION_SPECIAL_OPS_PREPARATION</Type>
			<ScriptName>SpecialOpsPreparationCovertOperationBCO</ScriptName>
			<Description>TXT_KEY_COVERT_OPERATION_SPECIAL_OPS_PREPARATION_DESCRIPTION</Description>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>COVERT_OPS_ATLAS</IconAtlas>
			<BaseTurns>18</BaseTurns>
			<BaseDifficulty>40</BaseDifficulty>
			<BaseIntrigue>50</BaseIntrigue>
			<BaseRequiredIntrigueLevel>3</BaseRequiredIntrigueLevel>
		</Row>
	</CovertOperations>
</GameData>

The reason I think this is ID-related is because the Establish Network op is the only one in the game's files that actually has an ID value for it (0). All the others have no values declared.

Neither database.log nor lua.log show any errors.

Edit: Adding <ID>1</ID> fixes the problem with the original covert ops not showing up, but the new additions don't show as a result. With that change the code looks like this:

Code:
...

		<Row>
			<ID>1</ID>
			<Type>COVERT_OPERATION_OPS_PREPARATION</Type>
			<ScriptName>OpsPreparationCovertOperationBCO</ScriptName>
			<Description>TXT_KEY_COVERT_OPERATION_OPS_PREPARATION_DESCRIPTION</Description>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>COVERT_OPS_ATLAS</IconAtlas>
			<BaseTurns>12</BaseTurns>
			<BaseDifficulty>30</BaseDifficulty>
			<BaseIntrigue>25</BaseIntrigue>
			<BaseRequiredIntrigueLevel>0</BaseRequiredIntrigueLevel>
		</Row>
 
I had to work on the covert ops system for my mod. I can tell you one problem right here:

<ScriptName>SiphonEnergyCovertOperationBCO</ScriptName>

You should go look in CovertOperationsSystem.Lua to see what happens with this. It ends up looking for this file and can never find it.

I had to make changes directly in CovertOperationsSystem.lua because mods are not going to be able to know where their files are located in the filesystem these days. You may want to download my mod to see how I did this.
 
I had to work on the covert ops system for my mod. I can tell you one problem right here:

<ScriptName>SiphonEnergyCovertOperationBCO</ScriptName>

You should go look in CovertOperationsSystem.Lua to see what happens with this. It ends up looking for this file and can never find it.

I had to make changes directly in CovertOperationsSystem.lua because mods are not going to be able to know where their files are located in the filesystem these days. You may want to download my mod to see how I did this.

That line you quoted was pure derp on my part. I was thinking to keep adding data for my mod, not replacing, at least where possible. Trying to be non-destructive and whatnot.

I saw what you did and...eeewwwwww, are you saying what I think you're saying? Any mod-added covert ops are going to have to go right in CovertOperationsSystem.lua ? Cause that'd be...very unfortunate.
 
I can't find any other way to do it, because I can't see any way to know where your files will end up, and the code in CovertOperationsSystem.lua references the folder location before the file name.

At least you didn't have to bang your head against the wall for 2 days figuring that out? ;)
 
Eeeeeeeeeeeeeewwwwwwwwwwwww.

That's just some really poor implementation on Firaxis' end right there. Grrrr.
 


I should've thought of your utility mod earlier. Thanks.

Edit: I think I found a typo in your Steam description. The description on steam says to add files as "CovertOperationAddin" in the content tab. The code you added in CovertOperationsSystem.lua references "CovertOperationsAddin"; note the s. Line number 755 of your CovertOperationsSystem.lua:

Code:
for addin in Modding.GetActivatedModEntryPoints("CovertOperationsAddin") do

Anyway, do you have any examples of a covert op addition via your mod? I'm pretty sure I have everything set-up right, but still ran into the grey-out all operations. (If I add ID tags to the operations I'm adding, then only those ones are greyed-out and the vanilla ones are fine.)
 
I created a mod that, combined with Vice's utilities mod, should just add a copy (more-or-less) of the Establish Network covert op. I renamed it, and for all intents and purposes it's a unique op. Yet, it doesn't work. On top of that, the damned dependencies setting isn't working for me anymore either. I triple-checked that the mod id was correct, but with the dependency enabled, the game just won't accept that the Utilities mod is enabled too. Stupid. Confusing. Brain annoying. I've attached a copy. Help would be appreciated.
 
I was trying to change the bonuses gained from expeditions and resource pods so I also had to use Vice's mod to load custom scripts into the game. The thing is, you shouldn't create sub-folders for your custom covert op .lua scripts - all of them should be placed in the mod's root directory. Also you need to make sure that you entered the script file name without an extension in the "Name" field when adding the script in the "Content" tab.

And the last thing is, the mod ID in dependencies still was wrong. The one I found in your mod was too short to be the right one.
 
I was trying to change the bonuses gained from expeditions and resource pods so I also had to use Vice's mod to load custom scripts into the game. The thing is, you shouldn't create sub-folders for your custom covert op .lua scripts - all of them should be placed in the mod's root directory. Also you need to make sure that you entered the script file name without an extension in the "Name" field when adding the script in the "Content" tab.

Is the name in the content tab supposed to be the same as the one used for <ScriptName> in CivBECovertOperations.xml?

And the last thing is, the mod ID in dependencies still was wrong. The one I found in your mod was too short to be the right one.

Is it not the Steam file ID? I used that earlier and it worked just fine. Edit: It's the long alphanumeric string that you can see in-game under a mod's title, isn't it? The one that can't be copied? ... Yay.
 
I moved all the files to the root folder, and I think I fixed the Content entry, but still no joy in-game. Fixed the dependency silly on my part at least.
 

Attachments

Is the name in the content tab supposed to be the same as the one used for <ScriptName> in CivBECovertOperations.xml?
... ah, nevermind. I've made a quick test and figured out that the name listed in the "Content" tab doesn't really make any difference.
Is it not the Steam file ID? I used that earlier and it worked just fine. Edit: It's the long alphanumeric string that you can see in-game under a mod's title, isn't it? The one that can't be copied? ... Yay.
I'm not sure about what the Steam ID is, but the long string is the right one. It CAN be copied, btw. You can find it in the .modinfo file.
I moved all the files to the root folder
You did? The attachment doesn't seem to be different. Perhaps there is some kind of language barrier that makes me sound unclear. Did you moved your custom script file from the LUA folder to the folder where your .civbeproj file is located? That's the root I was referring to.
 
You did? The attachment doesn't seem to be different. Perhaps there is some kind of language barrier that makes me sound unclear. Did you moved your custom script file from the LUA folder to the folder where your .civbeproj file is located? That's the root I was referring to.

Well, it should be different. Maybe you're running into weird caching or something. Probably should've renamed it.

In any case, I figured-out the problem. For some damned reason, Civ wasn't actually applying the mod to the savegame I was using for testing. If I have to start a new game from scratch every time I need to test a new build...this is going to get tedious.
 
Edit: I think I found a typo in your Steam description. The description on steam says to add files as "CovertOperationAddin" in the content tab. The code you added in CovertOperationsSystem.lua references "CovertOperationsAddin"; note the s. Line number 755 of your CovertOperationsSystem.lua:

Code:
for addin in Modding.GetActivatedModEntryPoints("CovertOperationsAddin") do


Thanks for informing me. I'll fix that when I get home.

You shouldn't have to put the file in the root folder, but both of the mods I've tested have the files in the root folder. I will test that later. Also, please note that I have only personally tested Quests and QuestObjectives with this system. Everything else, I just edited them after seeing they had the same limitations as QuestSystem; I did not build mods to test them. In particular, it seems that PersonalitySystem isn't even in use.
 
You shouldn't have to put the file in the root folder, but both of the mods I've tested have the files in the root folder. I will test that later. Also, please note that I have only personally tested Quests and QuestObjectives with this system. Everything else, I just edited them after seeing they had the same limitations as QuestSystem; I did not build mods to test them. In particular, it seems that PersonalitySystem isn't even in use.

It seems like you definitely have to put Lua scripts in the root folder. I tried putting them in a folder and poof, blank descriptions and tooltips.

At least I got the original mod working now. All that's left is some polishing for release.
 
Back
Top Bottom