TofuSojo
Chieftain
So I really want to make a mod that adds a building that gives a city a chance to shoot down incoming missiles (like the Flechette Defense building in SMACX and the SDI wonder in Civ4).
Here is my outline of how it should work:
event: unit attacks
check: attacker is Cruise Missile or Nuclear Missile
check: target hex is within 5 hexes of city
check: city has Satellite Defense building
outcome: 75% chance missile is destroyed (attack stopped)
I think I can figure out everything but the most important part...the event that starts it all. Details...details...I am not encouraged from what I've read so far in this forum as the impression I get is that there is simply no event we can hook into for this
. The closest thing is the one for unit death but that doesn't include the killer.
Though I'ld prefer to detect the attack and have this work as outlined, I am fine with anything that yields the same results, such as if units killed by missiles have a 75% chance to come back to life...I'm also willing to replace the game's missiles with my own custom units if need be.
These are the events I've flagged as possibilities: UnitActionChanged, SerialEventUnitMoveToHexes, SerialEventUnitMove, SerialEventUnitTeleportedToHex, UnitStateChangeDetected, UnitMemberCombatTargetChanged, UnitMemberCombatStateChanged. Though I think the Serials are all for only what happens on the player's screen so those can be discounted?
If anyone can provide any help it would be greatly appreciated! A useful thread I missed, a workaround, anything.
Note: Though I really want to make this mod for everyone anyway, I plan to make another that makes both missiles much more powerful (like in all other Civ games) making missile defenses needed.
Here is my outline of how it should work:
event: unit attacks
check: attacker is Cruise Missile or Nuclear Missile
check: target hex is within 5 hexes of city
check: city has Satellite Defense building
outcome: 75% chance missile is destroyed (attack stopped)
I think I can figure out everything but the most important part...the event that starts it all. Details...details...I am not encouraged from what I've read so far in this forum as the impression I get is that there is simply no event we can hook into for this

Though I'ld prefer to detect the attack and have this work as outlined, I am fine with anything that yields the same results, such as if units killed by missiles have a 75% chance to come back to life...I'm also willing to replace the game's missiles with my own custom units if need be.
These are the events I've flagged as possibilities: UnitActionChanged, SerialEventUnitMoveToHexes, SerialEventUnitMove, SerialEventUnitTeleportedToHex, UnitStateChangeDetected, UnitMemberCombatTargetChanged, UnitMemberCombatStateChanged. Though I think the Serials are all for only what happens on the player's screen so those can be discounted?
If anyone can provide any help it would be greatly appreciated! A useful thread I missed, a workaround, anything.
Note: Though I really want to make this mod for everyone anyway, I plan to make another that makes both missiles much more powerful (like in all other Civ games) making missile defenses needed.