GrantConditionOnPrerequisite -- boolean OR

How do I implement this? (Mod: RA)

Information and discussion for custom maps and mods.
Post Reply
KingSyphilis
Posts: 4
Joined: Sun Nov 17, 2013 11:57 am

GrantConditionOnPrerequisite -- boolean OR

Post 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

abcdefg30
Posts: 641
Joined: Mon Aug 18, 2014 6:00 pm

Re: GrantConditionOnPrerequisite -- boolean OR

Post 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

KingSyphilis
Posts: 4
Joined: Sun Nov 17, 2013 11:57 am

Re: GrantConditionOnPrerequisite -- boolean OR

Post by KingSyphilis »

Thanks, that worked.

Post Reply