Cannot get custom unit to work

craigman1211

Chieftain
Joined
Oct 30, 2014
Messages
6
Okay so here is the deal, I am trying to make my own unit, I have found all of the snippets I need I think and have been closing all of my loose ends, but for some reason I cannot seem to get it to work. I have been working on it for a few days and its finally time to ask for help. I have managed to get it down to only a few errors.

[98070.012] Database::XMLSerializer (Debug/Bug_Artifact.xml): 'Row' or 'Delete' expected, got 'Resources'.
[98070.278] Database::XMLSerializer (Hero/Gunman_Hero_Art.xml): 'Row' or 'Delete' expected, got 'Type'.
[98070.278] Database::XMLSerializer (Hero/Gunman_Hero_Member_Art.xml): 'Row' or 'Delete' expected, got 'Type'.
[98070.278] Database::XMLSerializer (Hero/Gunman_Cargo.xml): 'Row' or 'Delete' expected, got 'update'.
[98072.306]

and some resource artifact bug that has nothing to do with my mod as I re-installed civ and it still showed up even without my mod being active.

[98099.606] no such column: RESOURCECLASS_ARTIFACT
[98099.606] In Query - select * from ResourceClasses where RESOURCECLASS_ARTIFACT

Included is the log file and the mod I have been working on. Please note, the active files in this are the ones in the Hero Directory and the DEbugging directory.

The database log is on the first level of the zip.

If someone could help me figure this out I would really appreciate it.
 

Attachments

  • Survivalv0_1.zip
    790.7 KB · Views: 66
The errors are saying exactly what they sound like. You need <GameData><TableName><Action><Column/ActionClause> in that order, and they must be capitalized. See this cheat sheet.

Your Bug_Artifact.xml syntax is bad, but let's not worry about it since it wouldn't have helped anything anyway. The "resource artifact bug" is just Firaxis sloppiness; the error message is present even when no mods are active, doesn't hurt anything, and you can't do anything about it.
 
I may be wrong (I'm new, but i like to help out :p) but i do believe you're getting these issues because you're not using the <Row> tag when adding to a database. for instance, your GUNMAN_HERO_ART.xml starts off with the UnitArtInfo tag, but goes straight into a <Type> tag, instead of <Row>.You'll want to do it like this:

Code:
<TableType>
  <Row>
    <Tag>Information 1</Tag>
  </Row>
  <Row>
    <Tag>Information 2</Tag>
  </Row>
</TableType>


What i see you doing is this:

Code:
<TableType>
  <Tag>Information 1</Tag>
</TableType>
<TableType>
  <Tag>Information 2</Tag>
</TableType>

Hope this helps!
 
But art isn't added as gamedata, from what I understand, <row> and <update> and <gamedata> aren't used because they are not updated into the database they are actually loaded before everything else. Look at the CivBEArtDefines files, none of them use any of those tags.

Maybe I am missing something, do you have any specific suggestions on what I should change?
 
Now how can I express

Spoiler :
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
VALUES ('ART_DEF_UNIT_BARBALIEN_2','ART_DEF_UNIT_MEMBER_BARBALIEN_2_LG',2),
('ART_DEF_UNIT_BARBALIEN_2','ART_DEF_UNIT_MEMBER_BARBALIEN_2',1),
('ART_DEF_UNIT_BARBALIEN_2','ART_DEF_UNIT_MEMBER_BARBALIEN_2_SM',1),
('ART_DEF_UNIT_BARBALIEN_2','ART_DEF_UNIT_MEMBER_BARBALIEN_2',3);

INSERT INTO ArtDefine_UnitInfos (Type, DamageStates, Formation, UnitFlagAtlas, UnitFlagIconOffset, PortraitAtlas, PortraitIndex, PortraitCamera)
VALUES ('ART_DEF_UNIT_BARBALIEN_2',1,'Beetle','UNIT_FLAG_ATLAS',39,'UNIT_ATLAS_1',39,'');

INSERT INTO ArtDefine_UnitMemberCombatWeapons (UnitMemberType, "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag, MissTargetSlopRadius)
VALUES ('ART_DEF_UNIT_MEMBER_BARBALIEN_2',0,0,'',NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'BLUNT','BLUNT',NULL),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2',1,0,'',10,20,NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'FLAMING_ARROW','',10),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_LG',0,0,'',NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'BLUNT','BLUNT',NULL),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_LG',1,0,'',10,20,NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'FLAMING_ARROW','',10),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_SM',0,0,'',NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'BLUNT','BLUNT',NULL),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_SM',1,0,'',10,20,NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'FLAMING_ARROW','',10);

