Trouble with Unit Graphics and a Question

RenaissanceFan

Warlord
Joined
Mar 15, 2011
Messages
125
Hello again. I'm trying to create a flotilla unit. But I have a problem with the graphics. No matter what I put in UnitArtInfos, the game shows the unit as a spearman army.
Second, is there any way to set this unit's resource requirement to 3 iron?

Thanks in advance.
 
Oh, I forgot to put in the code. It's the following, in separate files:

UnitArtInfos:
Spoiler :

<UnitArtInfos>
<UnitArtInfo>
<Type>ART_WARGALLEON</Type>
<DamageStates>1</DamageStates>
<UnitMemberArt>
<MemberType>ART_MEMBER_WARGALLEON</MemberType>
<MemberCount>1</MemberCount>
</UnitMemberArt>
</UnitArtInfo>
<UnitArtInfo>
<Type>ART_FLOTILLA</Type>
<Formation>ThreeBigGuns</Formation>
<DamageStates>3</DamageStates>
<UnitMemberArt>
<MemberType>ART_MEMBER_FLOTILLA_FLAGSHIP</MemberType>
<MemberCount>1</MemberCount>
</UnitMemberArt>
<UnitMemberArt>
<MemberType>ART_MEMBER_FLOTILLA_SHIP</MemberType>
<MemberCount>2</MemberCount>
</UnitMemberArt>
</UnitArtInfo>
</UnitArtInfos>


UnitMemberArtInfos:
Spoiler :
<UnitMemberArtInfos>
<UnitMemberArtInfo>
<Type>ART_MEMBER_WARGALLEON</Type>
<fScale>0.21</fScale>
<Granny>Assets/Units/Galleon/Galleon.fxsxml</Granny>
<Domain>Sea</Domain>
<MaterialTypeSoundOverrideTag>WOODLRG</MaterialTypeSoundOverrideTag>
<Combat>
<Defaults>ART_DEF_TEMPLATE_SHIP</Defaults>
<bHasShortRangedAttack>1</bHasShortRangedAttack>
<bHasLeftRightAttack>1</bHasLeftRightAttack>
<bHasIndependentWeaponFacing>1</bHasIndependentWeaponFacing>
<Weapon>
<fVisKillStrengthMin>0.0</fVisKillStrengthMin>
<fVisKillStrengthMax>0.0</fVisKillStrengthMax>
<HitEffect>ART_DEF_VEFFECT_CANNON_IMPACT_$(TERRAIN)</HitEffect>
<WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
<WeaponTypeSoundOverrideTag>EXPLOSION6POUND</WeaponTypeSoundOverrideTag>
</Weapon>
</Combat>
</UnitMemberArtInfo>
<UnitMemberArtInfo>
<Type>ART_MEMBER_FLOTILLA_FLAGSHIP</Type>
<fScale>0.21</fScale>
<Granny>Assets/Units/U_English_ShipOfTheLine/U_English_ShipOfTheLine.fxsxml</Granny>
<Domain>Sea</Domain>
<Combat>
<Defaults>ART_DEF_TEMPLATE_SHIP</Defaults>
<bHasShortRangedAttack>1</bHasShortRangedAttack>
<bHasLeftRightAttack>1</bHasLeftRightAttack>
<bHasIndependentWeaponFacing>1</bHasIndependentWeaponFacing>
<Weapon>
<fVisKillStrengthMin>0.0</fVisKillStrengthMin>
<fVisKillStrengthMax>0.0</fVisKillStrengthMax>
<HitEffect>ART_DEF_VEFFECT_CANNON_IMPACT_$(TERRAIN)</HitEffect>
<WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
<WeaponTypeSoundOverrideTag>EXPLOSION20POUND</WeaponTypeSoundOverrideTag>
</Weapon>
</Combat>
<MaterialTypeTag>WOOD</MaterialTypeTag>
<MaterialTypeSoundOverrideTag>WOODLRG</MaterialTypeSoundOverrideTag>
</UnitMemberArtInfo>
<UnitMemberArtInfo>
<Type>ART_MEMBER_FLOTILLA_SHIP</Type>
<fScale>0.21</fScale>
<Granny>Assets/Units/Frigate/Frigate.fxsxml</Granny>
<Domain>Sea</Domain>
<Combat>
<Defaults>ART_DEF_TEMPLATE_SHIP</Defaults>
<bHasShortRangedAttack>1</bHasShortRangedAttack>
<bHasLeftRightAttack>1</bHasLeftRightAttack>
<bHasIndependentWeaponFacing>1</bHasIndependentWeaponFacing>
<Weapon>
<fVisKillStrengthMin>0.0</fVisKillStrengthMin>
<fVisKillStrengthMax>0.0</fVisKillStrengthMax>
<HitEffect>ART_DEF_VEFFECT_CANNON_IMPACT_$(TERRAIN)</HitEffect>
<WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
<WeaponTypeSoundOverrideTag>EXPLOSION6POUND</WeaponTypeSoundOverrideTag>
</Weapon>
</Combat>
<MaterialTypeTag>WOOD</MaterialTypeTag>
<MaterialTypeSoundOverrideTag>WOODLRG</MaterialTypeSoundOverrideTag>
</UnitMemberArtInfo>
</UnitMemberArtInfos>


