A special feature of NWN:EE was unlocked which allows the creation of new visual effects that make use of internal special effects and functions called ProgFX.

One of those effects was listed as "Spellcasting Failures" but that was just what it was used for in the original game.

What it actually does is allows the user to affix another visual effect to a creature node by name.

Until Varenx experimented with this in July of 2021, nobody really knew what it could be used for, but with some experimentation it was revealed that any named dummy or trimesh node within a model could be targeted.

The outcome is that any existing node could become a position for custom content applied as a visual effect, in the same way that visual effect hair and helmets have been made. You can now make rings that position on the hand, gauntlet overlays (suggested by ShadowM), or even just more accessories that attach to existing parts, for instance boot daggers that pop out during combat. Possibilities are not very limited.

This tutorial will walk you through what files need to be modified to get custom creature accessories into the game.

The second part of this tutorial will go over an extended method for adding additional dummy nodes to your PCs and creatures.

Getting Started

Before you get started, you'll need to have a model to work with. It can be effectively any model, like a ring, or eyepatch, or even just a flame visual effect. This tutorial will not cover making such things, but you can find ample content on the Vault, or pull something useful out of the original content.

The files you'll need to edit include:

  • VISUALEFFECTS.2DA
  • PROGFX.2DA

If you need a copy of those files for your override or development folder, you can extract them using NWN Explorer for EE. ** Which may require special setup **

As of the time of this writing, the 2DA files are located under NWN Main Data > data\base_2da\ > Game Data. Find those two files and export them to your preferred location for development.

Building the ProgFX Line

The first thing you want to do is open PROGFX.2DA in a text editor or your preferred 2DA reader.

You want to find and copy a line from the Type 12 section (or build your own from scratch).

Type 12 ProgFX are listed below:

IDLabelTypeParam1Param2Param3Param4Param5Param6Param7Param8
1200VisualHeadFail12headconjurevim_spellfail************************
1201VisualHandFail12handconjurevim_spellfail************************

To allow for extensions to the base game from BeamDog and/or Ossian Studios, you might consider padding the ProgFX.2da file up to a higher number. As an example, copy one of the blank lines (all stars) and paste it at the end of the file until you reach line 2000 or 5000. The ID column does not need to be perfect, but it helps to have the correct number later. In general, if you don't use an auto-correction feature for that column, such as import into Excel or other spreadsheet program, the correct ID for that line is the line number minus 4. For example, in Notepad++, ID 2209 corresponds with line number 2213.

Next, you're ready to modify your new line. In the type column keep the number 12.

In the Param1 column, reference the dummy or trimesh node you intend to use for your accessory placement. It can be any* node within the model, such as the rhand dummy, or the torso_g trimesh.

*If the model references a supermodel, any nodes "added" in the supermodels will not be visible, meaning that for part-based creature units like players, only the nodes listed in the base phenotype files will be accessible. Look in files such as "PMH0.MDL" or "PFE2.MDL".

In the Param2 column, reference the visual effect model file to apply at the specified location.

Params 3 through 8 are not used as of the time of this writing.

Building the Visual Effects Line

The next thing you want to do is open VISUALEFFECTS.2DA in your text editor or 2DA reader.

Copy the line below and append it to the bottom of your spreadsheet:

2000 <New Visual Effect Name Here> D 0 **** **** **** **** **** **** **** **** 3000 **** **** **** **** **** **** **** **** **** **** **** **** **** **** 0

Note the ID number given here is 2000. Replace that with whatever your new line ID would be.

Examine the layout of a line, and note that the ProgFX_Duration column contains index 3000. Change that value to whatever your new ID was in PROGFX.2DA above.

Line Layout:

Label<New Visual Effect Name Here>Human readable name. Only used as a label. Not functional without advanced nwscript coding.
Type_FDD

Use D for temporary and permanent visual effects like rings and fire.

Use F for instant effects, like impact and cessation visual effects.

OrientWithGround0Does not appear to work in unison with progFX. Just use 0 here.
Imp_HeadCon_Node****Unused here
Imp_Impact_Node****Unused here
Imp_Root_S_Node****

Unused here

Imp_Root_M_Node****Unused here
Imp_Root_L_Node****Unused here
Imp_Root_H_Node****Unused here
ProgFX_Impact****

A reference to a line in progfx.2da. Used if this VFX will play instantaneously on impact, such as with nwscript constant DURATION_TYPE_INSTANT.

SoundImpact****Unused here
ProgFX_Duration3000A reference to a line in progfx.2da. Used if this VFX has a non instantaneous duration, such as with nwscript constants DURATION_TYPE_PERMANENT or DURATION_TYPE_TEMPORARY
SoundDuration****Unused here
ProgFX_Cessation****A reference to a line in progfx.2da. Used if this VFX will play instantaneously at the end of the duration or directly after impact is done.
SoundCessastion****Unused here
Ces_HeadCon_Node****Unused here
Ces_Impact_Node****Unused here
Ces_Root_S_Node****Unused here
Ces_Root_M_Node****Unused here
Ces_Root_L_Node****Unused here
Ces_Root_H_Node****Unused here
ShakeType****

Unused here