INSERT INTO ArtDefine_UnitMemberCombats (UnitMemberType, EnableActions, DisableActions, MoveRadius, ShortMoveRadius, ChargeRadius, AttackRadius, RangedAttackRadius, MoveRate, ShortMoveRate, TurnRateMin, TurnRateMax, TurnFacingRateMin, TurnFacingRateMax, RollRateMin, RollRateMax, PitchRateMin, PitchRateMax, LOSRadiusScale, TargetRadius, TargetHeight, HasShortRangedAttack, HasLongRangedAttack, HasLeftRightAttack, HasStationaryMelee, HasStationaryRangedAttack, HasStationaryAirAttack, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation, LastToDie, FirstToDie, TurnsInCombatFacing, CityAttackFaceFront, RangedAttackFaceFront)
VALUES ('ART_DEF_UNIT_MEMBER_BARBALIEN_2','Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady Walk AttackCharge Victory AttackSurfaceToAir AttackSurfaceToAir',NULL,NULL,12,NULL,NULL,NULL,NULL,0.35,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_LG','Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady Walk AttackCharge Victory AttackSurfaceToAir AttackSurfaceToAir',NULL,NULL,12,NULL,NULL,NULL,NULL,0.35,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_SM','Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady Walk AttackCharge Victory AttackSurfaceToAir AttackSurfaceToAir',NULL,NULL,12,NULL,NULL,NULL,NULL,0.35,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, OrbitalOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
VALUES ('ART_DEF_UNIT_MEMBER_BARBALIEN_2',0.11,NULL,NULL,'','barbalien2.fxsxml','METAL','EXOSKELETON'),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_LG',0.14,NULL,NULL,'','barbalien2.fxsxml','METAL','EXOSKELETON'),
('ART_DEF_UNIT_MEMBER_BARBALIEN_2_SM',0.095,NULL,NULL,'','barbalien2.fxsxml','METAL','EXOSKELETON');


in xml?
 
You don't need to. You can leave it SQL. But INSERT is <Row>, and each item in parentheses is the code for the order of the value to match to after VALUES. For instance:
Code:
<GameInfo>
    <ArtDefine_UnitInfoMemberInfos>
        <Row>
            <UnitInfoType>ART_DEF_UNIT_BARBALIEN_2</UnitInfoType>
            <UnitMemberInfoType> ART_DEF_UNIT_MEMBER_BARBALIEN_2_LG</UnitMemberInfoType>
            <NumMembers>2</NumMembers>
        </Row>
        <Row>
            <UnitInfoType>ART_DEF_UNIT_BARBALIEN_2</UnitInfoType>
            <UnitMemberInfoType> ART_DEF_UNIT_MEMBER_BARBALIEN_2</UnitMemberInfoType>
            <NumMembers>1</NumMembers>
        </Row>
        <Row>
            <UnitInfoType>ART_DEF_UNIT_BARBALIEN_2_SM</UnitInfoType>
...etc.

EDIT: Anywhere you find a NULL, you can just leave out that column.
 
Got it to show up in the game, success! Thanks a million, I had no idea SQL was so much more powerful!

Okay I have one more issue, I was trying to change my cargo file with sql but I cant figure out where I went wrong, so very close.

This is the Log
[149671.571] near "INSERT": syntax error
[149671.571] no such column: UNIT_HERO_GUNMAN
[149673.552]

This is the Cargo.sql

UPDATE Cargo
SET GrantUnit = UNIT_HERO_GUNMAN
WHERE TYPE = 'CARGO_WEAPONRY'
 
It is so close to debugged, I can feel it.

I am getting this error

[152576.902] near "INSERT": syntax error
[152578.883]

Seeing as the only place I have INSERT is my Gunman_Hero_Art.sql file it must be something in there.

The unit will load, although there are 3 issues, 1 it doesn't change its size or number or units, 2 the portrait for the first upgrade is black, and 3 the entire selection for the second purity rank is just missing so there are only 2 units in the 4th unit upgrade row. Any ideas?
 

Attachments

  • Hero.zip
    8.4 KB · Views: 59
Top Bottom