Please help.
 
do you have another mod using Civ5ArtDefines_Units.xml and Civ5ArtDefines_UnitMembers.xml running ?

if so you need to merge the files because there can be only 1 Civ5ArtDefines_Units.xml and 1 Civ5ArtDefines_UnitMembers.xml at the same time.
 
No, I deleted all other mods for that matter. Detail: If I put, in the unit XML, art references for any of in-game art, it works perfectly, but, if I assign to ART_FLOTILLA or any other I made, it shows a spearman army.
 
have you set the VFS property to true for your units files ?
 
In Modbuddy click on the file, in the window "Properties" switch "Import into VFS" from FALSE to TRUE.

If you don't have the "Properties" window, right click on the file, select "properties".

Switch the VFS for all graphic files to TRUE.

You have to do the same for DDS files if you make you own icons.
 
Right. There are basically three categories:

Things that need VFS=true: new art assets, altered versions of existing Lua scripts, or altered versions of existing XML files (like the art asset info files). Basically, other than the art assets (meaning icon catalog images and such), it's only a question of whether you're replacing an existing file or adding a new one.

Things that need VFS=false: new Lua scripts that you're loading through either the InGameUIAddin function or through InGame.xml. (Setting these to true would run them twice, with the second time usually having an incorrect syntax.)

Things that don't matter: GameData database XML or SQL changes. (These are loaded through the OnModActivated/UpdateDatabase method.)

So just be careful which files you use VFS for.
 
I was thinking... do I need to put that art code along with all others in the game, like putting ART_FLOTILLA with ART_DEF_UNIT_CANNON, ART_DEF_UNIT_U_ENGLISH_SHIPOFTHELINE and so on?
 
If you want to mod an ArtDefines file, you have to replace the whole file - the original contents, plus your own. This is, of course, silly, but it seems to be the situation as it stands.
 
Things that need VFS=false: new Lua scripts that you're loading through either the InGameUIAddin function or through InGame.xml. (Setting these to true would run them twice, with the second time usually having an incorrect syntax.)

It sounds like I might have a problem like this with my mod here. It's a LUA-file that adds a function to the SerialEventUnitCreated that adds a counter to built units. The problem is for the first warrior the SerialEventUnitCreated seem to fire again the next turn (though when I think about it probably fiers again for all units, it's just the Warrior that isn't Captain anymore). I thought it had something to do with "Incorrect type for pointer argument. Using NULL instead." shown in the Live Tuner, but that disapeared after I removed the other LUA-files from the project.

Now I've just got a project with a single LUA-file loaded through InGameUIAddin and setting VFS to either true or false gives the same error. It's here if you want to see it:

Spoiler :
Code:
local g_squad_counter = {};
local g_company_counter = {};
local g_officer_counter = {};
local g_is_init = {};
-------------------------------------------------
-- Ordinal help function
-------------------------------------------------
function get_ordinal( number )
	if ( math.abs( number ) % 100 < 21 and math.abs( number ) % 100 > 4 ) then
		return number .. "th";
	end
	local tmp = math.abs( number ) % 10;
	if ( tmp < 1 ) then
		return number .. "th";
	end
	if ( tmp < 2 ) then
		return number .. "st";
	end
	if ( tmp < 3 ) then
		return number .. "nd";
	end
	if ( tmp < 4 ) then
		return number .. "rd";
	end
	return number .. "th";
