Nuclear Explosion Animation w/o ICBM

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
I added a new spy mission which allows spies to set off a "nuclear device" in cities. (Go Civ2!) It works perfectly, except it's missing the awesome mushroom cloud. Is there anyway to get the ICBM animation to play right after I trigger the nuke?

I already tried creating an ICBM unit on the tile and setting it off by the pushMission() function, but it seems to check to make sure that the unit can do the mission (which it can't, because the players are not at war...). I'd rather not go through the hassle of re-writing those with a new parameter just for my special case...

Is there a simple way to play the animation?
 
I just started programming in the SDK, so excuse me if I'm showing my ignorance, but could you...

Add a second ICBM unit and making it not available to the players. Then change the code in CvUnit::canNukeAt to ignore the !isEnemy check for that unit. You would probably have to add a new GlobalDefinesAlt.xml field to indicate the second ICBM unit type.
 
Good call on the triggerEffect TheJ, and it looks like it is available in the SDK via gDLL->getEngineIFace()->TriggerEffect.
 
Good call on the triggerEffect TheJ, and it looks like it is available in the SDK via gDLL->getEngineIFace()->TriggerEffect.

Okay, but I don't understand the second parameter, NiPoint3. What values does it accept?
 
Nvm, I figured it out. Good Call on the TriggerEffect function, The J and General Tso, worked like a charm.

Now my spies can set off nuclear bombs, just like the old days... :mischief:
 
Uh-oh! :d
 
Can you post the final code snippet so others can see how to do this in there mods? I always cry a little on the inside when I read, "How do I . . . ? Nevermind, I figured it out!" without an explanation of what actually worked.
 
Can you post the final code snippet so others can see how to do this in there mods? I always cry a little on the inside when I read, "How do I . . . ? Nevermind, I figured it out!" without an explanation of what actually worked.

Depends on what you want to see. I *could* post the code for the new mission, but what fun is that?

If you just want to see the function for the nuclear explosion, it's this:

Code:
gDLL->getEngineIFace()->TriggerEffect((EffectTypes)GC.getInfoTypeForString("EFFECT_ICBM_NUCLEAR_EXPLOSION"), pPlot->getPoint(), 0);
 
You guys weren't meant to see the thread. Top Secret AND 1.70 work. Shoo! :mischief:

Not you know? I'm a Jedi :D. I'm very nosy fellow :lol:. Anyway, looking forward to see how it works out. Just bought 3GHz dual core with 4gb ram computer from ebay. We will see how it impacts my game :D.
 
Depends on what you want to see. I *could* post the code for the new mission, but what fun is that?

If you just want to see the function for the nuclear explosion, it's this:

Code:
gDLL->getEngineIFace()->TriggerEffect((EffectTypes)GC.getInfoTypeForString("EFFECT_ICBM_NUCLEAR_EXPLOSION"), pPlot->getPoint(), 0);

Can you post the Python version of this code?

Respectfully,

Orion Veteran :cool:
 
IDK what it would be in python, but it is listed in the API, so you should be able to use it.
 
Can you post the Python version of this code?

Respectfully,

Orion Veteran

I haven't tested it but this should work.

CyEngine().((EffectTypes)gc.getInfoTypeForString("EFFECT_ICBM_NUCLEAR_EXPLOSION"), pPlot->getPoint())

Of course you need to create pPlot before calling it.
 
You don't need to cast to effect types, it takes an int as a parameter in python; I know that much. ;)
 
And you're missing the triggerEffect() function in there:

Code:
CyEngine().triggerEffect(gc.getInfoTypeForString(" EFFECT_ICBM_NUCLEAR_EXPLOSION"), pPlot->getPoint())
 
And you're missing the triggerEffect() function in there:

Code:
CyEngine().triggerEffect(gc.getInfoTypeForString(" EFFECT_ICBM_NUCLEAR_EXPLOSION"), pPlot->getPoint())

I get an invalid syntax for the following part of the command:

pPlot->getPoint())

Is there another way to express getPoint?

Spoiler :

Code:
def handleInput (self, inputClass):
# Mine Warfare Mod

	EliminateMines=CvEventInterface.getEventManager()

	if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 779 and inputClass.getData2() == 779):
		self.pPushedButtonUnit = g_pSelectedUnit
		iX = self.pPushedButtonUnit.getX()
		iY = self.pPushedButtonUnit.getY()
		pPlot = CyMap().plot(iX, iY)
		iOwner = g_pSelectedUnit.getOwner()
		iUnitID = g_pSelectedUnit.getID()			
		pPlayer = gc.getPlayer(iOwner)
		pUnit = pPlayer.getUnit(iUnitID)
		[COLOR="Red"][B]CyEngine().triggerEffect(gc.getInfoTypeForString("EFFECT_ICBM_NUCLEAR_EXPLOSION"), pPlot->getPoint())[/B][/COLOR]
		CyInterface().setDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT, True)



Orion Veteran :cool:
 
Only three mistakes in one line. I'm getting better. :rolleyes:

I really need to slow down and watch what I type.

Edit: The space before EFFECT shouldn't be there either. That appears to be caused by a problem when posting on this forum (I've had it happen before).
 
Top Bottom