Tip #1: Naming Conventions - Area TAGs

Tip#2: Naming Conventions - Script names

Tip#3: Using Crimson Editor to write scripts


Tip #1: Naming Conventions - Area TAGs by Jassper [10:12:06]

This is my own process that I use when building areas. Originally designed for NWN1 but it can still be applied to NWN2.

Feel free to use all or part of this method. This system also allows plenty of room for expansion.

  Area Tags Constructor = "Primary Area ID"+"Secondary Area ID"+"Special Area ID"+"_"+"Zone Letter"+"##"+"_"+Sub-Area Notation" (if applied)

Primary Area ID =

i [indoors]



o [outdoors]


u [underground]


s [special]


x [does not apply]


[Add more constructors as needed]

Secondary Area ID =

f [forest]


p [plains]


d [desert]



t [tundra]


j [jungle]


m [mountains]


v [volcanic]


c [city / towns]


w [wet lands / swamp]



s [special]


x [does not apply]


[Add more constructors as needed]

Special Area ID =

h [hot]


c [cold]


g [good]


e [evil]


n [neutral]


s [special]


x [does not apply]


[Add more constructors as needed]

Zone Letter =

Letters a through z. If more letters are needed, go to aa - zz, then aaa - zzz etc. more on this latter.



## =

The number corresponding to the order in which the area was constructed.


i.e., if building the first area for Zone letter "a", then the number is "01". Likewise the second area constructed for Zone letter "a" would be "02", and so on.



Sub Area Notation =

If used, this can help identify sub areas off of a main area. This part can get a bit tricky but only because you must make a choice on how  you want to handle Sub areas, and what should be considered a sub area. Yes, that means thinking on your part :P



As an example, I build my first area in my module and it is an outdoor area in an evil forest.


My area TAG would be: "ofe_a01"

[NOTE] This could be used for the area blueprint ResRef if you prefer.




Why such an arcane tag? I use the are TAG to identify the area the Player is currently in for scripting purposes. For example, I have a useable item that can only be used outside. When the item is activated I first check to see if the Primary Area ID is the letter "o". If it is not - then the script exits and nothing happens. This also helps in applying effect such as a damage effect when in cold areas. The rest of the TAG, Zone letters and numbers is simply to keep the area TAG or ResRef Unique.






I will walk through building a small mod using 3 main areas. Then we will get into the subarea notation.


This mod will have 3 main areas, a City, a Forest, and a Swamp. I first give each main area a Zone Letter.




I also have 2 other builders, Bob and Sally. With each Main area getting a Zone letter there is no worry of duplicate tags from each builder. We also decide that the swamp is an evil place. So let construct the tags. I'll walk through the City TAG. The City will be an outdoor area so the Primary ID is "o". It's a City so the Secondary ID is "c" and there is nothing special about this city so the Special ID is "x". The Zone letter is "a" and this is the first main area constructed so the number is "01" The complete TAG is then "ocx_a01"




What if there is a second main area to the City? This is where the number notation comes into play. For example, I decide the City area is too small. So I split the city into 2 main areas instead of one. I simply increment the number like so;




What if I decide to add a second forest, not associated with the first Forest? Simply assign it the next available zone letter, in this case letter "d".


How does this relate to area transition and interconnections? It doesn't. Nor is there a need for that. You will drive yourself bonkers trying to name or TAG your areas according to how they connect. Just keep a list of your areas and let the area transitions take care of the connections.




You can construct your entire mod this way if you like. For larger mods you will run out of Zone letters quickly, or if your wanting an extra level of organization we can apply the same method to sub areas. I consider a sub area to be an area built off of a main area. For example, lets add a house and a store to the City South main area. There are 2 ways to doing this - neither is right or wrong. It simply depends on what makes most sense to you and how complex your areas are.


Method 1: Each of the sub areas are indoors and the Secondary and Special IDs are unimportant. So the first part of the TAG is "ixx_". Now, because this is a sub are of City South I add the main city TAG part of "a01_" and then I start a new letter+Number combination of "a1" for the house, and "a2" for the Store.




Method 2: This is done basically the same way except we increment the last letter instead of the number. This allows better organization for multiple Sub area layers.





For example, if a basement is added to the house, using a sub area layer 2, the tag would be "uxx_a01_a2" Useing Method 1, to do this you would need to add yet another letter because "a2" is already used for the store, "uxx_a01_a1_a"



But what if Bob builds a sub area of the forest that also connects to Swamp that Sally Built? Bob would use his Zone letter notations and number them according to the order they were built. Again let the area transitions worry about the interconnections of zones. Don't try to note the connections in the TAGs. You will go mad!!



