Discover SPY Unit

deepkhem

Chieftain
Joined
Dec 2, 2014
Messages
12
Can we make a unit that can detect other spy units within a range of tiles ??

and make him kill them ??

if yes how to change the xml codes ???

Thanks a lot.
 
Your spies do that in your territory for the tile that they are on. I would look at the code for the SAM Infantry, since they attack air units within a one tile range of their tile. I don't know if the code is in the XML or the Python. You may have better luck asking in the Creation & Customization forum than here.
 
I once played a time-victory and had 50+ spies in every city, still, the AI was able to sabotage my buildings frequently.
 
Only the first spy (or Security Bureau) contributes to catching spies in the tile--so if you had 50+ spies in every city and every tile, you were wasting 49 of them. I think I remember you posting about that game.

If one of your spies (or security bureau) detects an enemy spy, it automatically kills it so you don't actually see it. I think the OP wants a unit that can let you see the enemy spy and then choose to kill it. I have no idea how to implement such a thing.
 
Only the first spy (or Security Bureau) contributes to catching spies in the tile--so if you had 50+ spies in every city and every tile, you were wasting 49 of them. I think I remember you posting about that game.

If one of your spies (or security bureau) detects an enemy spy, it automatically kills it so you don't actually see it. I think the OP wants a unit that can let you see the enemy spy and then choose to kill it. I have no idea how to implement such a thing.

Don't we have ships that can detect submarines and destroy it? I figure you implement the spy with the same coding, although the same coding may leave them susceptible as ships can now detect spies...
 
The Creation and Customization Forum is probably a better place for inquiries about modding. Also, I should point out that when modding, you never want to modify the original file in case anything goes horribly wrong. Instead, copy the file into you custom assets folder or a mod and edit it there.

Can we make a unit that can detect other spy units within a range of tiles ??

That should theoretically be pretty easy. If you look in CIV4UnitInfos.xml, you'll see there are two ways to make a unit invisible. The <Invisible> tag comes with the <SeeInvisible> tag and is what submarines and stealth destroyers use. The <bInvisible> tag is what spies use. In order for a unit to be able to see spies, you'll have to set their <bInvisible> to 0 and put something like INVISIBLE_SPY in their <Invisible> tag. (I believe you can put whatever you want in the tag, but I haven't tried this myself so I'm not absolutely sure.) Then put INVISIBLE_SPY in another unit's <SeeInvisible> tag, and that unit should be able to see spies like destroyers can see submarines.

and make him kill them ??

Once visible, a spy can be killed by any unit that is capable of attacking ground units...provided you are currently at war with the civ whose spy you've revealed. If not, killing it becomes much more complicated. Making spies <bAlwaysHostile> would let you attack them even if not at war, but I believe it would also make them unable to move into other civ's cities or tiles with other civ's units. Giving a unit the ability to kill spies without going to war would probably take more than just XML modding.
 
Well you can code them like privateers, perhaps.

Also in LOR special force are invisible to almost all, but can be revealed by certain units, you can probably mimic that
 
Top Bottom