Add a new unit in the game (using SQL)

There doesn't seem to be much posts here lately but I could use some help with a unit of mine.

I'm using danrell's Hospitaller Knight model for a Knight UU for a custom civ I'm making.

All these files were downloaded and I imported them into my mod and set VFS=True for all of them just like the guide says.
Code:
Knight_Hospitaller.blend
Knight_Hospitaller.dds
Knight_Hospitaller.fxsxml
Knight_Hospitaller.gr2
Knight_Hospitaller_gloss.dds
Knight_Hospitaller_Horse.dds
Knight_Hospitaller_Horse_gloss.dds

Then I copied your SQL art defines entry and changed it accordingly to match my unit:

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

INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	SELECT	('ART_DEF_UNIT_GURRA_KNIGHT_STJOHN'), ('ART_DEF_UNIT_MEMBER_GURRA_KNIGHT_STJOHN'), NumMembers
	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_KNIGHT');

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_GURRA_KNIGHT_STJOHN'), 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_KNIGHT');

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_GURRA_KNIGHT_STJOHN'), "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_KNIGHT');

INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	('ART_DEF_UNIT_MEMBER_GURRA_KNIGHT_STJOHN'), Scale, ZOffset, Domain, ('Knight_Hospitaller.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_KNIGHT');

INSERT INTO ArtDefine_StrategicView (StrategicViewType, TileType, Asset )
	SELECT	('ART_DEF_UNIT_GURRA_KNIGHT_STJOHN'), TileType, Asset
	FROM ArtDefine_StrategicView WHERE (StrategicViewType = 'ART_DEF_UNIT_KNIGHT');

But the horse doesn't show up! :confused: The model for the men works just fine but they are walking around on their feet instead of riding a horse. :confused:
Spoiler picture of horseless knights (the ones with a Maltese cross as unit flag) :
 
Did you check the box in ModBuddy for "Reload Unit System" ?

Snipped from my Common Novice-Modder Mistakes Thread:

(5) NOT CHECKING THE REQUIRED MODBUDDY CHECK-BOXES

When adding audio files, unit graphics, or stategic-view icons (for units) you need to check certain checkboxes in Modbuddy in order for the game to know that it should, for lack of a better description, "re-initialise" certain game "Systems". Checking the check-boxes tells the game to do so when the mod gets loaded. This is where the checkboxes are located within Modbuddy:

Spoiler :


You will have to scroll down once you select the "MOD Info" tab. Some mod-creators always check the four boxes regardless of whether they are adding an element that will require it: so far as I know there's no downside to this method of dealing with the check-boxes.​
 
Thanks! That was exactly the problem. I've made mods before with custom unit models and it didn't even occur to me to check that..
Spoiler knights who finally have their horsie friends back :
 
Hello, I'm planning on adding some mods made on here, (vet modders, go ahead, get your "Pfff... NOOB" chuckle over with) but I'm having with Step Two of the tutorial. So the above template's need for the purpose of adding mods, I understand. So where is an example of the "Game Rules (SQL)" for me to start with?

Pardon me, everyone. Took a few moments of orienting myself with the ModBuddy system (having never used it before). Got it. Thanks anyways.
 
Hi
After reading Kael's guide, ( good part of it )
after rereading this thread few times,and some others, i started my project, adding 1 new unit to game as a new unitclass (Danrel's early maceman )
I got the unit in the game, well firt tried i put WARRIOR as the template unit then the maceman was a spearman, then i redo it using spearman as template, then it was ok. a real maceman with maceman animation.
Problem is, The maceman is only available in IGE editor, and cannot build with any civ, and i cant see it anywher in tech tree

Hers my SQL

Code:
-- Insert SQL Rules Here 
INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
	SELECT	('ART_DEF_UNIT_EARLY_MACEMAN'), DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_SPEARMAN');
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	SELECT	('ART_DEF_UNIT_EARLY_MACEMAN'), ('ART_DEF_UNIT_MEMBER_EARLY_MACEMAN'), NumMembers
	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_SPEARMAN');
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_EARLY_MACEMAN'), 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_SPEARMAN');
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_EARLY_MACEMAN'), "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_SPEARMAN');
INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	('ART_DEF_UNIT_MEMBER_EARLY_MACEMAN'), Scale, ZOffset, Domain, 
			('early_maceman.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_SPEARMAN');

INSERT INTO UnitClasses (Type, Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, DefaultUnit )
	SELECT ('UNITCLASS_EARLY_MACEMAN'), Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, ('UNIT_BIPLAN')
	FROM UnitClasses WHERE (Type = 'UNITCLASS_SPEARMAN');