ShakeDelay****Unused here
ShakeDuration****Unused here
LowViolence****Unused here
LowQuality****Unused here
OrientWithObject0

ProgFX are already aligned with the node to which they are attached. Just use 0 here.

Testing It In the Game

If you did everything correctly, and your new files are either in Override or Development folder, you should be able to make use of your new visual effect gear.

You'll now need to apply a new visual effect.

Let's say you make a ring visual effect to couple with putting on a ring. Here is a simple test script to run when an item is equipped. **Do not use such a dumbed down script for big modules or persistent worlds**

In your module within the NWN Toolset, make a new script and paste in the following code:

// -------------------------------------------------------------------------
// Custom Item Script Execution Code
// Puts a ring on your finger when equipping a ring
// -------------------------------------------------------------------------

void main()
{
     //get the item being equipped, and the person who put it on
     object oItem = GetPCItemLastEquipped();
     object oPC = GetPCItemLastEquippedBy();

     // Debug
     AssignCommand(oPC, ActionSpeakString("OnEquip Fired"));

     //get the tag on the item
     string sTag = GetTag(oItem);

     // Debug
     AssignCommand(oPC, ActionSpeakString("Item Tag = " + sTag));

     //if the tag is the one we expect for the vfx ring, then apply the visuals
     if (sTag == "VFX_RING")
     {
         //get the visual effect for our ring (Reference to VISUALEFFECTS.2DA)
         effect eRing = EffectVisualEffect(2000);
         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRing, oPC);

         // Debug
         AssignCommand(oPC, ActionSpeakString("Effect Applied"));
     }
}

Finally, in your module properties panel, under the Events tab, enter the name of your new script. 

You'll ultimately want a much more robust tag and equip script, so I have not provided a script for removing the ring once applied. I'll leave that up to the various creators. As a suggestion, try using the same script used by visual effect hats and hair.

Cleanup

Hopefully you ran into no issues making your accessory, but here are a few issues that could come up.


Alignment is wrong – If you tried to make a ring but it aligned at 90 degrees to the hand model, try loading the hand model into your 3D editing software (ex. Blender, GMax, or 3DSMax). You should see that the hand MESH points fist down (negative Z direction), and with thumb in the positive X direction. If your position is wrong, also consider that the position of your ring BASE must be the same as your hand BASE. If your ring MESH is not offset in such a way that it matches the position where a finger would be on the hand MESH, then it will be drawn inside the wrist connection at the center of the BASE. A good way of making a perfectly fitting ring MESH is to clone the AuroraBase node, change its name to what your ring VFX will be, and then parent your ring MESH to the cloned BASE. Move your ring MESH around until it lines up where you think it should.

Extending the Base Character To Have More Accessory Nodes

If you don't like the node placement of the base characters, you can always add more nodes.

While there are many parts which go together to make your character, there's really only a few files that make up the base characters. Those are the four-character phenotype files such as "pmh0.mdl". I think of these files as the structural harness for your character's parts. When your character is loaded up, all the parts are hung on this frame of dummies and positional chunks.

Nothing is animated in these files, instead relying on the supermodel (ex. A_BA_* animation series of files), so there's no worry of messing up the underlying animations by adding nodes to your phenotype files.

You can add as many nodes as you want, and parent them to any other nodes in the harness.

In our example of attaching the ring accessory to the hand model, and then offsetting the ring mesh within the ring MDL file, you could instead make a "lRing" and rRing" pair of dummies and put them in your phenotype file, attached to their respective hands. Then when you make your line in PROGFX.2DA, simply add the node name "lRing" or "rRing". This would allow your ring model to be at position [0,0,0] within your accessory MDL file, just like the other body parts are.

The benefit of using position [0,0,0] accessories is that they work for any node. Otherwise, if an orc hand is longer or wider, the offset within the MDL file needs to be changed per race, per gender, etc. Adding accessory nodes to phenotype files gives you the ability to make just one ring to fit them all. (**At the time of this writing, it is not know if ProgFX visual effects will scale like other visual effects**).

Another example I joked around with was adding an "arse" node, so that you can make spell effects come out your butt. Other examples might include both right and left eye nodes, allowing you to target just one eye or the other. For the boot-knife idea above, you might add a new "toe" node under the "lFoot" or "rFoot" nodes, at the expected boot tip position.

Conclusion

Testing has shown that any dummy or trimesh node within any creature or player model can be targeted. However, testing also showed that attached models cannot be directly accessed, such as armor parts, torches, or weapons. Any sub-node specific to an attached player body part, weapon, etc., will likely not be accessible to you, so you can't include new nodes within a part and expect them to be found.

Any node referenced that the engine cannot locate while applying the ProgFX visuals will simply do nothing. If you have a character or player phenotype that does not have the proper node by name, then that model won't show the applied visual effect. And I don't know if that means it internally isn't making the visual effect data block, or if it skips the process because it isn't able to finish. More testing will need to be done on that.

Remember that because of how danglymesh and skinmesh work, an accessory placed on a node making use of vertex animation won't also move the accessory. It will clip into the material being animated.

If you fine more stuff related to this tutorial, please add it. Everybody should be making these accessories now and I can't wait to see what people bring to NWN:EE.




  • No labels