Page 1 of 1

GrantConditionOnPrerequisite -- boolean OR

Posted: Sun Jul 17, 2022 2:27 pm
by KingSyphilis
Hi,
I have defined an instance of HOSP, as follows:

Code: Select all

HOSP.test:
	Inherits: HOSP
	RenderSprites:
		Image: HOSP
	Tooltip:
		Name: test
How would I go about modifying ^Infantry, in order to apply "Condition: hospital" from ownership of either "hosp" or "hosp.test"?

For instance, appending the following code overrides the default rules, triggering the grant only for "hosp.test" (rather than "hosp"):

Code: Select all

^Infantry:
	GrantConditionOnPrerequisite@HOSPITAL:
		Condition: hospital
		Prerequisites: hosp.test
But, I would like to implement the equivalent of:

Code: Select all

Prerequisites: hosp || hosp.test
Thank you

Re: GrantConditionOnPrerequisite -- boolean OR

Posted: Mon Jul 18, 2022 3:45 pm
by abcdefg30
Prerequisites don't support boolean operations (it is just a list of requirements). What you can do is:

Code: Select all

^Infantry:
	GrantConditionOnPrerequisite@HOSPITAL:
		Condition: hospital
		Prerequisites: hosp
	GrantConditionOnPrerequisite@HOSPITALTEST:
		Condition: hospital
		Prerequisites: hosp.test

Re: GrantConditionOnPrerequisite -- boolean OR

Posted: Wed Jul 20, 2022 5:27 pm
by KingSyphilis
Thanks, that worked.