[R&F] (SOLVED) Help with Granting Relics

S1AL

Warlord
Joined
Jun 17, 2018
Messages
134
Overview:

New modder, generally familiar with basic SQL stuff. I'm using modbuddy and Notepad++.

I'm looking to create an effect that grants Poland a Relic upon founding a religion or evangelizing a belief.

Is there a way to do this with SQL using the MODIFIER_PLAYER_GRANT_RELIC ModifierType, or do I need to use Lua? It appears to me that this sort of trigger is beyond the capabilities of an SQL item, but I'd rather not overlook a simple solution.

Thanks.
 
Maybe REQUIREMENT_PLAYER_FOUNDED_RELIGION_WITH_BELIEF (see Leaders.xml) can help you. It might be very cumbersome, but you could use this requirement type to insert all the desired beliefs in a RequirementSetId for your trigger.

Maybe it can be also done in Lua: Spawn a unit with the relic promotion, then kill that unit to get a free relic for Poland. I have not tried this myself, but you could use
Code:
Events.BeliefAdded( Your_Function ) 
function Your_Function( playerID, beliefID )
--your code
end
as an event that triggers your function. Also you need
Code:
pUnit = UnitManager.InitUnit(iPlayer, "UNIT_TYPE_NAME", x, y)
to spawn a unit and
Code:
UnitManager.Kill(pUnit, false)
to kill that unit.
 
Last edited:
So it turns out this one was actually fairly simple, I just needed to borrow the format from Macedon's Inspiration triggers. Granting a Relic for founding a religion:


Code:
INSERT INTO Modifiers (ModifierId , ModifierType , SubjectRequirementSetId)
    VALUES ('TRAIT_LITHUANIANUNION_FOUND_RELIGION_RELIC_CPLMOD' , 'MODIFIER_ALL_PLAYERS_ATTACH_MODIFIER' , 'PLAYER_FOUNDED_RELIGION_RELIC_CPLMOD');  
INSERT INTO Modifiers (ModifierId , ModifierType , Permanent , RunOnce)
    VALUES ('FOUND_RELIGION_RELIC_MODIFIER_CPLMOD' , 'MODIFIER_PLAYER_GRANT_RELIC' , 1 , 1);  
INSERT INTO ModifierArguments (ModifierId , Name , Value)
    VALUES ('TRAIT_LITHUANIANUNION_FOUND_RELIGION_RELIC_CPLMOD' , 'ModifierId' , 'FOUND_RELIGION_RELIC_MODIFIER_CPLMOD');  
INSERT INTO ModifierArguments (ModifierId , Name , Value)
    VALUES ('FOUND_RELIGION_RELIC_MODIFIER_CPLMOD' , 'Amount' , '1');  
INSERT INTO TraitModifiers (TraitType , ModifierId)
    VALUES ('TRAIT_LEADER_LITHUANIAN_UNION' , 'TRAIT_LITHUANIANUNION_FOUND_RELIGION_RELIC_CPLMOD');
INSERT INTO RequirementSets (RequirementSetId , RequirementSetType)
    VALUES ('PLAYER_FOUNDED_RELIGION_RELIC_CPLMOD' , 'REQUIREMENTSET_TEST_ALL');  
INSERT INTO RequirementSetRequirements (RequirementSetId , RequirementId)
    VALUES ('PLAYER_FOUNDED_RELIGION_RELIC_CPLMOD' , 'REQUIRES_PLAYER_HAS_FOUNDED_A_RELIGION');

Instead of using 'REQUIRES_PLAYER_HAS_FOUNDED_A_RELIGION' , I could have used 'REQUIREMENT_PLAYER_FOUNDED_RELIGION_WITH_BELIEF' to test against any set of the belief classes 1 by 1 (and REQUIREMENTSET_TEST_ANY).

However, due to balance concerns I'm looking at doing it both upon founding and completing a religion instead of adding any non-Follower belief.

So the new question is this: is there any way I could check multiple RequirementSets at the same time?
 
Maybe REQUIREMENT_REQUIREMENTSET_IS_MET could be helpful, but I am not sure how to use it. I have found this in UnitAbilities.xml and its entry appears only once in the file:
Code:
<Row>
   <RequirementId>PLOT_IS_DESERT_OR_DESERT_HILLS_REQUIREMENT</RequirementId>
   <RequirementType>REQUIREMENT_REQUIREMENTSET_IS_MET</RequirementType>
</Row>
 
Last edited:
Yup, figured it out last night, that is the check. It is also used for units that have a bonus against class types (e.g. Spearman).

Given that nothing uses the desert check, I'm wondering if it was originally meant for Mamluks.
 
Top Bottom