How to detect a missile attack

TofuSojo

Chieftain
Joined
Sep 28, 2014
Messages
41
Location
Orlando, FL
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.
 
Maybe not a big help, but there are some Versions of SDI projects for CiV.
There is a table in the projects, that allows to ..

Code:
<Column name="NukeInterception" type="integer" default="0"/>

We use it in CCTP, but iam not sure if it works as intended, doesnt get the time to play test that long in the last time.

Also Hulfgars mod use iirc in older version some lua code to make SDI working.
 
Thanks for the quick reply!

I'm not sure where you found that line of code. I've looked in the Buildings xml, where all the building and wonder tags are, and that's not there. I noticed you called it "projects" though which is what wonders were called back in Civ4 if I recall...this mod will be for Civ 5 if there was confusion.

Sorry, I'm new. What is CCTP? I will investigate this Hulfgars mod too.

Vielen Dank

Oh and I should say that I would think RunCombatSim would be the perfect event to use but I read on a post here that BNW broke it and we can't use it as a hook for mods anymore...
 
The tag i posted isnt part of the buildings.
You find it under XML/Gameinfos/CiV5Projects.xml

In the past several modders used it to create a Project (like to Apollo ones), and then use the nuke interception tag to create f.e SDI.
But like i said iam not really sure if it works, since several features where broken since BNW.

CCTP is short for Community Call to Power, its a complete conversation of Civ, with new eras, new features, many new technologies, buildings ....
Would be to long to post all this here;=)
 
Back
Top Bottom