A hint, and a request, about using Special FX as a Unit or Feature

Discussion in 'Civ4 - Creation & Customization' started by Padmewan, Jun 9, 2006.

  1. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    For any modders out there who aren't already aware of it, there is a whole gold mine of secial FX goodies, in .nif format, in the unpacked /art directory of Civ4. I have had some success slapping some of these into unit art def's or feature def's.

    FX that this has worked with include fireworks, propellor bubbles, dust impact, fog (though it's very hard to see), maybe some others.

    However, a good number of the FX are non-repeating (e.g. wind swirl). This means that instead of playing over and over again, it plays once, when the unit/feature is first instatiated, and never plays again.

    Does anyone have any ideas on how to make these FX repeat? Is it a matter of creating a "Meta-NIF" that invokes the NIF? If so, this would provide us with a quick source of some cheap "units," e.g. by making the wind swirl repeat (and perhaps overlap itself) you'd create a tornado or hurricane.
     
  2. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    a) If an effect repeats is set in the 3dsMax particle system. So it seems like it cannot be redone later on (when in the nif format).

    b) Meta nif (actually a full blown unit without mesh) could work. I"ll try to set up such a unit this evening. It will basically be a dummy that calls an effect in each animation. You can then reuse it for every Effect by hex editing the .kf files.

    Maybe you can also use my Air elemental as tornado (in my sig).

    EDIT:
    c) For feature it might be more difficult. Probably one has to create a new effect.
     
  3. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    Ok as promised an Effect Dummy unit.

    I had no time to test it yet and will go to bed soon. So I hope it works. :D
    It comes with the Animations and an .nif. Obviosly no shader (_fx) nif included. If you look at the nif you will see that there is a hidden sphere. That is in, as the exporter did not allow me to export animations without a mesh.

    What does it do?
    It fires the Effect EFFECT_GENERAL001 all 10 frames.
    (Define it in xml/misc/Civ4EffectsInfo.xml).
    If you want to use it multiple times with different effects you have to copy and hex edit all the .kf files and replace the 001 with another number (i'd recommend not changing anything else)

    The orientation of the Effects might be a problem. I have orientated the Effect in the standard coordinates but it might be that some of firaxis effects need different orientations. Than you can either ask me to rotate it or try modifying the Nif. You have to rotate the Effect_Dummy-Ninode with the rotation matrix. Unfortunateley you wont see what is happening. :(
     

    Attached Files:

  4. RogerBacon

    RogerBacon King

    Joined:
    Nov 16, 2003
    Messages:
    649
    These effects don't have to be attached to a unit, just for your information. I call them directly with Python for some of the spells in my game. In fact, I didn't even learn how to attach them to a unit until much later.

    The following code will trigger the nuke explosion graphic (but no actual damage to anything)
    CyEngine().triggerEffect(gc.getInfoTypeForString("EFFECT_ICBM_NUCLEAR_EXPLOSION"),targetPlot.getPoint())

    Roger Bacon
     
  5. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Thanks to both of you! I don't have much time this weekend but hope to try it out. (Need to find a hex editor).

    @ RogerBacon -- I'd like to use some of these FX as resources or units, so invoking them via script wouldn't really work. But it is definitely good to know. (I think the tutorial uses one of the FX as a way to highlight "Move your unit here." That would be good for quests if we ever get there...)
     
  6. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    You can use it for testing without hex editor Padmewan. Simply use EFFECT_GENERAL001. Hex editing will only be needed if it works and you want to use different unit with different effects.
     
  7. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Very Cool. Here's what happens when I use it with "Wind Swirl," btw:




    This opens up some great new possibilities!!!

    What happens if it only firest it on even frames? Or maybe only once every 10 frames? Would it still "play"?

    I think I will get me a hex editor -- that way I don't have to redefine FX that are already in the FX XML file.

    (btw, like TXT_KEY files, can I create an arbitrary FX file that gets read, or must all FX be added to "Civ4EffectInfos"?)
     
  8. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    Very fine that it works as intended.

    Unfortunateley you will still have to redefine them stll as you can only excange the tags with strings of the same length.

    [/quote]
    Here again a no. He reads only one file. Its like this for all xml files that hold data relevant for play except the text and the Global defines.

    Do you want to fire it more often or less often? (I'd have to so some more dummy units) It now fires aprox every 10 frames.
     
  9. woodelf

    woodelf Bard Retired Moderator

    Joined:
    Jun 12, 2003
    Messages:
    15,036
    Location:
    Gallery
    That is cool looking Pad. Very nifty idea.
     
  10. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    I don't know how quick a frame is and how many FPS the game runs at, but since some of the animations run faster or slower, I think this might matter? I do notice that the FX definition has itself a speed setting to provide a second adjuster.

    Thanks again, Chalid. Hope others find use for this as well...
     

Share This Page