Dale
Mohawk Games Developer
- Joined
- Mar 14, 2002
- Messages
- 7,831
Welcome to Dale's MOD Code Factory! 
I'm going to be placing here code that can be used in an advanced fashion by modders to enhance their own mods.
NOTE: These code items WILL require you to modify and compile a new SDK DLL file! Do not attempt this if you are unsure what you are doing!
NOTE2: Due to new features in my full combat mod to allow for turning each component on/off code and DLL's are not provided as seperate anymore. You only need one DLL and turn the game options off.
Also note that I will not be providing support for how to compile or use the SDK. Those questions are for different threads in a different forum.
--------------------------------------------------------------------------------------------------------
Ranged Field Bombardment:
SDK Code (Vanilla & Warlords): http://forums.civfanatics.com/downloads.php?do=file&id=2708
What it does:
Units that are given this ability lose the vanilla bombard ability of bombarding adjacent cities, and gain a ranged bombard ability on units, cities and improvements. The bomb range xml setting defines how far away the unit can bombard. Simple click the bombard icon and select the tile you wish to bombard. Allowed squares show in green when mousing over them, similar to the air bomb event.
How to Implement:
Step 1: Add the new code to the DLL and compile.
Step 2: Modify the #define value in CvDefines.h to true or false (true turns on the mod) and re-compile.
Step 3: Add the new interface to CIV4InterfaceModeInfos.xml
Step 4: Modify the MISSION_BOMBARD event in CIV4MissionInfos.xml
Step 5: Add the new xml flags to the schema in CIV4UnitSchema.xml
AND in the CvUnitInfo element:
Step 6: Modify your units by adding the following code in Civ4UnitInfos.xml
NOTE: The value of iDCMBombRange is the number of tiles the unit can bombard. EG: Artillery with a iDCMBombRange of 2 can bombard 2 tiles away.
--------------------------------------------------------------------------------------------------------
Missiles (suicide units):
SDK Code (Vanilla & Warlords): http://forums.civfanatics.com/downloads.php?do=file&id=2708
What it does:
The missile ability causes units to explode on contact with the enemy. This explosion is done during combat. One combat round will be processed (so a chance the missile itself could be hit for anti-air units you create [see below in notes]) and then the missile will explode. The nuke range ability has been enabled for non-special nuke units when they have the missile tag. This means your missile can be nuclear as well to create tactical nukes.
How to Implement:
Step 1: Add the new code to the DLL and compile.
Step 2: Modify the #define value in CvDefines.h to true or false (true turns on the mod) and re-compile.
Step 3: Add the new xml flags to the schema in CIV4UnitSchema.xml
AND in the CvUnitInfo element:
Step 4: Modify your units by adding the following code in Civ4UnitInfos.xml (this will make them missile units)
NOTE: If you give a missile unit nuke abilities by change nuke range to: <iNukeRange>1</iNukeRange> the unit will become a nuclear missile. In this way by defining the air range and air bomb abilities for the unit you just click on air bomb mission and select the target in range. Your unit is now a tactical nuclear missile.
NOTE2: Since one combat round is processed before the missile explodes, you could create your missile unit, then the anti-missile unit with a combat bonus against the missile unit. By testing and getting the correct values the anti-missile unit has the chance to destroy the missile before impact. Example: You could have a ballistic missile and a SDI unit with a combat bonus against the missile. The SDI unit has a chance to destroy the missile before the ballistic missile explodes.
NOTE3: The missile ability and nuke range change can be made to any unit. You could give just the missile ability to a Japanese fighter in a world war 2 scenario to have kamikazee zeros, or give both abilities to a spearman to have a nuclear suicide spearmen troop. The options are endless.

I'm going to be placing here code that can be used in an advanced fashion by modders to enhance their own mods.
NOTE: These code items WILL require you to modify and compile a new SDK DLL file! Do not attempt this if you are unsure what you are doing!
NOTE2: Due to new features in my full combat mod to allow for turning each component on/off code and DLL's are not provided as seperate anymore. You only need one DLL and turn the game options off.
Also note that I will not be providing support for how to compile or use the SDK. Those questions are for different threads in a different forum.

