simple mod simply not working

damocles88

Chieftain
Joined
Dec 10, 2009
Messages
42
So, for my first mod, I thought I'd do something dead simple to get used to the new tools. I'm going to modify the scout properties a little bit. Unfortunately this doesn't seem to work for me.

I created a new mod in modbuddy, set the description etc. Then I created a new xml file, in which I wrote:

Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/30/2010 10:15:12 AM -->
<GameData>
<!-- TODO: Insert table creation example here. -->
<Units>
<Row>
<Class>UNITCLASS_SCOUT</Class>
<Type>UNIT_SCOUT</Type>
<Combat>3</Combat>
<Cost>35</Cost>
<Moves>3</Moves>
<CombatClass>UNITCOMBAT_RECON</CombatClass>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_EXPLORE</DefaultUnitAI>
<Description>TXT_KEY_UNIT_SCOUT</Description>
<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_SCOUT_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_SCOUT_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_SCOUT</Help>
<NoBadGoodies>true</NoBadGoodies>
<Pillage>true</Pillage>
<MilitarySupport>false</MilitarySupport>
<MilitaryProduction>false</MilitaryProduction>
<ObsoleteTech>TECH_SCIENTIFIC_THEORY</ObsoleteTech>
<GoodyHutUpgradeUnitClass>UNITCLASS_ARCHER</GoodyHutUpgradeUnitClass>
<AdvancedStartCost>10</AdvancedStartCost>
<XPValueAttack>2</XPValueAttack>
<XPValueDefense>2</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_SCOUT</UnitArtInfo>
<UnitFlagIconOffset>5</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
<PortraitIndex>5</PortraitIndex>
</Row>
</Units>
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_SCOUT</UnitType>
<PromotionType>PROMOTION_EXTRA_SIGHT_I</PromotionType>
</Row>
</Unit_FreePromotions>
</GameData>

I then added this file to the mod actions as:

OnModActivated - UpdateDatabase - XML/Units/Unit_Scout.xml

and set the Reload Unit checkbox under mod properties. Then build it.

It won't load in game though. It shows up fine in the browser, and I enable it, but in-game the scout is unchanged.

Anyone have any ideas what I'm forgetting to do or doing wrong?

Also, is there a log file somewhere that outputs errors encountered during mod loading? I checked through the logs folder under /user docs/civ5/ but couldn't see anything relevant to mod loading.
 
Ah right, I thought you could just override the data.

In that case, how do I go about adding a free unit promotion using update without wiping out the existing freebies?

edit:

I think I have it figured out, but it's still not showing any changes in the game or in the debug db.

I'm now using an sql file instead of xml, and it is this:

insert Unit_FreePromotions (UnitType, PromotionType) values ("UNIT_SCOUT", "PROMOTION_EXTRA_SIGHT_I");
update Units set Moves='3', Cost='35', MilitarySupport='false', MilitaryProduction='false' where type='UNIT_SCOUT';

I changed the mod action set accordingly, so now I'm at a loss again.
 
Well, I have no idea why the sql files don't work, so now I'm back to using xml, and my xml looks like this:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/30/2010 8:10:00 PM -->
<GameData>
  <!-- TODO: Insert table creation example here. -->
    <Units>
        <Update>
            <Where Type="UNIT_SCOUT"/>
            <Set Moves="3" Cost="35" MilitarySupport="false" MilitaryProduction="false"/>
        </Update>
    </Units>
    <Unit_FreePromotions>
        <Row>
            <UnitType>UNIT_SCOUT</UnitType>
            <PromotionType>PROMOTION_EXTRA_SIGHT_I</PromotionType>
        </Row>
    </Unit_FreePromotions>
</GameData>

So now I'm using update to modify the scout's moves, cost, etc. And adding a row into Unit_FreePromotions to add the extra sight range.

It still doesn't work. I enable the mod and start a game, and nothing. Same old scout. No errors, no warnings, nothing.

What am I doing wrong?

All other mods from everyone else work fine, but for some reason my tiny little mod refuses to load.

And just for reference, my modinfo file as generated by modbuddy:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="3cc36747-c627-4b79-9fcb-b9e71d05c3a9" version="1">
  <Properties>
    <Name>Scouting For Boys</Name>
    <Stability>Alpha</Stability>
    <Description>Improves scouts by making them faster, with better sight range, but weaker - effectively making them non-combat scouting units.  They also cost slightly more.</Description>
    <Authors>Damocles</Authors>
    <SpecialThanks>Firaxis</SpecialThanks>
    <AffectsSavedGames>0</AffectsSavedGames>
    <SupportsSinglePlayer>1</SupportsSinglePlayer>
    <SupportsMultiplayer>1</SupportsMultiplayer>
    <SupportsMac>1</SupportsMac>
    <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
    <ReloadUnitSystem>1</ReloadUnitSystem>
  </Properties>
  <Dependencies />
  <References />
  <Blocks />
  <Files>
    <File md5="55AFEA91AE83F78EF51946F4EB8488E2">Unit_Scout.xml</File>
  </Files>
  <Actions>
    <OnModActivated>
      <UpdateDatabase>Unit_Scout.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>
