1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

New improvement art! You don't need to replace civ5artdefines_landmarks.xml

Discussion in 'Civ5 - Creation & Customization' started by Pazyryk, Jan 15, 2012.

  1. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    2,990
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Just for "fun" :rolleyes: I'm playing with adding unit art in SQL. I may be slightly out of my depth, but I think I get everything that's going on.

    Unfortunately, CiV doesn't seem to pick up the new art files from my mod, and I just get spearmen art (which is what happens when the fxsxml isn't found). I'm wondering whether this is also an issue with landmarks. Have you tried using art introduced by a mod? Even just a copy of the vanilla art with a renamed fxsxml?

    ...The weird part is, when I activate a unit mod using the XML method and look at Civ5DebugDatabase.db, the entries from Civ5ArtDefines_UnitMembers.xml aren't injected into the corresponding ArtDefine tables. Worse, I can't even find where in the database the entries in Civ5ArtDefines_Units.xml are supposed to go (e.g., Formation, DamageStates, MemberCount), let alone where they ended up. Is there another database besides the ones in the cache folder?
     
  2. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,585
    Yes, that's exactly what I did in post #9 (renamed fxsxml and all downstream art assets).

    Well, I've been assuming in discussion that unit art works like landmark art, with the one known exception that you can replace unit .xml files but not landmark .xml files. But this is just a theory that I haven't tested. Perhaps unit art is the complete opposite of landmark art: you CAN replace .xml but you CAN'T update DebugDatabase directly. (Before reaching this conclusion, however, you should test to make sure you are able to change landmark art DB as I have done.)

    One note: since I've been playing around with this stuff I've checked the "Reload Landmark System" in the mod properties. There is also a "Reload Unit System". In the past, I always had the former unchecked (per advice from other modders) and the latter checked. But I have no idea what these do or are intended to do.
     
  3. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    2,990
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Pazyryk,

    Can you post the rest of your SQL code, i.e., for tables Builds, Improvements, and Unit_Builds -- did you have to use BuildFeatures or Improvement_ValidTerrains?
     
  4. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,585
    To add an improvement, you do need to add it as a Unit_Builds. You also need to add some terrain types to Improvement_ValidTerrains to be able to build it anywhere. BuildFeatures is only needed if you want the improvement type to "autochop" a feature.

    I don't want to post that particular SQL because I'm trying to keep my mod a bit of a secret, for now at least. (I could post some example SQL if that is what you're looking for. I actually don't use xml anymore except for Text.xml, and only that because you can't add things like Mór or Nezhêlîba in sql.)
     
  5. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    2,990
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    I'd appreciate it if you could. SQL syntax is a bit strange.
     
  6. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    2,990
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    I never got a response. Hey, Pazyryk--or anyone else who's got this figured out--if you've got a bit of time...

    I've managed to figure out enough SQL to be medium-dangerous, but I can't seem to replicate your results with improvements. The tables are all being updated properly. My workers can build the thing just fine, it's just that it's invisible.

    I tried converting a couple of Civ4 buildings, but I can't even get any of the vanilla CiV ones to work (and I've tried several). If you get a chance, can you post an example, or if it's easier, critique what I've got below:

    Spoiler :
    Code:
    INSERT INTO "ArtDefine_Landmarks" ('Era', 'State', 'Scale', 'ImprovementType', 'LayoutHandler', 'ResourceType', 'Model', 'TerrainContour')
    	VALUES ( 'Any', 'Any', 1.0, 'ART_DEF_IMPROVEMENT_TOWER', 'SNAPSHOT', 'ART_DEF_RESOURCE_ALL', 'porcelain_tower2.fxsxml', 1 );
    INSERT INTO "ArtDefine_LandmarkTypes" ('Type', 'LandmarkType', 'FriendlyName')
    	VALUES ( 'ART_DEF_IMPROVEMENT_TOWER', 'Improvement', 'Tower' );
    INSERT INTO "ArtDefine_StrategicView" ('StrategicViewType', 'TileType', 'Asset')
    	VALUES ( 'ART_DEF_IMPROVEMENT_TOWER', 'Improvement', 'SV_Landmark.dds' );
    -----------
    INSERT INTO "BuildFeatures" ('BuildType', 'FeatureType', 'PrereqTech', 'Time', 'Production', 'Cost', 'Remove')
    	VALUES ( 'BUILD_TOWER', 'FEATURE_JUNGLE', 0, 100, 0, 0, 0 );
    INSERT INTO "BuildFeatures" ('BuildType', 'FeatureType', 'PrereqTech', 'Time', 'Production', 'Cost', 'Remove')
    	VALUES ( 'BUILD_TOWER', 'FEATURE_FOREST', 0, 100, 0, 0, 0 );
    INSERT INTO "BuildFeatures" ('BuildType', 'FeatureType', 'PrereqTech', 'Time', 'Production', 'Cost', 'Remove')
    	VALUES ( 'BUILD_TOWER', 'FEATURE_MARSH', 0, 100, 0, 0, 0 );
    INSERT INTO "BuildFeatures" ('BuildType', 'FeatureType', 'PrereqTech', 'Time', 'Production', 'Cost', 'Remove')
    	VALUES ( 'BUILD_TOWER', 'FEATURE_FALLOUT', 0, 100, 0, 0, 0 );
    -----------
    INSERT INTO "Improvement_ValidTerrains" ('ImprovementType', 'TerrainType')
    	VALUES ( 'IMPROVEMENT_TOWER', 'TERRAIN_GRASS' );
    INSERT INTO "Improvement_ValidTerrains" ('ImprovementType', 'TerrainType')
    	VALUES ( 'IMPROVEMENT_TOWER', 'TERRAIN_PLAINS' );
    INSERT INTO "Improvement_ValidTerrains" ('ImprovementType', 'TerrainType')
    	VALUES ( 'IMPROVEMENT_TOWER', 'TERRAIN_DESERT' );
    INSERT INTO "Improvement_ValidTerrains" ('ImprovementType', 'TerrainType')
    	VALUES ( 'IMPROVEMENT_TOWER', 'TERRAIN_TUNDRA' );
    INSERT INTO "Improvement_ValidTerrains" ('ImprovementType', 'TerrainType')
    	VALUES ( 'IMPROVEMENT_TOWER', 'TERRAIN_SNOW' );
    INSERT INTO "Improvement_ValidTerrains" ('ImprovementType', 'TerrainType')
    	VALUES ( 'IMPROVEMENT_TOWER', 'TERRAIN_HILL' );
    -----------
    INSERT INTO "Unit_Builds" ('UnitType', 'BuildType')
    	VALUES ( 'UNIT_WORKER', 'BUILD_TOWER' );
    -----------
    INSERT INTO "Builds" ('Type', 'Description', 'Help', 'DisabledHelp', 'Recommendation', 'HotKey', 'HotKeyAlt', 'HotKeyPriority', 'HotKeyPriorityAlt', 'OrderPriority', 'AltDown', 'AltDownAlt', 'ShiftDown', 'ShiftDownAlt', 'CtrlDown', 'CtrlDownAlt', 'Time', 'Cost', 'CostIncreasePerImprovement', 'Kill', 'Repair', 'RemoveRoute', 'PrereqTech', 'ImprovementType', 'RouteType', 'EntityEvent', 'IconIndex', 'IconAtlas')
    	SELECT ("BUILD_TOWER"), ("Test Tower Build"), "Help", "DisabledHelp", "Recommendation", ("KB_Z"), "HotKeyAlt", "HotKeyPriority", "HotKeyPriorityAlt", "OrderPriority", "AltDown", "AltDownAlt", "ShiftDown", "ShiftDownAlt", "CtrlDown", "CtrlDownAlt", "Time", "Cost", "CostIncreasePerImprovement", "Kill", "Repair", "RemoveRoute", "PrereqTech", ("IMPROVEMENT_TOWER"), "RouteType", "EntityEvent", (54), "IconAtlas"
    	FROM "Builds" WHERE (Type = "BUILD_FARM");
    INSERT INTO "Improvements" ('Type', 'Description', 'Civilopedia', 'Help', 'ArtDefineTag', 'WorldSoundscapeAudioScript', 'ImprovementPillage', 'ImprovementUpgrade', 'SpecificCivRequired', 'CivilizationType', 'HillsMakesValid', 'FreshWaterMakesValid', 'RiverSideMakesValid', 'NoFreshWater', 'RequiresFlatlands', 'RequiresFlatlandsOrFreshWater', 'RequiresFeature', 'Coastal', 'Water', 'DestroyedWhenPillaged', 'BuildableOnResources', 'BarbarianCamp', 'Goody', 'Permanent', 'OutsideBorders', 'GraphicalOnly', 'CreatedByGreatPerson', 'Culture', 'CultureAdjacentSameType', 'TilesPerGoody', 'GoodyRange', 'FeatureGrowth', 'UpgradeTime', 'RiverSideUpgradeMod', 'CoastalLandUpgradeMod', 'HillsUpgradeMod', 'FreshWaterUpgradeMod', 'DefenseModifier', 'NearbyEnemyDamage', 'PillageGold', 'ResourceExtractionMod', 'GoldMaintenance', 'PortraitIndex', 'IconAtlas')
    	SELECT ("IMPROVEMENT_TOWER"), ("Tower"), "Civilopedia", "Help", ("ART_DEF_IMPROVEMENT_TOWER"), "WorldSoundscapeAudioScript", "ImprovementPillage", "ImprovementUpgrade", "SpecificCivRequired", "CivilizationType", "HillsMakesValid", "FreshWaterMakesValid", "RiverSideMakesValid", "NoFreshWater", "RequiresFlatlands", "RequiresFlatlandsOrFreshWater", "RequiresFeature", "Coastal", "Water", "DestroyedWhenPillaged", "BuildableOnResources", "BarbarianCamp", "Goody", "Permanent", "OutsideBorders", "GraphicalOnly", "CreatedByGreatPerson", "Culture", "CultureAdjacentSameType", "TilesPerGoody", "GoodyRange", "FeatureGrowth", "UpgradeTime", "RiverSideUpgradeMod", "CoastalLandUpgradeMod", "HillsUpgradeMod", "FreshWaterUpgradeMod", "DefenseModifier", "NearbyEnemyDamage", "PillageGold", "ResourceExtractionMod", "GoldMaintenance", (36), "IconAtlas"
    	FROM "Improvements" WHERE (Type = "IMPROVEMENT_FARM");
    -----------


    Thanks!
     
  7. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,585
    Sorry Nutty, got busy with other things and forgot. I'll post some example SQL this weekend

    I hate to state the obvious, but if the tables contain the data that your SQL is supposed to add, then your SQL must be working. Something else is wrong. Perhaps what you are putting in the tables. I'm not spotting it now but I'll look again over the weekend.

    As I said in one of the dozen posts above, I've been checking "Reload Landmarks" in the mod properties since I've been doing this. Since I haven't gone back and tried unchecking it again, I have no idea whether this might matter.

    My only comments on your SQL are stylistic (for now). As I said above, if the changes you want are acurately relfected in the DB tables, then it must be working.
    1) You don't need to quote tables and columns that are already defined. I.e., no quotes needed in the "INSERT" line. For that matter, you should not use double quotes at all in SQLite.
    2) You can add many rows after an INSERT statement as explained here. You'll see that a lot in my example SQL, with whole tables (>100 rows) added by a single INSERT. It cuts the lines in half and makes it more readable.
    3) I see 0 in at least one place that should be NULL (PrereqTech). This might work but it is not what you see in the core tables so you should avoid it. (On the other hand, true and false are entered as 1 and 0 which you have done correctly.)
     
  8. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    2,990
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    No worries!

    Well, that was easy.

    Spoiler :


    Of course it matters. Duh! I was having CTDs with it on (turns out CiV didn't like the model), so I turned it off while troubleshooting, and never turned it back on.

    Thanks for the SQL style tips.

    Based on my playing around with this, I uploaded a tiny mod, Smaller Landmarks, that shrinks down resources, features, and improvements to better mesh with R.E.D. unit scaling.

    Unfortunately, it really looks like SQL alone doesn't cut it for units.
     
  9. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,585
    Glad to see its working for someone else. Too bad units seem to work differently.

    Per your request, I've posted some example SQL in my tutorial here (not really related to the present thread).
     
  10. human machine

    human machine Chieftain

    Joined:
    Jan 25, 2009
    Messages:
    32
    Tried this last weekend, had no luck (Build resulted in a empty tile, but tool tip was there).
    BUT with "Reload Landmarks" on, I've been able to replicate your results
    Cool Find!
    now to see if I can import a civ4 improvement...
     

    Attached Files:

  11. Putmalk

    Putmalk Chieftain

    Joined:
    Sep 26, 2010
    Messages:
    2,613
    Location:
    New York
    I believe Reload Landmarks is known to cause crashes. Ask Spatz about it.
     
  12. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,585
    I remember him saying something like that too. It would be nice if he elaborated here.

    However, it does seem like we've figured out its function. I can't go back to not adding improvements now.

    @Nutty, Just out of curiosity, did you have the "Reload Unit System" checked when you failed to add unit art?
     
  13. FiresForever

    FiresForever Chieftain

    Joined:
    Sep 30, 2010
    Messages:
    584
  14. Pouakai

    Pouakai It belongs in a museum. Moderator

    Joined:
    Jun 16, 2010
    Messages:
    7,110
    Location:
    Aotearoa
    I used to check 'Reload Landmark System' when making the wonders, but since I stopped I've had nowhere near the number of crashes I used to
     
  15. Hulfgar

    Hulfgar Chieftain

    Joined:
    Mar 31, 2008
    Messages:
    1,790
    Gender:
    Male
    Location:
    France
    'Reload Landmark System' is known to cause random crashes when a unit is moving.

    I had the same problem as Pouakai : from the day I checked it my mod would crash randomly, it has stopped since I have unchecked Reload Landmark System.

    This function may have some utility perhaps included for a later use, but as with a lot of things in Civ 5 modding it seems to be bugged or unusable.
     
  16. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,585
    Well, it may be fixed. Or not. The patch notes don't always help in these cases. What I can say is that I haven't seen any crashes like that lately. However, I've been doing a lot of Lua coding/debugging so I rarely get past turn 10.
     
  17. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    2,990
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Unfortunately (for the sake of an easy fix), yes.

    EDIT: And with the crazy idea that the unit system really was totally opposite the landmark system, I just tried, and it doesn't work with it unchecked, either.
     
  18. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,033
    Location:
    San Diego, California
    I messed A LONG time ago with trying to add the pyramids as an improvement or even just adding a wonder. The big difference between Civ4 TIs/Wonders/Buildings and Civ5 is that the Civ5 ones appear to have a skeleton.

    You are probably getting the unfinished wonder graphic because you are using the original fxsxml which calls for both gr2s and is handled by the wonder generator. So if you create a new fxsxml using only the inished wonder gr2 you'll get the finished wonder.

    Not to distract you but (I can't confirm where) I heard that the code to make cottages grow from Civ4 is still in the civ5 code. So its possible to bring those growing tiles back. So you could possible switch the tradepost graphics with cities graphics and have it grow (until someone imports the civ4 graphics).

    On another note you can add TIs but does this mean you can add new wonder graphics too? do they look to be handled the same?

    Finally, your opening posts makes it sound like you found a bug in the database handling. Is that the case?
     
  19. Sneaks

    Sneaks Brooklyn Bum

    Joined:
    Oct 15, 2010
    Messages:
    1,877
    Location:
    NYC
    I can confirm the growth function on improvements still works. I have created forts that grow into citadels after X number of turns
     
  20. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,033
    Location:
    San Diego, California
    do you have that in a mod somewhere?
     

Share This Page