Changing to ranged unit

gunde

Chieftain
Joined
Mar 10, 2011
Messages
3
Hello!

This is my first modding attempt so I'm hoping I've missed something very simple here.

Basically what I'm trying to do is add range-attack to RIFLEMAN. I've downloaded and looked at the mods:

Sniper mod (v5)
Gun Range Units (v5)

If I understand it correctly, you have to start a new game in order to use a mod. I wanted this for my current marathon-game so I started to edit the files under:

C:\Program Files (x86)\sid meier's civilization v\Assets\Gameplay

I know it's a bad idea but I really want this and I've made back-ups. My changed RIFLEMAN looks like:

Code:
<Row>
			<Class>UNITCLASS_RIFLEMAN</Class>
			<Type>UNIT_RIFLEMAN</Type>
			<PrereqTech>TECH_RIFLING</PrereqTech>
			<Combat>25</Combat>
			<RangedCombat>20</RangedCombat>
			<Cost>220</Cost>
			<Moves>2</Moves>
			<CombatClass>UNITCOMBAT_ARCHER</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_RANGED</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_RIFLEMAN</Description>
			<Civilopedia>TXT_KEY_CIVILOPEDIA_UNITS_RENAISSANCE_RIFLEMEN_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_RIFLEMAN_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_RIFLEMAN</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
			<ObsoleteTech>TECH_REPLACEABLE_PARTS</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_INFANTRY</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>30</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<Conscription>5</Conscription>
			<UnitArtInfo>ART_DEF_UNIT_RIFLEMAN</UnitArtInfo>
			<UnitFlagIconOffset>47</UnitFlagIconOffset>
			<IconAtlas>UNIT_ATLAS_2</IconAtlas>
			<PortraitIndex>4</PortraitIndex>
		</Row>

I've also added these in the same file:

Code:
<Row>
			<UnitType>UNIT_RIFLEMAN</UnitType>
			<UnitAIType>UNITAI_RANGED</UnitAIType>
		</Row>

<Row>
			<UnitType>UNIT_RIFLEMAN</UnitType>
			<FlavorType>FLAVOR_RANGED</FlavorType>
			<Flavor>12</Flavor>
		</Row>

Everything looks ok in game. I see the ranged strength and when I select the unit and point on an enemy I see the estimation for a ranged attack but I don't have an order button to actually perform it. What am I missing?
 
Thanks for the advice but unfortunately it didn't help. Still no Range Attack-button.

One funny thing I noticed was when I ordered the rifleman to attack a barbarian encampment in three turns. On the second turn they stopped two tiles away and started to shoot down them without moving into the encampment when all the barbarians were killed. So I guess they know that they have ranged attack abilities. All I'm missing is a way to give them the order.

Looking around the DB I found a table called Missions. But where do I change which units gets a certain mission?
 
In the unitmember-file there are variables like "hasLongRangeAttack", copy one of those and set it to 1 for your unit. Also the "hasShortRangeAttack" is appearently that the unit stands still, like the Riflemen, when attacking one hex away. What I've been sitting with for some time is getting a true melee-unit like the Warrior to also get a bombard-attack, but only settings "hasLongRangeAttack" seem to default "hasShortRangeAttack" to 1.
 
I'm either stupid or blind, but I can't find the hasLongRangeAttack in any file. Could you please tell me the file name and path?
 
You could just search for "unit" in the Civ 5-folder and get a unitmember-file. Anyway, it should be here:

Steam\steamapps\common\sid meier's civilization v\resource\Common\civ5artdefines_unitmembers.xml

If it's not there you might need to start Nexus and follow some tutorial on modding. Kael's guide should still apply, then there's a step that unpacks a bunch of files. It might be those that end up in the resource-folder though I thought those in the asset-folder were also unpacked but that's probably wrong.
 
Anything in the resource folder that isn't an .fpk (or possibly .fxsb) is the result of unpacking.

To do the unpacking, open Nexus from the SDK, click the "Nexus" button, click the "Script Browser" button, and then run the "Extract PAK (*.fpk) files" script. Be aware that it'll take a while and everything shows up in the same directory as the .fpk it came from.
 
Back
Top Bottom