Building giving ability, doesn't work!

Allein

Warlord
Joined
Mar 3, 2004
Messages
167
Location
Quebec
I have a lot of ability working but still I can't manage to have a building let say the Military academy give me an ability to the unit build in the city where the academy is present.
My modifier code looks like this:

<BuildingModifiers>
<Row>
<BuildingType>BUILDING_MILITARY_ACADEMY</BuildingType>
<ModifierId>GRANT_WINTER_ABILITY_MOVE</ModifierId>
</Row>
</BuildingModifiers>

<Modifiers>
<Row>
<ModifierId>GRANT_WINTER_ABILITY_MOVE</ModifierId>
<ModifierType>MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS</ModifierType>
</Row>
</Modifiers>

<ModifierArguments>
<Row>
<ModifierId>GRANT_WINTER_ABILITY_MOVE</ModifierId>
<Name>AbilityType</Name>
<Value>ABILITY_MOVE_WINTER</Value>
</Row>
</ModifierArguments>


I've tried other ways but none of which actually gives my new build unit the ability...
Thanks for the help !
 
I don't see
Code:
Permanent="true"
in table Modifiers, which I think for this case is needed.

Otherwise nothing seems amiss, so I would have to think there is something incorrect in the definition of the ABILITY_MOVE_WINTER or else in the structure of the mod itself in how the file(s) are loaded into the game.
 
I think the game handles abilities rather oddly. For one, I tried to give the Conquistador as part of a trait and it failed.

What you could do is give the specific modifier to units built in the city? The Ability's Modifier (because that's what it is).
 
This works just fine in my mod
Spoiler :
Code:
<GameData>
	<Types>
		<Row Type="BUILDING_NATIONAL_ALPINE_ACADEMY_LRS" Kind="KIND_BUILDING"/>
		<Row Type="ABILITY_ALPINE_ACADEMY" Kind="KIND_ABILITY"/>
		<Row Type="MODIFIER_GRANT_ABILITY_SINGLE_CITY_UNITS_LRS" Kind="KIND_MODIFIER"/>
	</Types>
	<DynamicModifiers>
		<Row ModifierType="MODIFIER_GRANT_ABILITY_SINGLE_CITY_UNITS_LRS" CollectionType="COLLECTION_CITY_TRAINED_UNITS" EffectType="EFFECT_GRANT_ABILITY" />
	</DynamicModifiers>
	<TypeTags>
		<Row Type="ABILITY_ALPINE_ACADEMY" Tag="CLASS_MELEE"/>
		<Row Type="ABILITY_ALPINE_ACADEMY" Tag="CLASS_RANGED"/>
		<Row Type="ABILITY_ALPINE_ACADEMY" Tag="CLASS_ANTI_CAVALRY"/>
	</TypeTags>
	<UnitAbilities>
		<Row UnitAbilityType="ABILITY_ALPINE_ACADEMY" Name="LOC_ABILITY_ALTITUDE_TRAINING_NAME" Description="LOC_ABILITY_ALTITUDE_TRAINING_DESCRIPTION" Inactive="true"/>
	</UnitAbilities>
	<UnitAbilityModifiers>
		<Row>
			<UnitAbilityType>ABILITY_ALPINE_ACADEMY</UnitAbilityType>
			<ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId>
		</Row>
	</UnitAbilityModifiers>
	<Buildings>
		<Row BuildingType="BUILDING_NATIONAL_ALPINE_ACADEMY_LRS" Name="LOC_BUILDING_NATIONAL_ALPINE_ACADEMY_LRS_NAME"
			Description="LOC_BUILDING_NATIONAL_ALPINE_ACADEMY_LRS_DESCRIPTION" PrereqCivic="CIVIC_FEUDALISM"
			PrereqDistrict="DISTRICT_ENCAMPMENT" MaxPlayerInstances="1" AdvisorType="ADVISOR_CONQUEST"
			Housing="1" Entertainment="1" Cost="225" OuterDefenseHitPoints="10" />
	</Buildings>
	<Modifiers>
		<Row ModifierId="NATIONAL_ALPINE_ACADEMY_LRS_GRANT_ALPINE_LRS" ModifierType="MODIFIER_GRANT_ABILITY_SINGLE_CITY_UNITS_LRS" Permanent="true" />
	</Modifiers>
	<ModifierArguments>
		<Row ModifierId="NATIONAL_ALPINE_ACADEMY_LRS_GRANT_ALPINE_LRS" Name="AbilityType" Value="ABILITY_ALPINE_ACADEMY" />
	</ModifierArguments>
	<BuildingModifiers>
		<Row BuildingType="BUILDING_NATIONAL_ALPINE_ACADEMY_LRS" ModifierId="NATIONAL_ALPINE_ACADEMY_LRS_GRANT_ALPINE_LRS" />
	</BuildingModifiers>
</GameData>
To simplify the code I would need to make I borrowed the <ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId> and made my <UnitAbilityType> use the same modifier Id. The collection type and effect type of the custom ModifierType I am creating are the same as OP is trying to use.
 
I've tested the Ability and it works fines when apply directly on the unit, but not with the building.
How can the loading file order can affect the ability to be apply or not ?
 
Top Bottom