The Expression System

Would this work?

<Not>
<Has>
<GOMType>GOM_BUILDING</GOMType>
<ID>BUILDINGCLASS_CULTURE_HUMAN</ID>​
</Has>​
</Not>

I have a feeling it won't...

Hard to explain why I need it. Mostly I'm curious.

Edit: Tested it, didn't work.
 
Last edited:
Would this work?
Code:
<Not>
	<Has>
		<GOMType>GOM_BUILDING</GOMType>
		<ID>[B]BUILDINGCLASS[/B]_CULTURE_HUMAN</ID>
	</Has>
</Not>
I have a feeling it won't...

Hard to explain why I need it. Mostly I'm curious.

Edit: Tested it, didn't work.
Somebody would have to add GOM_BUILDINGCLASS for that to work.
 
I need to know if a city is coastal or not for the NewCityFree tag on buildings. I could not see a list of which tags are supported only an TAG_WATER in an example in post #27.

If so is it TAG_COAST or TAG_COASTAL?

The Python I am trying to replace is pCity.plot().isCoastalLand()

The XML would look something like:-
Code:
<NewCityFree>
    <And>
       <Is>TAG_COASTAL</Is>
      <Has>
        <GOMType>GOM_TECH</GOMType>
        <ID>TECH_COLONIALISM</ID>
      </Has>
    </And>
</NewCityFree>

This is so I can get the Settler problem off my plate, ie where the more advanced settlers were only working for the human players.
 
This would take code research I don't have the time to do today but I'll look into it as I can. I don't know the answer and have little to no familiarity with TAG_ objects.
 
Thanks, it is something that has been on my plate for awhile. I can do most buildings but not the ones that require coastal.

So far I have done the land buildings, the increase to initial population and the tech pedia screen. I am working on the tech tree screen now. Then there are only the 4 coastal buildings to do.
 
I need to know if a city is coastal or not for the NewCityFree tag on buildings. I could not see a list of which tags are supported only an TAG_WATER in an example in post #27.

If so is it TAG_COAST or TAG_COASTAL?

The Python I am trying to replace is pCity.plot().isCoastalLand()

The XML would look something like:-
Code:
<NewCityFree>
    <And>
       <Is>TAG_COASTAL</Is>
      <Has>
        <GOMType>GOM_TECH</GOMType>
        <ID>TECH_COLONIALISM</ID>
      </Has>
    </And>
</NewCityFree>

This is so I can get the Settler problem off my plate, ie where the more advanced settlers were only working for the human players.

I don't know why I decided to suddenly just dive into this... curiosity perhaps. TAG_COASTAL doesn't exist. But it sure is easy to add. Done but awaiting the next commit.
 
I don't know why I decided to suddenly just dive into this... curiosity perhaps. TAG_COASTAL doesn't exist. But it sure is easy to add. Done but awaiting the next commit.

Thanks. I am looking at making the changes I have done controlled by Custom XML rather than hard coded. The first thing I need to do is un-hardcode the mod folder name in Platyping's example.
 
After much frustration and dark science, I have figured out how to have a building enable another building in all civs! :banana:

The following snippet of code enables the construction of a building only if another building (INQUIRY) has been built by any civ in the game:
Spoiler :

Code:
<ConstructCondition>
	<IntegrateOr>
		<RelationType>RELATION_ASSOCIATED</RelationType>
		<GameObjectType>GAMEOBJECT_GAME</GameObjectType>
		<Has>
		<GOMType>GOM_BUILDING</GOMType>
		<ID>BUILDING_INQUIRY</ID>
		</Has>
	</IntegrateOr>
</ConstructCondition>


This allows us the bypass nasty Projects using the expression system. :cool:
 
Hi!

I asked this in the Quick Modding Questions and later in Modder's Guide to A New Dawn too:
Anyone knows how to make a unit give a free promotion when attached to an other one?
For example I create a Fart Frog (oops.... :lol: ) Dart Frog, set the <LeaderPromotion> to PROMOTION_POISON_ARROWS. The pedia text displays what happens when attached to a unit but there is no icon to attach it to any unit. :confused:
Any ideas?

Vokarya suggested this:
The other thing that might work instead of a <LeaderPromotion> is a Mission. I think from reading the schema that a mission can grant a promotion. You'd need to define the mission and the outcome and then edit the unit file to give the mission to the unit. I have not tried it myself.

After reading and studying a bit I came up with this:

