Discover SPY Unit

Discussion in 'Civ4 - General Discussions' started by deepkhem, Dec 11, 2014.

  1. deepkhem

    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.
     
  2. s.bernbaum

    s.bernbaum Mostly lurking

    Joined:
    Dec 2, 2006
    Messages:
    2,804
    Location:
    The wilds of Montana
    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.
     
  3. Seraiel

    Seraiel If you want anything from I please ask in German

    Joined:
    Sep 6, 2011
    Messages:
    8,165
    Gender:
    Male
    I once played a time-victory and had 50+ spies in every city, still, the AI was able to sabotage my buildings frequently.
     
  4. Lennier

    Lennier Emperor

    Joined:
    Mar 10, 2013
    Messages:
    1,389
    Gender:
    Male
    Location:
    Orange County, NY
    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.
     
  5. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,229
    Gender:
    Male
    Location:
    Somewhere in California
    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...
     
  6. 1984plusplus

    1984plusplus Chieftain

    Joined:
    May 23, 2011
    Messages:
    59
    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.

    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.

    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.
     
  7. nfw

    nfw King

    Joined:
    Aug 31, 2010
    Messages:
    733
    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
     

Share This Page