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

Flying Mod [SDK Mod]

Discussion in 'Civ4 - Mod Components' started by RogerBacon, May 21, 2006.

  1. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    Hello All,

    Updated to version 2.0 6/25/2006
    Updated to version 1.1 5/25/2006
    version 1.1 had 62 downloads
    version 1.0 had 45 downloads

    Screenshots here: http://forums.civfanatics.com/member.php?u=38089
    Download here.

    From the readme:

    Flying Mod
    by
    Roger Bacon
    version 2.0 (6/25/2006)

    As of Version 2.0 this mod now includes Dale's "Missile Mod", "Bombardment Mod", and "Mad Nukes Mod", along with enhancements I have made to those mods (setter functions mostly).

    THE MOD:
    This mod allows users to add a <bFlying> tag to any unit they want. A unit that has <bFlying>1</bFlying> will be able to move over both water and land. There is no need to, nor should you, change the domain type. It should be DOMAIN_LAND just as before. You can still limit a uint to coastal water squares by adding the following to its description (same as the galley unit).
    <TerrainImpassables>
    <TerrainImpassable>
    <TerrainType>TERRAIN_OCEAN</TerrainType>
    <bTerrainImpassable>1</bTerrainImpassable>
    </TerrainImpassable>
    </TerrainImpassables>

    Also, you should add the following AI tag to the unit so it will attack water units.
    <UnitAI>
    <UnitAIType>UNITAI_ATTACK_SEA</UnitAIType>
    <bUnitAI>1</bUnitAI>
    </UnitAI>

    Version 2.0 update:
    Dale's Bombard mod: allows a unit to bombard targets at range
    Dale's Mad Nukes Mod: allows players to pre-target their nukes
    Dale's Missile Mod: Allows a unit to be defined as a missle. Missile units die after one round of combat

    My changes from Dale's mods:

    Missiles can no longer do recon or transfer missions. Missiles don't fly out to a ship to re-arm it when it runs out. Missiles have to be loaded when the ship is in port.

    PYTHON Extentions:
    bool isFlying() returns true if the unit can fly, false otherwise
    void setFlying(bool newValue) enables a unit to fly or disables its ability to fly.

    With these functiosn you can control individually on hte unit level what can fly and what can't. So, for example you could make a fly spell and enable its targets to fly. Or you could disable an individual gunship's ability to fly.

    Update 2.0
    Added new Python commands:
    void CvUnit::setDCMBombValue(bool bNewBombardValue) gives or removes a unit's ranged bombardment capability. If you give a unit bombad value be sure to give it a range as well.
    void CvUnit::setDCMBombRange(int bNewBombardRange) sets a unit's ranged bombardment range to bNewBombardRange)
    void CvUnit::setDCMMissile(bool bNewMissileValue) sets or removes the unit's status as a missile. Good for creating Kamikaze's mid-game.
    void CvUnit::setAirRange(int bNewAirRange) Sets the unit's air range. If you make a plane a Kamikaze you probably should double its range as well.

    From Dale's mods:
    bool CvUnit::getDCMBombard() returns true if a unit has ranged bombard capability
    int CvUnit::getDCMBombRange() const returns a unit's ranged bombardment range
    bool CvUnit::getDCMMissile() const returns true if the unit is a missile unit
    - CyUnit::getDCMMad() returns true if nuke has a target
    - CyUnit::getDCMMadPlot() returns the target plot or NULL
    - CyUnit::getDCMPlotOwner() returns the owner of the target or NO_PLAYER (-1)
    - CyPlayer::getDCMIncoming() returns the number of incoming targets (own cities targetted by enemys)
    - CyPlayer::getDCMOutgoing() returns the number of your nukes with targets
    - CyPlayer::getDCMMadDeter() returns the value of the AI's MAD deterent level
    - CyPlayer::setDCMMadDeter(int value) sets the AI's MAD deterent level


    THE XML
    You must put the CIV4UnitSchema.xml in your My Documents\My Games\Civ4\CustomAssets\xml\units folder.
    I have included the XML entry for the gunship. You can copy this one over your own gunship entry or just make the changes mentioned above.

    Update 2.0
    Added new unit "Tomakawk" missile and "SSBN" sub. There is also a Python script that will load two tomahawk missiles on your sub every trun it is in port (up to the limit of 8). I did this because missiles shouldn't take a whole turn to build since cities can only build one unit a turn.
    Tomahawk graphics by Snafusmith. I made the button. Snafusmith. also made an Ohio class SSBN whoulc whould be better for the SSBN than the stock sub but I had problems getting it to display properly with the missiles loaded so, be default, the SSBN included with this mod uses the regular sub graphics.

    New XML tags for units
    <bFlying>1</bFlying> Lets a uint move over land and water

    From Dale's mods
    <bDCMBombard>1</bDCMBombard> Allows a unit to make ranged bombardments
    <iDCMBombRange>3</iDCMBombRange> Defines the max range a unit can bombard
    <bDCMMissile>1</bDCMMissile> Defines the unit as a missile unit. Missile units die after one round of combat. "Missile" doesn't have to eb a real missile. It could be a suicide bomber, Kamikaze, or anything else that you want to be suicidal.

    THE DIFFERENCES BETWEEN DLLs

    There are two seperate DLLs included. One is the FlyingOnly mod. The other combines the Flying mod with my "Borders over Water" mod ,my "Three-square Radius Cities" mod, and my "AlwaysWar" mod. The Flying-only mod has not been updated to version 2.0 at this time. That is planned for the future.
    Copy the DLL of your choice to your My Documents\My Games\Civ4\CustomAssets\ folder.

    BONUS

    I have also modded the game so that real air units (DOMAIN_AIR) that have more than one movement point can do multiple missions per turn. Currently none of the air units in Civ have more than one movement point so this won't change your game any unless you make a unit with more than one movement point. This could represent, for example, an advanced plane like the F-15 that can target and engage multiple threats at a time.

    BONUS2
    Added combat zoom mod. In vanilla civ the option to zoom in on battles only applies to battles where you are the attacker. Now if you have the camera zoom option enables it will work for battles where you are the attacker or battles where you are the defender.

    BONUS AlwaysWar
    Changed the option GAMEOPTION_ALWAYS_WAR so that EVERYONE is always at war with everyone they meet. In vanilla civ using that option means that everyone is at war with the human player but the AIs still work together as normal.

    Update 2.0
    BONUS WONDER
    A new world wonder "Lindbergh's trans-Atlantic crossing" has been added. The civ that completes it will have 2 added to the range of their air units. No new graphics at this time but someone on the forum is working on it and it should be available shortly.

    BONUS (LIMIT?)
    Air units doing a rebase mission are limited to 2 * range instead of being able to teleport anywhere.

    SOURCE CODE

    All of the *.h and *.cpp files are the source code. Non-modders can just ignore those.
    To find just the Flying mod changes search for "Flying Mod" and "FlyingMod". Sorry about that. I didn't realize I had put a space in some of the comments and not in others.

    Enjoy,
    Roger Bacon

    Version History
    1.0 5/20/2006 Initial release
    1.1 5/25/2006 Corrected the "Flying only dll" - it actually had all the features still in it. Also added the camera mod (see bonus2 baove).
    1.2 6/08/2006 Added AlwaysWar Bonus
    2.0 6/25/2006 Added Dale's Missile mod, Bombardment mod, Mad Nukes Mod. Added setter functions for the preceding and removed some missile missions (recon and rebase). Added new wonder. Limited transfer range for planes.
     
  2. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    Good job! :goodjob:

    I'm liking the bonus function as well. A very good idea IMO.

    Do you mind if I get this included this in the CCP?
     
  3. Dale

    Dale Mohawk Games Developer

    Joined:
    Mar 14, 2002
    Messages:
    7,050
    Can you stack "flying" units and non-DOMAIN_LAND units together?
     
  4. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    Thank you and please do.

    Probably not. In the code there are a lot of sections that basically say "If it's a land unit and the terrain is water don't allow X". I changed those to "If it's a land unit and it doesn't have flying don't allow X". You could add the code yourself easily enought but there's no reason to that I can think of. In the game you shouldn't be able to tell the difference between a land unit with flying and a water unit with flying if you added the code.

    Roger Bacon
     
  5. Caesium

    Caesium Radiant!

    Joined:
    Jan 14, 2006
    Messages:
    526
    Do I need all af the sourcecode files in the zip?
    Or are some in this because of your other mods?
    Because I'd try to integrate this into my mod, but your other two mods wouldn't really fit to the rest of my mod...
     
  6. Dale

    Dale Mohawk Games Developer

    Joined:
    Mar 14, 2002
    Messages:
    7,050
    Well, if it goes onto water you should be allowed to stack a gunship / flying unit with a ship.
     
  7. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    Well, I didn't try stacking it on a ship but since you can stack any ground unit in a transport you should also be able to stack gunships in a transport since they are still ground units (they're just flying ground units). You could, of course, further limit this by defining a special class like the carrier does for planes.

    [edit]
    Wait, by 'stack' do you mean just put them in the same square? If so then, yes, there is no problem with that.

    Search for "FlyingMod" and you will see the files that are needed. All but three of them are needed for the flying mod. Off hand I don't remember the three that aren't needed right now.

    Roger Bacon
     
  8. Dale

    Dale Mohawk Games Developer

    Joined:
    Mar 14, 2002
    Messages:
    7,050
    I figured transports would work, but (to use the vanilla gunship unit) gunships should be able to land on carriers and battleships (even modern frigates, but they aren't in the game).

    But also think from a non-vanilla perspective. In a fantasy game someone might want to stack dragons with their sea serpents. :)

    Dale
     
  9. Spartan117

    Spartan117 Immortal

    Joined:
    Apr 11, 2006
    Messages:
    1,180
    Location:
    Chicago
    can the helo attack navy units?
     
  10. Dual

    Dual Gun Mage

    Joined:
    Mar 28, 2005
    Messages:
    492
    Location:
    The Gateway to the West
  11. Craig_Sutter

    Craig_Sutter Deity

    Joined:
    Aug 13, 2002
    Messages:
    2,753
    Gender:
    Male
    Location:
    Calgary, Canada
    I'm not a modder, but is it possible to manipulate such multiple domain units so that they can only traverse land squares that have a river running along the edge.

    I'm thinking navigatable rivers here.

    For instance, your "flying" unit would check (via python I suppose) when attempting to enter land domain squares whether a river feature was associated with it (in the WBS plot info), and not be able to enter if there were no river.

    Also, "flying" doesn't mean "flying" in actuality - that is, are the units still attackable as land units?
     
  12. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    uhm, well humans have been hunting birds from forever now... and I'm pretty sure birds do fly.
     
  13. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    Yes. No problem.
    The AI will only attack water units if you add the appropriate AI tag to it, like I mention in the readMe: UNITAI_ATTACK_SEA

    These are still land units (DOMAIN_LAND) so they can still be attacked by land units.

    Roger Bacon
     
  14. Starship

    Starship Warlord

    Joined:
    Feb 9, 2006
    Messages:
    197
    This is excellent, great work!
     
  15. Caesium

    Caesium Radiant!

    Joined:
    Jan 14, 2006
    Messages:
    526
    What about flying over mountains?
     
  16. Craig_Sutter

    Craig_Sutter Deity

    Joined:
    Aug 13, 2002
    Messages:
    2,753
    Gender:
    Male
    Location:
    Calgary, Canada
    So, the "flying" unit can attack naval units... can Naval units attack the flying unit, though.
     
  17. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    Thank you.


    Yes.

    You'll need to set the unit's XML tag
    <bCanMoveImpassable>1</bCanMoveImpassable>

    Roger Bacon
     
  18. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    Idea and your work is very good. In Patch 1,61 it&#180;s not possible to write DOMAIN_NONE anymore, and your work helped me to get old possibilities to the game under new Patch 1,61
    Thanks
     
  19. Dual

    Dual Gun Mage

    Joined:
    Mar 28, 2005
    Messages:
    492
    Location:
    The Gateway to the West
    Well, I tried out the combined dll, and decided it made the individual cities too powerful for my taste. But when I switched to the "Flying only" dll I'm still getting the bigger cities and borders over water mods.

    Did you accidentally make both the dll files the same?
     
  20. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    If you swiched DLLs and then loaded a saved game you'll probably still have the larger cities. That's because I'm pretty sure the arrays that hold each city's workable squares are saved with the save game.

    Roger Bacon
     

Share This Page