Code:
        <OutcomeInfo>
            <Type>OUTCOME_POISON_ARROWS</Type>
            <Description>TXT_KEY_OUTCOME_POISON_ARROWS</Description>
            <Message>TXT_KEY_OUTCOME_POISON_ARROWS_MESSAGE</Message>
            <PrereqTech>NONE</PrereqTech>
             <Or>
                <Has>
                     <GOMType>GOM_UNITCOMBAT</GOMType>
                    <ID>UNITCOMBAT_RECON</ID>
                </Has>
                <Has>
                     <GOMType>GOM_UNITCOMBAT</GOMType>
                    <ID>UNITCOMBAT_ARCHER</ID>
                </Has>
                <Has>
                     <GOMType>GOM_UNITCOMBAT</GOMType>
                    <ID>UNITCOMBAT_MELEE</ID>
                </Has>
            </Or>
            <ExtraChancePromotions>
                <ExtraChancePromotion>
                    <PromotionType>PROMOTION_POISON_ARROWS</PromotionType>
                    <iExtraChance>100</iExtraChance>
                </ExtraChancePromotion>
            </ExtraChancePromotions>
        </OutcomeInfo>

Code:
            <Actions>
                <Action>
                    <MissionType>MISSION_POISON_ARROWS</MissionType>
                    <ActionOutcomes>
                        <Outcome>
                            <OutcomeType>OUTCOME_POISON_ARROWS</OutcomeType>
                            <iChance>100</iChance>
                        </Outcome>
                    </ActionOutcomes>
                </Action>
            </Actions>

Code:
        <MissionInfo>
            <Type>MISSION_POISON_ARROWS</Type>
            <Description>TXT_KEY_POISON_ARROWS</Description>
            <Help>TXT_KEY_POISON_ARROWS_HELP</Help>
            <Waypoint>NONE</Waypoint>
            <EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
            <iTime>0</iTime>
            <bTarget>0</bTarget>
            <bBuild>0</bBuild>
            <bSound>0</bSound>
            <bVisible>1</bVisible>
            <Button>,Art/Interface/Buttons/Promotions/ArcherAid1.dds,Art/Interface/Buttons/Atlases/RoM_Promotion_Atlas2.dds,6,1</Button>
        </MissionInfo>

Does that code look good enough to work? I can't test it right now (I'm at work).
 
Also, in what does ReplaceOutcomes and bToCoastalCity do?
I'm no expert on missions xml, but what you set up there looks sound at first glance.
bToCoastalCity is when the outcome is supposed to grant a unit and teleport it to a city right away, it would be strange to get the unit in a landlocked place when it was a sea-battle that occurred.
ReplaceOutcomes is probably used to make an outcome always trump the replaced outcome(s), like a better version of an outcome that becomes available at a later tech.
 
Hi!

I asked this in the Quick Modding Questions and later in Modder's Guide to A New Dawn too:


Vokarya suggested this:


After reading and studying a bit I came up with this:

Code:
        <OutcomeInfo>
            <Type>OUTCOME_POISON_ARROWS</Type>
            <Description>TXT_KEY_OUTCOME_POISON_ARROWS</Description>
            <Message>TXT_KEY_OUTCOME_POISON_ARROWS_MESSAGE</Message>
            <PrereqTech>NONE</PrereqTech>
             <Or>
                <Has>
                     <GOMType>GOM_UNITCOMBAT</GOMType>
                    <ID>UNITCOMBAT_RECON</ID>
                </Has>
                <Has>
                     <GOMType>GOM_UNITCOMBAT</GOMType>
                    <ID>UNITCOMBAT_ARCHER</ID>
                </Has>
                <Has>
                     <GOMType>GOM_UNITCOMBAT</GOMType>
                    <ID>UNITCOMBAT_MELEE</ID>
                </Has>
            </Or>
            <ExtraChancePromotions>
                <ExtraChancePromotion>
                    <PromotionType>PROMOTION_POISON_ARROWS</PromotionType>
                    <iExtraChance>100</iExtraChance>
                </ExtraChancePromotion>
            </ExtraChancePromotions>
        </OutcomeInfo>

Code:
            <Actions>
                <Action>
                    <MissionType>MISSION_POISON_ARROWS</MissionType>
                    <ActionOutcomes>
                        <Outcome>
                            <OutcomeType>OUTCOME_POISON_ARROWS</OutcomeType>
                            <iChance>100</iChance>
                        </Outcome>
                    </ActionOutcomes>
                </Action>
            </Actions>

Code:
        <MissionInfo>
            <Type>MISSION_POISON_ARROWS</Type>
            <Description>TXT_KEY_POISON_ARROWS</Description>
            <Help>TXT_KEY_POISON_ARROWS_HELP</Help>
            <Waypoint>NONE</Waypoint>
            <EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
            <iTime>0</iTime>
            <bTarget>0</bTarget>
            <bBuild>0</bBuild>
            <bSound>0</bSound>
            <bVisible>1</bVisible>
            <Button>,Art/Interface/Buttons/Promotions/ArcherAid1.dds,Art/Interface/Buttons/Atlases/RoM_Promotion_Atlas2.dds,6,1</Button>
        </MissionInfo>

Does that code look good enough to work? I can't test it right now (I'm at work).

Well, that didn't work :c5unhappy:
The icon appeared. Clicking on it the message appeared too. But there was no promotion added to the unit on the same tile.
I also tried to set things up a KillOutcome but that gave me no positive results either.

Any ideas?
 
Send a PM to AIAndy. Then wait for his reply.
 
The part with the Or and Has belongs in the Outcome (the part in the actions), not the OutcomeInfo and should be surrounded by UnitCondition tags (as it is a condition on the unit triggering the mission).
ExtraChancePromotion does not give a promotion, it increases the chance for this specific outcome if the unit has the promotion (as you can list multiple outcomes and make each more or less likely).
To give a promotion as the outcome result, add PromotionType to the Outcome (not the OutcomeInfo).
 
@AIAndy

THX for your answer. Let's see if I understood it. Is this how it should look like?
Code:
<OutcomeInfo>
            <Type>OUTCOME_POISON_ARROWS</Type>
            <Description>TXT_KEY_OUTCOME_POISON_ARROWS</Description>
            <Message>TXT_KEY_OUTCOME_POISON_ARROWS_MESSAGE</Message>
            <PrereqTech>NONE</PrereqTech>
        </OutcomeInfo>

Code:
            <Actions>
                <Action>
                    <MissionType>MISSION_POISON_ARROWS</MissionType>
                    <ActionOutcomes>
                        <UnitCondition>
                             <Or>
                                <Has>
                                     <GOMType>GOM_UNITCOMBAT</GOMType>
                                    <ID>UNITCOMBAT_RECON</ID>
                                </Has>
                                <Has>
                                     <GOMType>GOM_UNITCOMBAT</GOMType>
                                    <ID>UNITCOMBAT_ARCHER</ID>
                                </Has>
                                <Has>
                                     <GOMType>GOM_UNITCOMBAT</GOMType>
                                    <ID>UNITCOMBAT_MELEE</ID>
                                </Has>
                            </Or>
                        </UnitCondition>
                        <Outcome>
                            <OutcomeType>OUTCOME_POISON_ARROWS</OutcomeType>
                            <iChance>100</iChance>
                            <PromotionType>PROMOTION_POISON_ARROWS</PromotionType>
                        </Outcome>
                    </ActionOutcomes>
                </Action>
            </Actions>

Code:
        <MissionInfo>
            <Type>MISSION_POISON_ARROWS</Type>
            <Description>TXT_KEY_POISON_ARROWS</Description>
            <Help>TXT_KEY_POISON_ARROWS_HELP</Help>
            <Waypoint>NONE</Waypoint>
            <EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
            <iTime>0</iTime>
            <bTarget>0</bTarget>
            <bBuild>0</bBuild>
            <bSound>0</bSound>
            <bVisible>1</bVisible>
            <Button>,Art/Interface/Buttons/Promotions/ArcherAid1.dds,Art/Interface/Buttons/Atlases/RoM_Promotion_Atlas2.dds,6,1</Button>
        </MissionInfo>

I'll test it tonight.
 
No, that didn't work.
Apparently ActionOutcomes cannot do that only KillOutcomes.
And it's true about other things too e.g GPP. A killed unit can bring GPP to a city but a unit cannot have an action to "join" a city with free GPPs. Too bad :c5unhappy:
 
Code:
            <Actions>
                <Action>
                    <MissionType>MISSION_POISON_ARROWS</MissionType>
                    <ActionOutcomes>
                        <UnitCondition>
                             <Or>
                                <Has>
                                     <GOMType>GOM_UNITCOMBAT</GOMType>
                                    <ID>UNITCOMBAT_RECON</ID>
                                </Has>
                                <Has>
                                     <GOMType>GOM_UNITCOMBAT</GOMType>
                                    <ID>UNITCOMBAT_ARCHER</ID>
                                </Has>
                                <Has>
                                     <GOMType>GOM_UNITCOMBAT</GOMType>
                                    <ID>UNITCOMBAT_MELEE</ID>
                                </Has>
                            </Or>
                        </UnitCondition>
                        <Outcome>
                            <OutcomeType>OUTCOME_POISON_ARROWS</OutcomeType>
                            <iChance>100</iChance>
                            <PromotionType>PROMOTION_POISON_ARROWS</PromotionType>
                        </Outcome>
                    </ActionOutcomes>
                </Action>
            </Actions>
The UnitCondition needs to be within the <Outcome> tag.
KillOutcomes and ActionOutcomes use the same code so in principle anything that works for one should work for the other.
 
Top Bottom