Tip #2: Naming Conventions - Script names by Jassper

This is my own process that I use when naming scripts. Originally designed for NWN1 but it can still be applied to NWN2.

Feel free to use all or part of this method. Through the years I have tried several methods, some of others and some of my own. I find this method most logical and it makes it easy to find the script I am looking for. As we all know, nwn1 doesn't allow for folders within the script list to organize our scripts. This method "alphabetizes" them by category. On the release of nwn2, Obsidian has also suggested a similar method. Items listed in red are NWN2 specific.


Script Name Constructor = ObjectID+"_"+EventID+"_"+Object Name (or part of)

  Object ID = a [area]
    c [creature]
    d [door]
    e [encounter]
    h [merchant]
    I [item]
    m [module]
    n [boss NPC]
    p [placable]
    r [trap]
    s [special]
    t [trigger]
    x [transition]
    v [conversation]
  Event ID = aqi [OnAquireItem]
    aci [OnActivateItem]
    atc [OnAreaTransitionClick]
    blc [OnBlocked]
    cik [ OnClick]
    cle [OnClientEnter]
    cll [OnClientLeave]
    clo [OnClose]
    cls [OnCloseStore]
    cre [OnCombatRoundEnd]
    con [OnConversation]
    csa [OnCutSceneAbort]
    dam [OnDamaged]
    doa [OnDeath]
    dia [OnDisarm]
    dis [OnDisturbed] [OnInventoryDisturbed]
    ent [OnEnter]
    exh [OnExhausted]
    ext [OnExit]
    fto [OnFailedToOpen]
    bet [OnHartbeat]
    lok [OnLock]
    mat [OnMeleeAttack]
    mod [OnModuleLoad]
    mos [OnModuleStart]
    ope [OnOpen]
    ops [OnOpenStore]
    per [OnPerception]
    pcl [OnPCLoaded]
    pha [OnPhysicalAttack]
    pld [OnPlayerDeath]
    ply [OnPlayerDying]
    pei [OnPlayerEquipItem]
    plu [OnPlayerLevelUp]
    rez [OnPlayerRespawn]
    plr [OnPlayerRested]
    pui [OnPlayerUneqipItem]
    res [Onrested]
    spw [OnSpawn] [OnSpawnIn]
    sca [OnSpellCastAt]
    tnt [OnTrapTriggered]
    uai [OnUnAquireItem]
    unl [Onunlock]
    use [OnUse]
    usd [OnUsedDefined]
    sc# [StartingConditional] # = a number
    at# [ActionsTaken] # = a number
    end [EndConversationNormal/Aborted]
  Object Name = Part of the name the script or event it is associated with. In the case of a "universal" type script use a generic name
    Example: A OnSpawn script for a Boss NPC named "Captian Tivious" = "n_spw_tivious"
    Example: A generic OnSpawn script that can be used for any NPC = c_spw_spawndead

This system alphabetizes all your scripts and keep all the object types grouped together, so if your looking for a OnOpen Door script, you scroll down to the d's on the list and then look for "d_ope". This narrows down the search considerably.


What about Tag Based Scripting? The beauty of tag based scripting is the fact the Item tag Doesn't have to match the script name (exactly). We simply modify the OnActivateItem Script from ExecuteScript(GetTag(oItem)) to ExecuteScript("i_aci_"+GetTag(oItem)) So the Item Tag could be "Wond_of_Wonder" and the script for it would be "i_aci_wond_of_wo". The Neat thing is, the case and length of the tag don't matter as it will automatically be truncate to 16 characters and drop the case.

  NOTE: NWN2 allows script names to be as long as 32 characters and allows for uppercase in the script name. Not confirmed at this time if the script names themselves are case sensitive.
  Last but not least, include files. I prefer my include files to be listed first - before any others are. So I always prefix my invlude files with "00_". However, some may prefer "inc_" as a prefix.
Tip #3: Useing Crimson Editor to write scripts

I felt that the nwn2 script editor removed a lot of features from nwn1. One of my favorite ones was the ability to change colors of keywords and formatting. Crimson Editor is a simple text editing free ware program that allows for keyword definitions and coloring. Although this editor does not compile the script, it allows you to write scripts without the toolset. The best thing is you can save your scripts into any folder. Now I can simply open Crimson Editor, open the script I want and copy+paste into the script editor in nwn2. This eliminates the need to export scripts from one mod then import them into another. Hopefully a scripting plug-in is on it's way but until then, I have Crimson Editor.

After downloading and installing Crimson Editor, Download the file NWN2 Keyword Definition File from the vault. Included with the download is instructions on installing the keyword definition file. The NWN2 Keyword Definition File can also be found here in the Download section.

example Image: