1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[XML+Python] SpawnUnits 2016-10-05

[XML+Python] SpawnUnits

  1. The_J
    This small mod component allows the player to spawn units at predefined turns at predefined positions, depending on Civ and scenario.
    So if you use this mod component, you can easily define via XML that for scenario XY the Americans should get at turn 170 on an america map 10 minuteman somewhere at the east coast.
    ATTENTION: This mod component is not "ready to use" for end users, because it doesn't contain real spawn events, just 2 examples how to use it for modders.

    Included files:
    - Python\CvEventManager.py, has 4 modifications, all labeled with "SpawnUnits". At 2 points you will have to change the folder name for your mod (currently "SpawnUnits")
    - Python\SpawnUnitsUtil.py. Just drop this file into the same folder like the CvEventManager. Nothing to change in this file
    - XML\Text\SpawnUnits_GameText.xml, for a message
    - XML\CustomXML\CIV4SpawnUnitInfos.xml, with 2 examples how to use the file (these 2 examples are random, not possible real events; both examples trigger at turn 2, so that you can easily test it).

    Misc info:
    - The scenario name in the CIV4SpawnUnitInfos.xml has to be put in WITHOUT the file extension
    - There's no logic check for promotions, so you can give invalid promotions to the units
    - The algorithm for unit placement checks the destination plot. If the plot is invalid, it will check the surrounding plots. If these are invalid too, then the units will spawn in the capital (unless the civ is barbarian, or the units are water units and the capital is not at the sea).

    For the plot check, following things are considered:
    - Water units will only spawn on water
    - Not water units (means everything else) will only spawn on land
    - Air units will only spawn in cities
    - Neither will spawn on impassable tiles
    - No units will spawn in enemy units or enemy cities
    - No units will spawn in another civs territory, if you do not have open borders, war, the civ is your vassal or in your team
    - barbarian units will not spawn in the territory of a player with the great wall (that's automatically detected, based on the XML values, so no need to search for the great wall in the file)

    This mod component was requested by topsecret and dacubz.

    If you have any questions, then please ask them in this thread.


    1. spawnunit_O8m.jpg