Line <OnUnitChangeTo/>

TheBirdMan

King
Joined
Jun 5, 2018
Messages
792
Location
Northwest Zealand, Denmark
The entry <OnUnitChangeTo/> in the ...\Terrain\CIV4FeatureInfos.xml file. I find it 1st time in the BtS mod - but I can't see it is used for anything.

So... anyone who knows what this is (or could be) used for?
 
Seems to be handled entirely by the DLL, so we can tell exactly what it does: CvUnit::move
A feature that has an onUnitChange feature gets replaced by that latter feature as soon as any unit moves into the tile. The Afterworld (total conversion) mod bundled with BtS uses this:
Spoiler :

onUnitChange-hits.jpg
I suspect that the tag was added specifically for that mod.

Triggering on the first unit is similar to goody huts, but those have an element of surprise. If the feature will certainly sooner or later transform in a predictable way, one might as well have the transformed feature from the start. I guess a transform-on-entry tile could present a choice to leave a tile undisturbed for some duration or indefinitely, but I'm not sure what kind of (historical or geographical) narrative would match this mechanism, and one can't easily prevent rival units from entering a tile.
 
Even if it's a function I can't use myself - I'm not that skilled - then there might be "someone" who sees an opportunity in it when they are made aware of it. Thanks for the info f1rpo.
 
Even if it's a function I can't use myself - I'm not that skilled - then there might be "someone" who sees an opportunity in it when they are made aware of it.

i-have-an-idea-garfield.gif


I wonder what would happen if in this scenario:
  • A changes to B on unit move
  • B changes to A on unit move
  • a unit ends its turn on the tile
Will the feature keep altering between A and B turn by turn OR will it cause an infinite loop forcing the player to reach out for the sacred salvation of CTR+ALT+DEL?

An other question: Can it change to NONE? That should just remove the feature.


Some possible uses I can think of is some resource stockpiles (if the feature can be just removed when a unit enters it)
  • Berry bushes: :food: in nearest city
  • Logs: :hammers: in nearest city
  • Treasure chest: :commerce: in nearest city
Unfortunately we don't (yet) have tags to receive yields from units entering a feature.


Some other uses could be:
  • Trap: change into a feature with iTurnDamage
  • Blockade: change into a feature with bImpassible
 
I think NONE in XML will have the effect of removing the feature. And it should only trigger once per unit entering the tile, so no infinite loop.
 
I wonder what would happen if in this scenario:
  • A changes to B on unit move
  • B changes to A on unit move
  • a unit ends its turn on the tile
Will the feature keep altering between A and B turn by turn OR will it cause an infinite loop forcing the player to reach out for the sacred salvation of CTR+ALT+DEL?

In the mod Afterworld it is used this way:
<FeatureInfos>
<FeatureInfo>
<Type>FEATURE_AFTERWORLD_WALLS</Type>
<Description>TXT_KEY_EMPTYENTRY</Description>
...........
<OnUnitChangeTo>FEATURE_AFTERWORLD_BROKEN_WALLS</OnUnitChangeTo>
...........
</FootstepSounds>
<EffectType>NONE</EffectType>
<iEffectProbability>0</iEffectProbability>
<iAdvancedStartRemoveCost>0</iAdvancedStartRemoveCost>
</FeatureInfo>

With my limited skill I would expect we need this too if we wanted B changes to A on (next) unit move.

<FeatureInfos>
<FeatureInfo>
<Type>FEATURE_AFTERWORLD_BROKEN_WALLS</Type>
<Description>TXT_KEY_EMPTYENTRY</Description>
...........
<OnUnitChangeTo>FEATURE_AFTERWORLD_WALLS</OnUnitChangeTo>
...........
</FootstepSounds>
<EffectType>NONE</EffectType>
<iEffectProbability>0</iEffectProbability>
<iAdvancedStartRemoveCost>0</iAdvancedStartRemoveCost>
</FeatureInfo>


But what if this the code behind <OnUnitChangeTo> was changed a bit, so not every kind of unit could do a change like this and it also demanded a certain kind of Tech to do this. Then - say after reaching Modern Era - we could have a worker to "plant" a forest on a tile where we before had a jungle. Or terraform Ice to Plain. Or a GreatEngineer to change Fallout to "nothing"......

Then it actual could be useful in quite a number of ways.
 
But what if this the code behind <OnUnitChangeTo> was changed a bit, so not every kind of unit could do a change like this and it also demanded a certain kind of Tech to do this. Then - say after reaching Modern Era - we could have a worker to "plant" a forest on a tile where we before had a jungle. Or terraform Ice to Plain. Or a GreatEngineer to change Fallout to "nothing"......
There are already modcomps, easier solutions for those :)
 
