[GS] What did I do wrong?

OmarWeber

Chieftain
Joined
Aug 5, 2020
Messages
17
This is a very simple mod to change unique unit stats but I am not sure what I did wrong.
So here is the script. I am so new to this, sorry for trouble!

SQL
Code:
UPDATE Units
SET Combat = 50,
SET RangedCombat = 60,
SET BaseMoves = 5,
WHERE UnitType = 'UNIT_OTTOMAN_BARBARY_CORSAIR';
Modinfo
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="e9556fe0-a8ea-4343-a744-849d99b48089" version="1">
  <Properties>
    <Name>BARBARYCORSAIR</Name>
    <Description>BARBARYCORSAIR BUFF</Description>
    <Teaser>BARBARYCORSAIR BUFF</Teaser>
    <Authors>EG</Authors>
  </Properties>
  <InGameActions>
    <UpdateDatabase id="Units">
      <File>BARBARY_CORSAIR.sql</File>
    </UpdateDatabase>
  </InGameActions>
  <Files>
    <File>BARBARY_CORSAIR.sql</File>
  </Files>
</Mod>
 
Last edited:
Your SQL syntax is incorrect
Code:
UPDATE Units SET Combat = 50, RangedCombat = 60, BaseMoves = 5 WHERE UnitType = 'UNIT_OTTOMAN_BARBARY_CORSAIR';
or
Code:
UPDATE Units
SET Combat = 50,
RangedCombat = 60,
BaseMoves = 5
WHERE UnitType = 'UNIT_OTTOMAN_BARBARY_CORSAIR';
But not the incorrect syntax of more than one "SET" command within the same UPDATE. You also had I think an extra comma in there just before the "WHERE" statement.

Your InGame Action also has no LoadOrder value, so it is also possible that your Update command is being executed before the expansion adds the UNIT_OTTOMAN_BARBARY_CORSAIR to the game. In such cases the Update command does not cause errors to be generated, but it also does nothing because at the time the Update executes there is nothing within the database that matches to the "WHERE" clause.
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="e9556fe0-a8ea-4343-a744-849d99b48089" version="1">
  <Properties>
    <Name>BARBARYCORSAIR</Name>
    <Description>BARBARYCORSAIR BUFF</Description>
    <Teaser>BARBARYCORSAIR BUFF</Teaser>
    <Authors>EG</Authors>
  </Properties>
  <InGameActions>
    <UpdateDatabase id="Units">
      <Properties>
        <LoadOrder>300</LoadOrder>
      </Properties>
      <File>BARBARY_CORSAIR.sql</File>
    </UpdateDatabase>
  </InGameActions>
  <Files>
    <File>BARBARY_CORSAIR.sql</File>
  </Files>
</Mod>
A LoadOrder value of 300 is high enough to ensure your code loads into the database after all the Expansions and DLC content. It is also low enough to be friendly to other mods that make balance-changes game-wide and the like and which generally are given a higher LoadOrder value by the maker of such mods to ensure their code loads into the database after all other mods have added content.
 
Last edited:
Top Bottom