1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Need some fresh eyes...or maybe a brain

Discussion in 'Mod Creation Help' started by Chad Darden, Dec 31, 2017.

  1. Chad Darden

    Chad Darden Chieftain

    Joined:
    Dec 30, 2017
    Messages:
    8
    Gender:
    Male
    Can someone please look at this and tell me what's wrong, cuz I'm at a loss. Am I crazy or is it right there in traits with no syntax error?

    [2943265.934] [Gameplay] ERROR: near "INSERT": syntax error
    [2943265.935] [Gameplay] ERROR: FOREIGN KEY constraint failed
    [2943265.935] [Gameplay] ERROR: FOREIGN KEY constraint failed
    [2943265.935] [Gameplay]: Validating Foreign Key Constraints...
    [2943265.936] [Gameplay] ERROR: Invalid Reference on Buildings.TraitType - "TRAIT_CIVILIZATION_BUILDING_CLD_ALAMO" does not exist in Traits
    [2943265.948] [Gameplay]: Failed Validation.

    Code:
    <Row BuildingType="BUILDING_CLD_ALAMO" Name="LOC_BUILDING_CLD_ALAMO_NAME" Description="LOC_BUILDING_CLD_ALAMO_DESCRIPTION" PrereqTech="TECH_MILITARY_ENGINEERING" PrereqDistrict="DISTRICT_ENCAMPMENT" PurchaseYield="YIELD_GOLD" Cost="195" AdvisorType="ADVISOR_CONQUEST" Maintenance="0" CitizenSlots="1" TraitType="TRAIT_CIVILIZATION_BUILDING_CLD_ALAMO"/>
    Code:
    INSERT INTO Types
            (Type,                                                    Kind)
    VALUES    ('TRAIT_CIVILIZATION_CLD_DONT',                            'KIND_TRAIT'),
            ('TRAIT_CIVILIZATION_BUILDING_CLD_ALAMO',                'KIND_TRAIT');
    --------------------------------------------------------------------------------------------------------------------------           
    -- Traits           
    --------------------------------------------------------------------------------------------------------------------------               
    INSERT INTO Traits               
            (TraitType,                                                    Name,                                                Description)
    VALUES    ('TRAIT_CIVILIZATION_CLD_DONT',                            'LOC_TRAIT_CIVILIZATION_CLD_DONT_NAME',                    'LOC_TRAIT_CIVILIZATION_CLD_DONT_DESCRIPTION'),
            ('TRAIT_CIVILIZATION_BUILDING_CLD_ALAMO',                'LOC_TRAIT_CIVILIZATION_BUILDING_CLD_ALAMO_NAME',        'LOC_TRAIT_CIVILIZATION_BUILDING_CLD_ALAMO_DESCRIPTION');
     
  2. Cagarustus

    Cagarustus Chieftain

    Joined:
    Mar 9, 2017
    Messages:
    125
    It seems there's an error with you Buildings code. You've put 'TraitType' in the Building code.

    What you need to do is use BuildingModifiers (BuildingType, ModifierId).... I think.

    Have a look at the code for buildings of Civilizations, and use them as a guide.

    Also, my suggestion is to use one type of code. You've used XML in one, and SQL in another. I would use SQL instead, as it's more flexible than XML.
     
  3. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    5,141
    Location:
    Illinois, USA
    TraitType is a valid column in table Buildings.
    Code:
    <Row BuildingType="BUILDING_STAVE_CHURCH" Name="LOC_BUILDING_STAVE_CHURCH_NAME"
    Description="LOC_BUILDING_STAVE_CHURCH_DESCRIPTION" PrereqCivic="CIVIC_THEOLOGY"
    PrereqDistrict="DISTRICT_HOLY_SITE" PurchaseYield="YIELD_GOLD"
    Cost="120" AdvisorType="ADVISOR_RELIGIOUS" Maintenance="2"
    CitizenSlots="1" TraitType="TRAIT_CIVILIZATION_BUILDING_STAVE_CHURCH"/>
    --------------------------------------------------------------------------------------

    The issue is a syntax error in the SQL file where the Trait is defined. The entire file would be needed in order to spot the error because as it is I cannot see it.

    Do note however that you will also sometimes get "syntax" errors for errors in filenames of the mod or for errors related to action names in the modinfo file of the mod. These are file loading errors but they sometimes show as syntax errors in database.log

    You need to inspect modding.log and ensure that the SQL file is even being loaded at all, and if it is then you need to look upfile from the code you've posted for the syntax error if the game appears to be attempting to load the file.
     
  4. Chad Darden

    Chad Darden Chieftain

    Joined:
    Dec 30, 2017
    Messages:
    8
    Gender:
    Male
    Code:
    [2998898.540] Status: Creating database save point.
    [2998898.540] Status: UpdateDatabase - Loading Core/CLD_Buildings.xml
    [2998898.541] Status: UpdateDatabase - Loading Core/CLD_Leaders.xml
    [2998898.542] Status: UpdateDatabase - Loading Core/Joshs_Template_GameDefines.sql
    [2998898.542] Warning: UpdateDatabase - Error Loading SQL.
    [2998898.542] ERROR: Failed to release save point.
    [2998898.555] Warning: Error when calling IComponentHandler::ApplyComponent.
    [2998898.555] Status: Applying Component - NewAction (UpdateText)
    [2998898.556] Status: Creating database save point.
    It is trying to load, so I need to look in buildings.xml or leaders.xml which it loaded first or do you mean in the same file as the code I posted?
     
  5. kingchris20

    kingchris20 Wisdom Seeker

    Joined:
    Jul 30, 2012
    Messages:
    1,274
    Location:
    Resident of Heaven; Currently in the Waiting Room
    is that from your database.log?

    Looks like you have 2 XMLs and 1 SQL, and the error states error loading SQL, so I would think the error is in Joshs_Template SQL somewhere.
     
  6. Chad Darden

    Chad Darden Chieftain

    Joined:
    Dec 30, 2017
    Messages:
    8
    Gender:
    Male
    Well, not sure what exactly did it but its working now. I think it may have been a duplicate entry for the Rough Rider as Civ trait and Leader trait. Thanks for the help guys. Now to test it and make sure the traits actually work.
     

Share This Page