Actually I have a cool (and nasty :evil: ) idea:

Mirage:
A duplicate of Oasis feature. Looks the same, does the same, even the name is the same. Only difference is OnUnitChangeTo -> replaces it with Mirage feature, that doesn't do anything (and the next turn it also disappears).
It's even nastier in CoM where there is terrain damage: Deserts cause damage to units on them but Oases are safe spots. Now a player sending around Scouts to exploit the land can't so sure about his luck anymore. Muhahahaha!
 
It's even nastier in CoM where there is terrain damage: Deserts cause damage to units on them but Oases are safe spots. Now a player sending around Scouts to exploit the land can't so sure about his luck anymore. Muhahahaha!
I like that....:devil:
 
:hmm: "Hverinn" (Icelandic word)? Else..... no ideas.
 
I was thinking along these lines:

"You were heading toward an Oasis but it turned out to be only a Mirage."

"You were heading toward some Hot Springs but they turned out to be only...
...some Mist?"

How does that sound?
 
I see.
they were lost in the mist​
they were lost in the snow(fog)​
 
I didn't mean to destroy any units on entering the feature.
I was talking about thinking of seeing something but it's only an illusion of it.

In the desert you think you see an oasis but its only a mirage.
In the tundra you think you see some hot springs but its only the mist.
 
I didn't mean to destroy any units on entering the feature.
I was talking about thinking of seeing something but it's only an illusion of it.

In northern Russian dialects, the name for mirages is mara. The so–called "upper" mirages with the display of remote objects are already common on Lake Ladoga, from where the Neva flows. And the colder it is, the more frequent they are. But the name refers, of course, to any atmospheric illusion.
In the southern and central Russian dialects, the word has a funny original meaning. Mara is something blurry, blurring the view / averting the eyes. The mundane version is just an atmospheric phenomenon (mar, hmar -haze), but it can also be a blurred ghost. "Mara lead", which means someone has lost their bearings, is behaving strangely, etc.
There's still a ton of mythology, but it's hardly interesting. In short, the "highest" variant is an archaic female deity with demonic manifestations. At least it sends nightmares, at most death. ("mor" - pestilence).
 
Last edited:
Actually I have a cool (and nasty :evil: ) idea:

Mirage:
A duplicate of Oasis feature. Looks the same, does the same, even the name is the same. Only difference is OnUnitChangeTo -> replaces it with Mirage feature, that doesn't do anything (and the next turn it also disappears).
It's even nastier in CoM where there is terrain damage: Deserts cause damage to units on them but Oases are safe spots. Now a player sending around Scouts to exploit the land can't so sure about his luck anymore. Muhahahaha!
You'd need to make them indistinguishable by yields and terrain damage tooltip, so that you don't preserve false ones by never checking them.
In northern Russian dialects, the name for mirages is mara.
Never heard of it being referred to as mara, but it's better for more universal recognition, since it's a common indoeuropean thing. Great summary!
 
You'd need to make them indistinguishable by yields and terrain damage tooltip, so that you don't preserve false ones by never checking them.
Of course ;)

Never heard of it being referred to as mara, but it's better for more universal recognition, since it's a common indoeuropean thing. Great summary!
If I google for "mara" I don't see anything related to what I want to represent, so I think I'll stay with "Mist".
 
If I google for "mara" I don't see anything related to what I want to represent, so I think I'll stay with "Mist".
If you want, you can still call it mirage, but mist is just wrong with a much more fitting option around that Pecheneg mentioned. Marevo is exactly the same thing as a mirage and it can happen about Hot Springs, but doesn't have connotations of happening in a desert and is easily relatable to all the indo-european peoples if you use the simplified form "mara". There are buddhist demons of misdirection and illusion and a ton of other myths around, how can't you see "anything related"!?
 
:hmm: "Hverinn" (Icelandic word)? Else..... no ideas.
Hverinn is used for hot spring. Hafgerðingar is used for mirage.
There's still a ton of mythology, but it's hardly interesting
Buddhists also have a Māra, a demon king who tried to prevent the Buddha from achieving Enlightenment. Māra represents one's inner illusions. I won't be surprised to learn russian Mara(s), english mare and theravāda's Māra to be more or less the same entity, using mirages to distract us from our way...

To get back to the subject, superior mirage is the technical term for what you want to refer to. If you want to have something more lyrical or more epic sounding, Fata Morgana or Fata Bromosa are also considered as technical terms for "cold" mirages.

 
No, I just want a simple English word (not Russian, Sanskrit or Esperanto) that is fitting for a terrain feature that is replacing Hot Spring for a single turn and than dissapears from the map. 'Mist' will do it. No need to overthink it.
 
Back
Top Bottom