Unit Art Define - More than one

Have you enabled Reload Unit System in your mod. The spearman unit I have noticed is the fall-back unit when the game does not have the required art files.
 
Totally forgot about that. Now when I create the unit the game crashes :confused:

I'm pretty sure you don't want your NumMembers entries to have "" quotes around them (e.g., ("6") should just be 6 ).

EDIT: Note that the parentheses should be OK, but they're just there to highlight where you've made changes.

Also, make sure your art files (.fxsxml, .dds, and .gr2) are set to VFS=true. EDIT: Never mind, you're reusing vanilla art (for now)...
 
I'm pretty sure you don't want your NumMembers entries to have "" quotes around them (e.g., ("6") should just be 6 ).

EDIT: Note that the parentheses should be OK, but they're just there to highlight where you've made changes.

Also, make sure your art files (.fxsxml, .dds, and .gr2) are set to VFS=true. EDIT: Never mind, you're reusing vanilla art (for now)...

Ok didn't knew about that

But I have another mod that uses a similar sql and it includes the ""...
So I believe it's the code in the sql files that is wrong...
 
Did you enable logging? Does your database.log report any errors (other than the ones reported by the original game)?

Also, post your built mod rather than just the .SQL files.

yes I've and I don't find any error related to this mod
I've attached the mod, the Ranger was the last change, everything else works fine

PS: the attacehd mod doesn't include the sql files, I've forgot that had changed the mod so I could use it
 

Attachments

  • Units Compendium.rar
    412.9 KB · Views: 34
I don't know where you copied/edited the SQL from, but it is a very poor example of SQL

  • Table names should not be quoted
  • Column names should not be quoted, (unless the DB designer was bad and used a reserved word as a column name - eg index needs to be "index")
  • Literal text should be single quoted, not double quoted in brackets.
  • Literal numbers should just be given "as is"
So it's not

Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type', 'DamageStates', 'Formation')
	SELECT	("ART_DEF_UNIT_RANGER"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_SWORDSMAN");

but

Code:
INSERT INTO ArtDefine_UnitInfos (Type, DamageStates, Formation)
	SELECT 'ART_DEF_UNIT_RANGER', DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE Type='ART_DEF_UNIT_SWORDSMAN';

nor

Code:
INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
	SELECT	("ART_DEF_UNIT_RANGER"), ("ART_DEF_UNIT_MEMBER_RANGER"), ("6")
	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_RANGER_SWORD");

INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
	SELECT	("ART_DEF_UNIT_RANGER"), ("ART_DEF_UNIT_MEMBER_RANGER"), ("6")
	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_RANGER_BOW");

but

Code:
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
	SELECT	'ART_DEF_UNIT_RANGER', 'ART_DEF_UNIT_MEMBER_RANGER', 6
	FROM ArtDefine_UnitInfoMemberInfos WHERE UnitInfoType='ART_DEF_UNIT_RANGER_SWORD';

INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
	SELECT 'ART_DEF_UNIT_RANGER', 'ART_DEF_UNIT_MEMBER_RANGER', 6
	FROM ArtDefine_UnitInfoMemberInfos WHERE UnitInfoType='ART_DEF_UNIT_RANGER_BOW';

The last two statements will only insert rows depending on the execution order of the three SQL files - which is why it is more important to attach completed mods than individual files, the error may actually be in the .modinfo file.

Given that the last two statements only insert literal values, I doubt you actually want the SELECT ... FROM .. WHERE sub-clauses, but just want

Code:
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
	VALUES('ART_DEF_UNIT_RANGER', 'ART_DEF_UNIT_MEMBER_RANGER', 6);

INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
	VALUES('ART_DEF_UNIT_RANGER', 'ART_DEF_UNIT_MEMBER_RANGER', 6);

RangerBow.sql should be

Code:
INSERT INTO ArtDefine_UnitInfos (Type, DamageStates, Formation)
	SELECT	'ART_DEF_UNIT_RANGER_BOW', DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE Type = 'ART_DEF_UNIT_U_ENGLISH_LONGBOWMAN';
	
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	VALUES('ART_DEF_UNIT_RANGER_BOW', 'ART_DEF_UNIT_MEMBER_RANGER_BOW', 12);
	
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, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation)
	SELECT	'ART_DEF_UNIT_MEMBER_RANGER_BOW', 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, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation
	FROM ArtDefine_UnitMemberCombats WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_U_ENGLISH_LONGBOWMAN';
	
