Great Generals grant 'Great Abilities' instead of promotions

Rapsynrev

Chieftain
Joined
Feb 6, 2012
Messages
32
I am working on a mod that adds a few new Great People to the game with unique (and at this point OP) abilities. What I am trying to do for Great Generals is have them each grant a specific ability instead of a generic unit promotion. In this case it lets the unit 'heal on the run' and adds combat power (yes this is OP, I may balance it later... or maybe not if it's fun as is). The text from the "GreatPersonIndividualActionModifiers" appears correctly on the General, but when I activate it, it seems like nothing happens. Perusing the GameEffects.LOG, it looks like the two modifiers were attached to the warrior, but when I did a battle preview, the combat power buff did not show up, telling me something went wrong. Most of the code was based on the Spear of Fionn ability. Let me know if anyone knows a trick to do this. As a bonus, I'd like to make it actually appear on the unit like a standard promotion. Thanks in advance if anyone knows how to solve this!

Code:
INSERT OR REPLACE INTO Modifiers
    (ModifierId,                 ModifierType,                 Permanent, SubjectRequirementSetId)
VALUES
    ('GRANT_GUARDIAN_ANGEL', 'MODIFIER_PLAYER_UNITS_GRANT_ABILITY', '1', 'GUARDIAN_ANGEL_REQ');
    
INSERT OR REPLACE INTO RequirementSets
    (RequirementSetId, RequirementSetType)
VALUES
    ('GUARDIAN_ANGEL_REQ', 'REQUIREMENTSET_TEST_ALL');
    
INSERT OR REPLACE INTO RequirementSetRequirements
    (RequirementSetId, RequirementId)
VALUES
    ('GUARDIAN_ANGEL_REQ', 'AOE_REQUIRES_OWNER_ADJACENCY');

INSERT OR REPLACE INTO Types
    (Type, Kind)
VALUES
    ('GUARDIAN_ANGEL', 'KIND_ABILITY');
    
INSERT OR REPLACE INTO ModifierArguments
    (ModifierId, Name, Value)
VALUES
    ('GRANT_GUARDIAN_ANGEL', 'UnitAbilityType', 'GUARDIAN_ANGEL');

INSERT OR REPLACE INTO UnitAbilities
    (UnitAbilityType, Name, Description, Inactive, ShowFloatTextWhenEarned)
VALUES
    ('GUARDIAN_ANGEL', 'LOC_GUARDIAN_ANGEL_NAME','LOC_GUARDIAN_ANGEL_DESCRIPTION', '0', '1');
    
INSERT OR REPLACE INTO TypeTags
    (Type, Tag)
VALUES
    ('GUARDIAN_ANGEL', 'CLASS_RECON'),
    ('GUARDIAN_ANGEL', 'CLASS_MELEE'),
    ('GUARDIAN_ANGEL', 'CLASS_RANGED'),
    ('GUARDIAN_ANGEL', 'CLASS_SIEGE'),
    ('GUARDIAN_ANGEL', 'CLASS_HEAVY_CAVALRY'),
    ('GUARDIAN_ANGEL', 'CLASS_LIGHT_CAVALRY'),
    ('GUARDIAN_ANGEL', 'CLASS_ANTI_CAVALRY'),
    ('GUARDIAN_ANGEL', 'CLASS_RANGED_CAVALRY'),
    ('GUARDIAN_ANGEL', 'CLASS_HEAVY_CHARIOT'),
    ('GUARDIAN_ANGEL', 'CLASS_LIGHT_CHARIOT'),
    ('GUARDIAN_ANGEL', 'CLASS_WARRIOR_MONK');


INSERT OR REPLACE INTO UnitAbilityModifiers
    (UnitAbilityType, ModifierId)
VALUES
    ('GUARDIAN_ANGEL', 'GUARDIAN_ANGEL_STRENGTH'),
    ('GUARDIAN_ANGEL', 'GUARDIAN_ANGEL_HEALING');
    
INSERT OR REPLACE INTO Modifiers
(ModifierId, ModifierType)
VALUES
    ('GUARDIAN_ANGEL_STRENGTH', 'MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH'),
    ('GUARDIAN_ANGEL_HEALING', 'MODIFIER_PLAYER_UNIT_GRANT_HEAL_AFTER_ACTION');

INSERT OR REPLACE INTO ModifierArguments
    (ModifierId, Name, Value)
VALUES   
    ('GUARDIAN_ANGEL_STRENGTH', 'Amount', 5);
    
INSERT OR REPLACE INTO ModifierStrings
    (ModifierId, Context, Text)
VALUES
    ('GUARDIAN_ANGEL_STRENGTH', 'Preview', 'LOC_GUARDIAN_ANGEL_STRENGTH'),
    ('GUARDIAN_ANGEL_HEALING', 'Preview', 'LOC_GUARDIAN_ANGEL_HEALING'),   
    ('GRANT_GUARDIAN_ANGEL', 'Summary', 'LOC_GRANT_GUARDIAN_ANGEL');
 
So the trick, it seems, is to break the "Ability" into its two "ModifierId's" and assign them directly through the General's ability (instead of him assigning an ability which then assigns the two Modifiers). It is working now! So that Great Engineer who is really a Great Blacksmith can forge Excalibur and give it to a warrior of his choice for +15 combat strength, or that merchant can teach a specific scout unit how to ford rivers, ignoring terrain cost, etc.

EDIT:
I have since discovered a flaw in this method. When a unit upgrades, it deletes the original unit and creates one with the same promotions or the next class up, but loses any additional modifiers. I would love to find a work around for this as it would also enable UU modifiers to get pulled through the ages as well.
 
Last edited:
Back
Top Bottom