end
-------------------------------------------------
-- Change Unit Name On Created
-------------------------------------------------
function MyOnUnitCreated( playerID, unitID, hexVec, unitType, cultureType, civID, primaryColor, secondaryColor, unitFlagIndex, fogState, selected, military, notInvisible )
	if( Players[ playerID ] == nil or
        Players[ playerID ]:GetUnitByID( unitID ) == nil or
        Players[ playerID ]:GetUnitByID( unitID ):IsDead() or 
		not Players[ playerID ]:GetUnitByID( unitID ):IsCanAttack() )
    then
        return;
    end

	-- Init stuff
	local new_name = "";
	if ( g_is_init[tostring( playerID )] == nil ) then
		g_company_counter[tostring( playerID )] = 1;
		g_squad_counter[tostring( playerID )] = 1;
		g_officer_counter[tostring( playerID )] = 0;
		g_is_init[tostring( playerID )] = 1;
	end

	-- Check if unit is "officer"
	if ( Players[ playerID ]:GetUnitByID( unitID ):GetName() == "Warrior" ) then
		-- Reset Company if it've got at-least 1 Squad and 1 "officer"
		if ( g_squad_counter[tostring( playerID )] > 1 and g_officer_counter[tostring( playerID )] > 0) then
			g_company_counter[tostring( playerID )] = g_company_counter[tostring( playerID )] + 1;
			g_officer_counter[tostring( playerID )] = 0;
			g_squad_counter[tostring( playerID )] = 1;
		end
		-- Set "officer" as Lieutenant if Company already have a Captain
		if ( g_officer_counter[tostring( playerID )] > 0 ) then
			new_name = get_ordinal( g_officer_counter[tostring( playerID )] ) .. " Lieutenant, " .. get_ordinal( g_company_counter[tostring( playerID )] ) .. " Company";
			g_officer_counter[tostring( playerID )] = g_officer_counter[tostring( playerID )] + 1;
		else
			new_name = "Captain, " .. get_ordinal( g_company_counter[tostring( playerID )] ) .. " Company";
			g_officer_counter[tostring( playerID )] = g_officer_counter[tostring( playerID )] + 1;
		end
	else
		new_name = get_ordinal( g_squad_counter[tostring( playerID )] ) .. " Squad, " .. get_ordinal( g_company_counter[tostring( playerID )] ) .. " Company";
		g_squad_counter[tostring( playerID )] = g_squad_counter[tostring( playerID )] + 1;
	end

	Network.SendRenameUnit(unitID, new_name );
	print( "New name: " .. new_name );

end
Events.SerialEventUnitCreated.Add( MyOnUnitCreated );

It doesn't seem to be that strange other than the event fiering again. There's no error in the LiveTuner and the second name the Warrior is getting is "2nd Squad, 1st Company" since his "name" wasn't Warrior the second turn. Though it's strange if I print the old name at the begining of that function the Live Tuner show this:

Spoiler :
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Warrior
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: Captain, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Warrior
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: Captain, 1st Company
TechTree: AdvisorControl could not be found
ProductionPopup: AdvisorControl could not be found
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 1st Squad, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 2nd Squad, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 3rd Squad, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 4th Squad, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 5th Squad, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Scout
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 1st Squad, 1st Company
ProductionPopup: AdvisorControl could not be found
Tutorial: City building complete
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 6th Squad, 1st Company
LeaderHeadRoot: Handling LeaderMessage: 0, The proud and warlike Mongul people greet you. Treat us with respect and you may live to see another sunrise.
ActionInfoPanel: UI thinks that we can't end turn, but the notification system disagrees
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Brute
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 7th Squad, 1st Company
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: Old name: Scout
\Documents and Settings\Administrator\My Documents\My Games\Sid Meier's Civilization 5\MODS\ScriptTest2 (v 1)\Lua\SetUnitRankName: New name: 2nd Squad, 1st Company


I would really have expected it to show "Old name: Captain, 1st Company", "New name: 1st Squad, 1st Company" because it tries to run that function again the next turn.
 
Thanks for everyone's help. What was happening was that there were two problems:

1) I didn't clone the original files Civ5ArtDefines_Units.xml and Civ5ArtDefines_UnitMembers.xml;
2) And I didn't use the above names in my modded files.

I kept experimenting until I got it working. Well, here's the result (I don't know why the water looks that way, but only happened in the JPG):
 

Attachments

  • Ships.jpg
    Ships.jpg
    272.2 KB · Views: 220
got the same prob ... my unit files are imported to VFS, my Artdefines are set to vfs but my unit still look like the spearmen
 
kanaanpal99, go grab one of whoward69's files, such as supercarrier and look what he did with the art define. since 674 patch the coding to put in new art changed and that's how you add it.
 
Back
Top Bottom