</Mod>
 
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/30/2010 8:10:00 PM -->
<GameData>
  <!-- TODO: Insert table creation example here. -->
    <Units>
        <Update>
            <Where Unit="UNIT_SCOUT"/>
            <Set Moves="3" Cost="35" MilitarySupport="false" MilitaryProduction="false" Unit_FreePromotions="PROMOTION_EXTRA_SIGHT_I"/>
        </Update>
    </Units>    
</GameData>

maybe try this but I'm not completely sure.
 
Try putting your sets before the wheres. The xml file is used to generate sql code at runtime, and sql is very picky about the order of the statements. It needs to be told WHAT to do first, and WHERE second.
 
thats not the problem, the sets and where's can be reversed with no effect.
 
I'm not at my machine right now, but I see in the ModdersGuide that the Update examples never actually change more than one feature at a time. That might be a limitation of the xml implementation.

Try a series of Updates, each changing just one variable.
 
Ok I think I spotted the error.

The Units table doesn't contain a field called "Unit."

You're using <Where Unit="UNIT_SCOUT"/>

but you should probably be using Class or Type instead of Unit.
 
OnModActivated - UpdateDatabase - XML/Units/Unit_Scout.xml

Is that the actual folder of your file inside the ModBuddy project root, or are you emulating the core XML files' folder structure when yours don't have it?
 
Is that the actual folder of your file inside the ModBuddy project root, or are you emulating the core XML files' folder structure when yours don't have it?

Originally, yes it was my folder structure in which I emulated the civ folders. Now though, in the latest version (see my 3rd post in this thread) I'm not using any folders. Trying to keep things simple to find the problem.

I'm not at my machine right now, but I see in the ModdersGuide that the Update examples never actually change more than one feature at a time. That might be a limitation of the xml implementation.

Try a series of Updates, each changing just one variable.

BAM! We have a winner. Thanks Merak, this was the problem.

edit: just for reference for anyone else with the same problem. I did some testing:

You can NOT use:


Although...

I'm curious as to why the .sql version I tried didn't work. Maybe it's the same problem and the sql files aren't using true sql, but some dodgy scripted version of it. I might have to do some testing on that.

edit:

Just for reference, I did some testing, and it seems you can NOT use:

Code:
<Update>
            <Where Type="UNIT_SCOUT"/>
            <Set Moves="3"/>
            <Set Cost="35"/>
            <Set MilitarySupport="false"/>
            <Set MilitaryProduction="false"/>
        </Update>

You have to use:

Code:
<Update>
            <Where Type="UNIT_SCOUT"/>
            <Set Moves="3"/>
        </Update>
        <Update>
            <Where Type="UNIT_SCOUT"/>
            <Set Cost="35"/>
        </Update>
        <Update>
            <Where Type="UNIT_SCOUT"/>
            <Set MilitarySupport="false"/>
        </Update>
        <Update>
            <Where Type="UNIT_SCOUT"/>
            <Set MilitaryProduction="false"/>
        </Update>

Which is a nice and very long winded approach. I just hope I can figure out why the .sql approach isn't working, that'll be a much faster approach.

edit: edit:

It seems SQL works fine, it's me that's broken :) I forgot the INTO after the INSERT token, so I guess the sql engine stops parsing the entire script on the first error. Might be time to invest in a decent SQL manager/query editor to catch these mistakes in advance...
 
Actually, you can use:

<Update>
<Where Type="UNIT_SCOUT"/>
<Set Moves="3" Cost="35" MilitarySupport="false" MilitaryProduction="false" />
</Update>

This. I was struggling with this for several days until I tried this and it worked!
 
Actually, you can use:

<Update>
<Where Type="UNIT_SCOUT"/>
<Set Moves="3" Cost="35" MilitarySupport="false" MilitaryProduction="false" />
</Update>

That's what I thought, until I tried it. If you look at my third post in this thread, that's exactly how I had my xml, but it would not work. Once I swapped over to individual <update> tags for each field, it worked fine. Then I abandoned it completely, as using a sql file for multiple updates is much faster to write and execute. You only need to use xml to create new rows, but for changing existing rows, using sql is better/easier/faster.
 
thats not exactly what you had though ;)
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/30/2010 8:10:00 PM -->
<GameData>
  <!-- TODO: Insert table creation example here. -->
    <Units>
        <Update>
            <Where Type="UNIT_SCOUT"/>
            <Set Moves="3" Cost="35" MilitarySupport="false" MilitaryProduction="false"/>
        </Update>
    </Units>
    <Unit_FreePromotions>
        <Row>
            <UnitType>UNIT_SCOUT</UnitType>
            <PromotionType>PROMOTION_EXTRA_SIGHT_I</PromotionType>
        </Row>
    </Unit_FreePromotions>
</GameData>
 
Maybe I'm blind or stupid, but I'm not seeing any difference. Unless you're referring to the promotions row addition below the update, but that bit works fine. The problem lay in using the set token to do multiple updates on one line.
 
Weird indeed, sorry I had not seen that's what you had. I'm going to start doing more SQL too, I guess.

Could you post your SQL version just for the record? I prefer to have a scaffolding base upon which to work ;)
 
Back
Top Bottom