INSERT INTO Units (Type, Description, Civilopedia, Strategy, Help, Requirements, Combat, RangedCombat, Cost, Moves, Immobile, Range, BaseSightRange, Class, Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, WorkRate, NumFreeTechs, RushBuilding, BaseHurry, HurryMultiplier, BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness, UnitArtInfo, UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate, UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas)
	SELECT	('UNIT_EARLY_MACEMAN'), ('EARLY_MACEMAN'), Civilopedia, Strategy, Help, Requirements,
			(13), RangedCombat, (66), Moves, Immobile, Range, BaseSightRange, ('UNITCLASS_EARLY_MACEMAN'), Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, WorkRate, NumFreeTechs, RushBuilding, BaseHurry, HurryMultiplier, BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness,
			('ART_DEF_UNIT_EARLY_MACEMAN'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
			UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
	FROM Units WHERE (Type = 'UNIT_SPEARMAN');

INSERT INTO Unit_AITypes (UnitType, UnitAIType)
	SELECT ('UNIT_EARLY_MACEMAN'), UnitAIType
	FROM Unit_AITypes WHERE (UnitType = 'UNIT_SWORDSMAN');

INSERT INTO Unit_ClassUpgrades (UnitType, UnitClassType)
	SELECT ('UNIT_EARLY_MACEMAN'), UnitClassType
	FROM Unit_ClassUpgrades WHERE (UnitType = 'UNIT_SWORDSMAN');

INSERT INTO Unit_Flavors (UnitType, FlavorType, Flavor)
	SELECT ('UNIT_EARLY_MACEMAN'), FlavorType, Flavor
	FROM Unit_Flavors WHERE (UnitType = 'UNIT_SWORDSMAN');

INSERT INTO Unit_FreePromotions (UnitType, PromotionType)
	SELECT ('UNIT_EARLY_MACEMAN'), PromotionType
	FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_SWORDSMAN');

INSERT INTO Unit_ResourceQuantityRequirements (UnitType, ResourceType, Cost)
	SELECT ('UNIT_EARLY_MACEMAN'), ResourceType, Cost
	FROM Unit_ResourceQuantityRequirements WHERE (UnitType = 'UNIT_SPEARMAN');

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/3/2015 11:00:06 PM -->
<GameData>
	
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_EARLY_MACEMAN</UnitType>
			<PromotionType>PROMOTION_ATTACK_BONUS</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_EARLY_MACEMAN</UnitType>
			<PromotionType>PROMOTION_FOREIGN_LANDS</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_EARLY_MACEMAN</UnitType>
			<PromotionType>PROMOTION_STRONGER_VS_DAMAGED</PromotionType>
		</Row>
	</Unit_FreePromotions>

	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_BARBARIAN</CivilizationType>
			<UnitClassType>UNITCLASS_EARLY_MACEMAN</UnitClassType>
			<UnitType/>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_MINOR</CivilizationType>
			<UnitClassType>UNITCLASS_EARLY_MACEMAN</UnitClassType>
			<UnitType/>
		</Row>
	</Civilization_UnitClassOverrides>
	
</GameData>

xml: after first failed i tried putting the xml element of RANGEDSCOUT mod, inside my mod, trying to civclassoverides all civ, ( minors ???? )

and also add some new promotion, i puted in some def elements SWORDMAN like unituprade class cause i didnt want it to upgrade into a Pikeman.


So what is missing so my unit come availabele for all civ, as a new distinc unit along with the spearman with bronze working, and we can see it in Civilopedia?

And does Danrel's units need to be set as an existing unitclass and replace an already existing unit for a specific civilization? or can i take any unit of his, create a new unitclass with it and put it anywher i want in techtree and choose techprereq, ressouces needed, freepromotions, flavors, aitype etc...

I want (eventualy will) create a mod improving sword and bows era by adding new units and techs and make it last longer between renaissance and medieval,
I realy want to learn, if it is possible, how to take different mesh of distinc units, and make a new units,
exp:
Hi
I am new to modding and i passed the last days surfing threw the forum to manage to get to know how to get downloads unit packs from civ forums, and i think i got it, but wanting to do more, i cheked many tutorials and manage to make nexus and 3d viewer work fine with mod buddy, i was able to upload a 3d model in blender, but i cant get granny viewer.
What i would like to do is taking take differents aspect of manyer units to put them as one.
exemple:

View attachment 397899

View attachment 397900

I would like to take the Greece Knight from Danrel Civ5 ancient unit pack, and change his helmet and weapon for the longswordman sword and helmet
It would also need an Sword attacking animation like the knight from Turkey civ5ancient units pack

Or simply take the longswordman and sit him on a horse and make a new Mounted Swordman unitclass

Could some one help me by detailing how to do that if it is not to much complicated cause starting from 0 modding knowledge , 5 days ago and now trying to use blender to edit 3d models , well blender looks complicated. If i could get that to work then all the other thing i'd like to do i i will learn to do it myself from that.
Thank you cery much

and also, help for this? i havent started it yet but still, i might use a helping hand

going from that :

<Row>
<Type>TECH_METAL_CASTING</Type>
<Cost>275</Cost>
<Description>TXT_KEY_TECH_METAL_CASTING_TITLE</Description>
<Civilopedia>TXT_KEY_TECH_METAL_CASTING_DESC</Civilopedia>
<Help>TXT_KEY_TECH_METAL_CASTING_HELP</Help>
<Era>ERA_MEDIEVAL</Era>
<Trade>true</Trade>
<GridX>5</GridX>
<GridY>8</GridY>
<Quote>TXT_KEY_TECH_METAL_CASTING_QUOTE</Quote>
<PortraitIndex>14</PortraitIndex>
<IconAtlas>TECH_ATLAS_1</IconAtlas>
<AudioIntro>AS2D_TECH_METAL_CASTING</AudioIntro>
<AudioIntroHeader>AS2D_HEADING_TECH_METAL_CASTING</AudioIntroHeader>
</Row>


to that

<Row>
<Type>TECH_METAL_CASTING</Type>
<Cost>195</Cost>
<Description>TXT_KEY_TECH_METAL_CASTING_TITLE</Description>
<Civilopedia>TXT_KEY_TECH_METAL_CASTING_DESC</Civilopedia>
<Help>TXT_KEY_TECH_METAL_CASTING_HELP</Help>
<Era>ERA_CLASSICAL</Era>
<Trade>true</Trade>
<GridX>4</GridX>
<GridY>9</GridY>
<Quote>TXT_KEY_TECH_METAL_CASTING_QUOTE</Quote>
<PortraitIndex>14</PortraitIndex>
<IconAtlas>TECH_ATLAS_1</IconAtlas>
<AudioIntro>AS2D_TECH_METAL_CASTING</AudioIntro>
<AudioIntroHeader>AS2D_HEADING_TECH_METAL_CASTING</AudioIntroHeader>
</Row>






and that

<Row>
<TechType>TECH_METAL_CASTING</TechType>
<PrereqTech>TECH_ENGINEERING</PrereqTech>
</Row>


to that


<Row>
<TechType>TECH_METAL_CASTING</TechType>
<PrereqTech>TECH_Construction</PrereqTech>
</Row>



would it looks like that ?


<technologies>
<Update>
<Where Type="TECH_METAL_CASTING"/>
<Set Cost="195" GridX="4" GridY="9" Era="ERA_CLASSICAL"/>
</Update>
</Technologies>

<Technology_PrereqTechs>
<Update>
<Where Type="TECH_METAL_CASTING"/>
<Set PrereqTech="TECH_CONSTRUCTION"/>
</Update>
</Technology_PrereqTechs>




Am i aproaching the solution?

I would also like to make new promotion ( critical strike: % of chance of instant kill )

Thanks for help
 
Forgot to edit one place wher it was still riten BIPLAN so now i get the EARLY_MACEMAN available with all civ as a new unit, we see it everywher, the only thing is its all spearman's icon and text, so i need to know if ther are icons for Danrel's units, and i have to figgure with all Gedemon and nutty, Deliverator, whoward69,wolfdog, others... (Big thanks to all for freely sharing all your knowledge ) 's tutorials and exemple's and trying to look at existing mod sql and xm files, how to make new text entr for all my new unit plans, ...
i might in some time manage to acomplish something decent
Thank's again
:goodjob:

Capture.jpg

MAceman1.jpg

MAceman2.jpg
 
Forgot to edit one place wher it was still riten BIPLAN so now i get the EARLY_MACEMAN available with all civ as a new unit, we see it everywher, the only thing is its all spearman's icon and text, so i need to know if ther are icons for Danrel's units, and i have to figgure with all Gedemon and nutty, Deliverator, whoward69,wolfdog, others... (Big thanks to all for freely sharing all your knowledge ) 's tutorials and exemple's and trying to look at existing mod sql and xm files, how to make new text entr for all my new unit plans, ...
i might in some time manage to acomplish something decent
Thank's again
:goodjob:

View attachment 397949

View attachment 397950

View attachment 397951
Congrats!

As I mentioned in reply to your other post, if you have questions about a specific mod you're making, you want to open a new thread in the main Creation & Customization subforum, and post your built mod so we don't have to guess what you might have done wrong based on incomplete information.

To just answer your last question about game text, you can put text in the database fields directly rather than using TXT_KEY whatever. The point of those entries is for translation. If you want to do it "right" so someone can translate your mod into their language, you'll make up a new TXT_KEY entry, and add THAT to the Localization database by using the <Language_en_US> view:
Code:
<GameData>
  <Language_en_US>
    <Row Tag="TXT_KEY_WHATEVER">
      <Text>Your full text goes here.</Text>
    </Row>
  </Language_en_US>
</GameData>

Make sure that your TXT_KEY is unique or everything blows up. It's a good idea to add your name at the end of the tag IDs (e.g., "TXT_KEY_WHATEVER_FROID" or something) so you don't accidentally conflict with a tag from the base game or another modder's.
 
Top Bottom