INSERT INTO ArtDefine_UnitMemberCombatWeapons (UnitMemberType, "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag)
	SELECT 'ART_DEF_UNIT_MEMBER_RANGER_BOW', "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberCombatWeapons WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_U_ENGLISH_LONGBOWMAN';
	
INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	'ART_DEF_UNIT_MEMBER_RANGER_BOW', Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE Type = 'ART_DEF_UNIT_MEMBER_U_ENGLISH_LONGBOWMAN';

You'll need to fix RangerSword.sql in a similar manner.

That should then get you all the entries into the DB tables. Whether that fixes the issue I can't tell as you only posted half a mod and some disconnected SQL files. If it doesn't a) check the database.log files for errors and b) post the COMPLETE mod and not just parts of it.
 
I don't know where you copied/edited the SQL from, but it is a very poor example of SQL

  • Table names should not be quoted
  • Column names should not be quoted, (unless the DB designer was bad and used a reserved word as a column name - eg index needs to be "index")
  • Literal text should be single quoted, not double quoted in brackets.
  • Literal numbers should just be given "as is"

I've based my sql on the sql from a unit in a mod I had downloaded, thanks for the tips. I'll rewrite the code.

That should then get you all the entries into the DB tables. Whether that fixes the issue I can't tell as you only posted half a mod and some disconnected SQL files. If it doesn't a) check the database.log files for errors and b) post the COMPLETE mod and not just parts of it.

a) I'm sure the problem is in the sql, database.log showed nothing.
b) Yeah, my bad... I'll try to fix it, if I fail I'll post the complete mod.

Thanks
 
I've applied your recommended changes. Game crashes after starting to construct the unit.
Searched the database.log, the only possible reference is the following:
[3028.525] constraint failed
[3028.525] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'

I've attached the mod
 

Attachments

  • Ranger Unit (v 1).rar
    314.5 KB · Views: 45
You have defined three models - Ranger Sword (a copy of the Swordsman), Ranger Bow (a copy of the Longbowman) and Ranger (which has no members). It has no members partly because the SQL is wrong, but even if it wasn't the load order of the SQL files is incorrect and would still cause it to break.

What you actually want is one model, using the members from the Swordsman and Longbowman units. So you need to delete the SQL that adds the extra unit formations and move the members into the (incorrect) ranger unit formation.



If you put all the SQL for one unit formation into one SQL file, it is much easier to see the errors, and also forces the correct execution order. So delete the RangerBow and RangerSword SQL files, and put it all into the RangerArt file

EDIT: If you're not going to change the 3d models for the swordsmen and longbowmen, you only really need the top three SQL statements, and refer to the original swordsmen and longbowmen members

Code:
INSERT INTO ArtDefine_UnitInfos (Type, DamageStates, Formation)
	SELECT 'ART_DEF_UNIT_RANGER', DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE Type='ART_DEF_UNIT_SWORDSMAN';

-- 6 sword members
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
	VALUES('ART_DEF_UNIT_RANGER', 'ART_DEF_UNIT_MEMBER_RANGER_SWORD', 6);

-- 6 bow members
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType, UnitMemberInfoType, NumMembers)
	VALUES('ART_DEF_UNIT_RANGER', 'ART_DEF_UNIT_MEMBER_RANGER_BOW', 6);


-- Ranger sword member - based on the Swordsman
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, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation)
	SELECT	'ART_DEF_UNIT_MEMBER_RANGER_SWORD', 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, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation
	FROM ArtDefine_UnitMemberCombats WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_SWORDSMAN';
	
INSERT INTO ArtDefine_UnitMemberCombatWeapons (UnitMemberType, "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag)
	SELECT 'ART_DEF_UNIT_MEMBER_RANGER_SWORD', "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberCombatWeapons WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_SWORDSMAN';
	
INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	'ART_DEF_UNIT_MEMBER_RANGER_SWORD', Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE Type = 'ART_DEF_UNIT_MEMBER_SWORDSMAN';

	
-- Ranger bow member - based on the Longbowman
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, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation)
	SELECT	'ART_DEF_UNIT_MEMBER_RANGER_BOW', 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, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation
	FROM ArtDefine_UnitMemberCombats WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_U_ENGLISH_LONGBOWMAN';
	
INSERT INTO ArtDefine_UnitMemberCombatWeapons (UnitMemberType, "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag)
	SELECT 'ART_DEF_UNIT_MEMBER_RANGER_BOW', "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberCombatWeapons WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_U_ENGLISH_LONGBOWMAN';
	
INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	'ART_DEF_UNIT_MEMBER_RANGER_BOW', Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE Type = 'ART_DEF_UNIT_MEMBER_U_ENGLISH_LONGBOWMAN';
 
Back
Top Bottom