1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Figuring Out Building Creation

Discussion in 'C2C mod mods' started by Squidimp, Apr 13, 2016.

  1. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Ooh, good idea @Tbird!
    Although to apply it to the Knightly units I'd have to edit the unit infos, at which point it becomes a lot less modular :think:
    I guess I could just give the instruction to people not to use it unless they're using v37, and/or to make a backup of their units file, to avoid losing any modifications to units that were done on the SVN since.
     
  2. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    You can add it to the knightly units and still keep it modular. That is what WoC is for. In your mod you have a unitinfos file with something like.
    Code:
    	<UnitInfo>
    		<Type>UNIT_FRED1</Type>
    		<SubCombatTypes>
    			<SubCombatType>UNITCOMBAT_NEW_KNIGHT1</SubCombatType>
    		</SubCombatTypes>
    	<UnitInfo>
    
     
  3. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Thanks for the heads up.
    The reign of FRED1 has only just begun! :ninja: :lol:
     
  4. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    24,748
    Gender:
    Male
    Location:
    Las Vegas
    You'll want to review how to add a combat class - there's a link to a document for that on the first page of the modders documentation thread. There could be a few out of date details so if it's not completely followable, ask for clarification there so I know where it's not up to speed yet. Adding Unitcombats aren't quite as straightforward as xml normally is.
     
  5. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    I found <BuildingHappinessChange> in the BuildingDefines. It doesn't appear to do anything. I don't think its been used anywhere, either. Has anyone used it? Does anyone know how it works?
     
  6. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    You can see an example if its use in the VokaryaWonders_CIV4BuildingInfos.xml file (modules\vokarya). THere are multiple buildings in there that use it.

    It gives extra happiness if both buildings are in the city, the one with the BuildingHappinessChange tag and the one that it mentions. For example, BUILDING_BAYREUTH specifies
    Code:
    <BuildingHappinessChanges>
    				<BuildingHappinessChange>
    					<BuildingType>BUILDINGCLASS_OPERA_HOUSE</BuildingType>
    					<iHappinessChange>1</iHappinessChange>
    				</BuildingHappinessChange>
    			</BuildingHappinessChanges>
    So if both the wonder and an opera house are in the city it gives +1 happiness.

    It might give the happiness to the building with the tags, or it might give +1 happiness to all the specified buildings everywhere. I'm not sure which. It might be shown clearly in the civilopedia entry for that wonder whether it gets +1 happy for having an opera house in the same city, or if it gives +1 happy to opera houses everywhere.

    It could be either one, but since these are wonders that use the tag I suspect it is giving any buildings of the specified building class the specified happiness amount globally. Since the same tag is used by civics, that points in the "globally" direction as well.
     
  7. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Thanks for the pointer. I fiddled with it a bit, and it didn't seem to say anything in the civilopedia, but I'll check out Vokarya's stuff, presumably it works for him. :goodjob:
     
  8. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    OK, this is weird. I can't access the Wonders section of the Civilopedia anymore.
    Presumably this is the result of my wonders, but I have no idea how :confused:

    Assuming that it can't be the XML of the wonders themselves, could this have something to do with references to my subfolder? But I was able to create plenty of functioning wonders without ever running into this problem! Why only now? :sad:

    Anyone have any ideas?
     
  9. Kornifere

    Kornifere Chieftain

    Joined:
    Mar 30, 2016
    Messages:
    17
    Location:
    Germany
    Interesting... I've included your wonders in my game (SVN 9219) and I had similar problems, but it was not the wonders section of the Civilopedia that disappeared, it was the units section. As a consequence I added the Knightly trait manually to every knight unit and removed the unit-files of the mod mod. Now everything seems to be fine.
     
  10. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    That's even weirder!
    I'm not having any problems with units :hmm:
    It must be something to do with the way I included my folder? ...Maybe I'll try moving it into MyMods and see if that solves the problem :huh:

    EDIT: If I move the folder to MyMods, the Units AND the Great Wonders sections won't load! What? :run:

    EDIT 2: OK, by removing the <init/> line in my AlexMods config XML, which I had forgotten to remove earlier, I solved the problem of the Great Wonders section not working. However, the Units section is still not working, as reported by Kornifere. I'm still not sure why direct editing solved the problem is his case; could this be something related to WOC loading?

    EDIT 3: TOKYO DRIFT
    SO. It turns out that my unit entry for heavy cavalry contained a superfluous TYPE_ prefix, which was causing the units section of the Civilopedia not to load. However, in fixing it I discovered that the new UnitCombat Knightly completely overwrites all of the old unitcombats, so that knight units only have Knightly and not, say, Melee. :crazyeye: I am continuing to investigate!
     
  11. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    It looks like unitcombat edits don't like WoC loading. This is why Kornifere could solve the problem by defining them in the unit XMLs directly; my typo wasn't needed to define the unit, and there was also no overwriting.

    This does, however, have the unfortunate implication that I can't actually get the Knight wonders working properly without editing the unitfiles directly. Thus making the whole enterprise much less modular, not to mention time consuming for people at home to install. Unless I can figure out someway to distribute Promotions based solely on Unit <Type>. Which would be much less elegant, but oh well.

    EDIT: RETURN OF THE EDIT
    Turns out I can assign promotions based on unit type rather than unitcombat. Doing so works perfectly, except that it somehow seems to have stopped the Wonders part of the Civilopedia from loading again. Even though the change was to an autobuilding that isn't a wonder!? :wallbash:
     
  12. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    There is another way.

    1) copy all the units you want to add the new combat class into your unit file
    2) add the unit class
    3) add a line at the end of the XML for each unit containing <bForceOverwrite>1</bForceOverwrite>

    This will force your version of the units to be used if your mod is installed.

    It is not generally recommended because it can cause other modders problems. It is probably OK in this case but you will need to watch out for other modders changing those units an unlikely event at the moment.
     
  13. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Thanks for the tip, but after converting all of the Knight wonders to using unit type the Wonders section magically started working again? So I guess that's fine, I just don't need to use unitcombats at all.
    In fact, this way works for modular units, like the Zebra Knight, which refused to cooperate with the other method :cool:

    Lessons learnt so far:
    1. The Civilopedia is a confusing, fickle mistress.
     
  14. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    I have updated my mod thread with the hopefully-less-screwy version. :please:

    Also, 4 bonus wonders which almost no one is ever going to see, as they come in the Transhuman era. :mischief:


    Next up: probably more vicinity bonuses, more wonders, and hopefully I can figure out how to add a new mission to Captives so that they can build Shrunken Heads if you own Headhunter Cult. Assuming such a thing is even possible :salute:
     
  15. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    You will need a Mission, an Outcome, and on the unit an Action with outcomes to do that. You may need some Python or maybe not;)
     
  16. Faustmouse

    Faustmouse Chieftain

    Joined:
    Jan 31, 2012
    Messages:
    3,485
    Are both the Shrunken Heads and the Headhunter Cult buildings? If so, you don't need a mission. You only need to add the building to the units building list, like Pigeons can build a Feather Worker.
     
  17. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    That would simplify things, I had assumed a mission was needed for each building. Maybe I should check out the pigeon :think:
    That said, I would like to check out missions anyway, since I think Garland Wars should improve results from sacrificing captives.
     
  18. Faustmouse

    Faustmouse Chieftain

    Joined:
    Jan 31, 2012
    Messages:
    3,485
    To keep it modular you need to put this code as an entry in the respective UnitInfo File:

    Code:
    		<UnitInfo>
    			<Class>UNITCLASS_CAPTIVE</Class>
    			<Type>UNIT_CAPTIVE</Type>
    			<Buildings>
    				<Building>
    					<BuildingType>BUILDING_SHRUNKEN_HEADS</BuildingType>
    					<bBuilding>1</bBuilding>
    				</Building>
    			</Buildings>
    		</UnitInfo>
    Don't know if the tags are the right ones, but the structure if correct. You can have it inside your own unit info file to keeps things fully modular.
    Of course you then need to have a building entry for the shrunken heads that specify what this building does, how much it costs (-1 if you want it to be only buildable by captives) and other prereqs :goodjob:
     
  19. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    You don't need the Class line. In fact if you do have it then sometimes it can calls errors.

    edit In fact to be totally safe when using such a WoC update transaction you should put in some dependency lines to make sure that this bit of XML wont return an error because another modder did something.

    Code:
    		<UnitInfo>
    			<Type>UNIT_CAPTIVE</Type>
    			<AndDependencyTypes>
    				<DependencyType>UNIT_CAPTIVE</DependencyType>
    				<DependencyType>BUILDING_SHRUNKEN_HEADS</DependencyType>
    			</AndDependencyTypes>
    			<Buildings>
    				<Building>
    					<BuildingType>BUILDING_SHRUNKEN_HEADS</BuildingType>
    					<bBuilding>1</bBuilding>
    				</Building>
    			</Buildings>
    		</UnitInfo>
    would be the best.
     
  20. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Thanks guys, I've added the shrunken heads building, now buildable by Millitary Captives and Captive Neanderthals. :D
    So the dependency tags prevent WOC loading if those objects can't be found? How important is it to add?

    In other news, I'm trying to figure out how to get a building to enable the autobuilding of another building in all cities globally. I've been trying to avoid excess Python, so I've tried using AIAndy's expression system. Problem being that I'm not sure how or when RELATION_NEAR can be used.
    Currently the code looks like this:
    Spoiler :

    Code:
    <ConstructCondition>
    	<And>
    		<Not>
    			<Has>
    				<GOMType>GOM_CIVIC</GOMType>
    				<ID>CIVIC_MARXIST</ID>
    			</Has>
    		</Not>
    			<IntegrateOr>
    				<RelationType>RELATION_NEAR</RelationType>
    				<GameObjectType>GAMEOBJECT_CITY</GameObjectType>
    				<iDistance>9000</iDistance>
    				<Has>
    					<GOMType>GOM_BUILDING</GOMType>
    					<ID>BUILDING_COMINTERN</ID>
    				</Has>
    			</IntegrateOr>
    	</And>
    </ConstructCondition>
    

    It's supposed to enable construction if a civ isn't running Marxist, and someone builds Comintern, but I can't get the second part to work in-game. Any ideas? :hmm:

    In other other news, does anyone know much about nvdxt? I presume there is some way to edit all my images without doing them one at a time, but I can't quite get it to cooperate.
     

Share This Page