• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

How can I make requirement "if not within 3 tiles from friendly unit"?

Toryjang

Chieftain
Joined
Jan 23, 2023
Messages
2
I want to make an ability "if there were no friendly units in 3 tiles, get strength" to units.
But I can't make code for setting requirement.


First, I guessed making a requirement "if adjacent to friendly units", setting max range 3, and giving it inverse will work well, but it didn't.

It just work when adjacent within 1 tiles (it means max range=1, min range=0)



Below is my code. (I just check for anti-cavalry unit)



Code:
INSERT INTO RequirementSets
        (RequirementSetId,                                        RequirementSetType) 
VALUES
        ('TORY_REQSET_NO_ADJACENT_TO_2TILES_ALLY',                 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements
        (RequirementSetId,                                      RequirementId) 
VALUES
        ('TORY_REQSET_NO_ADJACENT_TO_2TILES_ALLY',              'TORY_REQ_NO_ALLY_IN_TILES');

INSERT INTO Requirements
        (RequirementId,                                            RequirementType,                                        Inverse) 
VALUES
        ('TORY_REQ_NO_ALLY_IN_TILES',                             'REQUIREMENT_PLOT_ADJACENT_FRIENDLY_UNIT_TAG_MATCHES',    1);

INSERT OR REPLACE INTO RequirementArguments
        (RequirementId,                                        Name,                        Value) 
VALUES
        ('TORY_REQ_NO_ALLY_IN_TILES',                         'Tag',                        'CLASS_ANTI_CAVALRY'),
        ('TORY_REQ_NO_ALLY_IN_TILES',                         'MinRange',                    0),
        ('TORY_REQ_NO_ALLY_IN_TILES',                         'MaxRange',                   3);





Next, I tested with other RequirementType, REQUIREMENT_PLOT_ADJACENT_IMPROVEMENT_TYPE_MATCHES

If I change to this RequirementType (and improvement_farm), it works.

Only with improvement can I set max&min range?
If not, how can I make code for this?
 
Back
Top Bottom