--------------------------------------------------------------------------------------------------------
Ranged Field Bombardment:
SDK Code (Vanilla & Warlords): http://forums.civfanatics.com/downloads.php?do=file&id=2708
What it does:
Units that are given this ability lose the vanilla bombard ability of bombarding adjacent cities, and gain a ranged bombard ability on units, cities and improvements. The bomb range xml setting defines how far away the unit can bombard. Simple click the bombard icon and select the tile you wish to bombard. Allowed squares show in green when mousing over them, similar to the air bomb event.
How to Implement:
Step 1: Add the new code to the DLL and compile.
Step 2: Modify the #define value in CvDefines.h to true or false (true turns on the mod) and re-compile.
Step 3: Add the new interface to CIV4InterfaceModeInfos.xml
Code:
<InterfaceModeInfo>
<Type>INTERFACEMODE_BOMBARD</Type>
<Description>Ranged Field Bombard</Description>
<Help>Ranged Field Bombard</Help>
<CursorType>CURSOR_AIRBOMB</CursorType>
<Mission>MISSION_BOMBARD</Mission>
<HotKey>KB_B</HotKey>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<HotKeyAlt/>
<bAltDownAlt>0</bAltDownAlt>
<bShiftDownAlt>0</bShiftDownAlt>
<bCtrlDownAlt>0</bCtrlDownAlt>
<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
<bVisible>1</bVisible>
<bGotoPlot>0</bGotoPlot>
<bHighlightPlot>1</bHighlightPlot>
<bSelectType>0</bSelectType>
<bSelectAll>0</bSelectAll>
<Button>,Art/Interface/Buttons/Actions/Bombard.dds,Art/Interface/Buttons/Actions_Builds_LeaderHeads_Specialists_Atlas.dds,2,1</Button>
</InterfaceModeInfo>
Code:
<MissionInfo>
<Type>MISSION_BOMBARD</Type>
<Description>TXT_KEY_MISSION_BOMBARD</Description>
<Help>TXT_KEY_MISSION_BOMBARD_HELP</Help>
<Waypoint>NONE</Waypoint>
<EntityEventType>ENTEVENT_BOMBARD</EntityEventType>
<iTime>16</iTime>
<bTarget>0</bTarget>
<bBuild>0</bBuild>
<bSound>1</bSound>
<Button>,Art/Interface/Buttons/Actions/Bombard.dds,Art/Interface/Buttons/Actions_Builds_LeaderHeads_Specialists_Atlas.dds,2,1</Button>
</MissionInfo>
Code:
<ElementType name="bDCMBombard" content="textOnly" dt:type="boolean"/>
<ElementType name="iDCMBombRange" content="textOnly" dt:type="int"/>
Code:
<element type="bDCMBombard" minOccurs="0"/>
<element type="iDCMBombRange" minOccurs="0"/>
Code:
<bDCMBombard>1</bDCMBombard>
<iDCMBombRange>1</iDCMBombRange>
NOTE: The value of iDCMBombRange is the number of tiles the unit can bombard. EG: Artillery with a iDCMBombRange of 2 can bombard 2 tiles away.
--------------------------------------------------------------------------------------------------------
Missiles (suicide units):
SDK Code (Vanilla & Warlords): http://forums.civfanatics.com/downloads.php?do=file&id=2708
What it does:
The missile ability causes units to explode on contact with the enemy. This explosion is done during combat. One combat round will be processed (so a chance the missile itself could be hit for anti-air units you create [see below in notes]) and then the missile will explode. The nuke range ability has been enabled for non-special nuke units when they have the missile tag. This means your missile can be nuclear as well to create tactical nukes.
How to Implement:
Step 1: Add the new code to the DLL and compile.
Step 2: Modify the #define value in CvDefines.h to true or false (true turns on the mod) and re-compile.
Step 3: Add the new xml flags to the schema in CIV4UnitSchema.xml
Code:
<ElementType name="bDCMMissile" content="textOnly" dt:type="boolean"/>
Code:
<element type="bDCMMissile" minOccurs="0"/>
Code:
<bDCMMissile>1</bDCMMissile>
NOTE: If you give a missile unit nuke abilities by change nuke range to: <iNukeRange>1</iNukeRange> the unit will become a nuclear missile. In this way by defining the air range and air bomb abilities for the unit you just click on air bomb mission and select the target in range. Your unit is now a tactical nuclear missile.

NOTE2: Since one combat round is processed before the missile explodes, you could create your missile unit, then the anti-missile unit with a combat bonus against the missile unit. By testing and getting the correct values the anti-missile unit has the chance to destroy the missile before impact. Example: You could have a ballistic missile and a SDI unit with a combat bonus against the missile. The SDI unit has a chance to destroy the missile before the ballistic missile explodes.
NOTE3: The missile ability and nuke range change can be made to any unit. You could give just the missile ability to a Japanese fighter in a world war 2 scenario to have kamikazee zeros, or give both abilities to a spearman to have a nuclear suicide spearmen troop. The options are endless.