Having trouble modding starting cargo?

zijin_cheng

Chieftain
Joined
Jan 17, 2011
Messages
14
I was able to successfully add in different types of cargo, eg starting with an extra explorer, but what I can't do is have the starting cargo give the player more than 1 item.

Whenever I try to mod "hydroponics" for example, I try to add another perk such as starting with a specific building. After I enable to mod, "hydroponics" has disappeared from the drop down list.

What gives?
 
Without seeing your XML and/or your database.log, I can't be sure you didn't mess up somewhere (it's easiest if you just attach your built mod to a post, i.e., the .civ5mod from the solution's Projects folder, or you can just zip up the one in your user Mods folder).

I suppose it's possible--I haven't checked--that you can't have more than one Grant* without the game bugging out. In which case, you could always use Lua instead.

I keep posting variations of this snippet, but it can't hurt to post it again:
Code:
Events.SerialEventCityCreated.Add(function(hexPos, playerID, cityID, cultureType, eraType, continent, populationSize, size, fowState)
	local currentCargo = PreGame.GetLoadoutCargo(playerID);
	if ( cityID == (Players[playerID]:GetCapitalCity()):GetID() ) then
		if ( currentCargo == GameInfoTypes["CARGO_HYDROPONICS"] ) then
			Players[playerID]:GetCityByID(cityID):SetNumRealBuilding(GameInfoTypes["BUILDING_YOUR_BUILDING"], 1);
		end
	end
end);
And replace BUILDING_YOUR_BUILDING with the appropriate type.
 
Without seeing your XML and/or your database.log, I can't be sure you didn't mess up somewhere (it's easiest if you just attach your built mod to a post, i.e., the .civ5mod from the solution's Projects folder, or you can just zip up the one in your user Mods folder).

I suppose it's possible--I haven't checked--that you can't have more than one Grant* without the game bugging out. In which case, you could always use Lua instead.

I keep posting variations of this snippet, but it can't hurt to post it again:
Code:
Events.SerialEventCityCreated.Add(function(hexPos, playerID, cityID, cultureType, eraType, continent, populationSize, size, fowState)
	local currentCargo = PreGame.GetLoadoutCargo(playerID);
	if ( cityID == (Players[playerID]:GetCapitalCity()):GetID() ) then
		if ( currentCargo == GameInfoTypes["CARGO_HYDROPONICS"] ) then
			Players[playerID]:GetCityByID(cityID):SetNumRealBuilding(GameInfoTypes["BUILDING_YOUR_BUILDING"], 1);
		end
	end
end);
And replace BUILDING_YOUR_BUILDING with the appropriate type.

Thanks, I'm not a hardcore modder, I just edit XML files for resource pods, yields etc. I thought modding cargo was going to be this simple but I guess not.
I've also tried looking up which file to put this particular snippet in, but I'm not sure.
 
Again, I'd like to see whether you just messed something up inadvertently before going the Lua route.

But to use my snippet, you'd make a new Lua file, then go the mod's properties, to the Content tab. Hit Add, choose the filename from the dropdown FIRST, then choose InGameUIAddin from the Type dropdown. Put whatever you want in the Name field, and you can leave Description blank. Then Build, and it should work.
 
Back
Top Bottom