Powerful, configureable, complete area management and control system. A NWN Spawn System Companion Script
Serious worlds and modules need serious item management!
Everyday I see small scripts that perform one or two small item related functions, most often requiring editing of certain events here and there. Creature corpses (oh but you need to edit the OnDeath event!) and self closing doors(Need to edit the OnOpen event)... Respawning chests, and little men running around keeping the ground clean. Useful functions for sure, but using all the various scripts can be a pain. That's where Item Manager comes in.
Item Manager provides all these features, and more, in one simple to use, drop in script. You don't even need to edit any events! Just import the included ERF, and dorp the provided invisible placeable into the area to manage. What could be easier?! In addition, the Item Manager works side-by-side with one of the best scripts ever made, Palor's NWN Spawn System! With only these two scripts, you can take care of probably 80% of any module's needs!
So just what can the Item Manager do? Well, here is a short feature list:
Extremely easy to install and use. An import module is provided for total ease
Clean up items left on the ground around NWNSS spawnpoints, or special Cleanup points
Fully configurable without touching a single line of the script
Have killed creatures leave an actual correct creature corpse rather than basic loot bags, without having to modify the npc/creature at all! Handled transparently by the Item Manager with a simple switch.
Optional per item or per spawnpoint visual and area effects during cleanup sweeps
Ability to have cleaned up items moved to the inventory of some placeable, npc, or even a merchant for resale!
Optionally remove items from the ground and redistribute them amongst chest/crates/barrels and other placeables in the area with an inventory. Keep your area clean and your treasure chests stocked at the same time!
You can configure whether items in creature corpses/loot bags are cleaned up in one pass, or dropped to the ground first before being cleaned up.
Automaticly close and/or relock doors after use with a simple switch. Yes, now your doors can be relocked after being unlocked!
Have spawned creatures intelligently autoequip any items in thier inventory without knowing what those items are ahead of time.
Set creatures to only leave treasure when killed by a player and not another creature.
Set creatures to randomly pick up items found on the ground or in other creature's remains, and even use them if they are better than what the creature has already.
Delay cleanup of special items by a variable amount
Installation is extremely easy! Just follow these simple steps:
Download the ZIP file and extract it to a directory of your choosing.
In the toolset, load the module you wish to add Item Manager to, and select FILE | IMPORT. Select the item_manager.erf file. Important: If you are upgrading from a previous version, you will be told that there are conflicts in certain scripts. To perform a proper upgrade, you must click the Select All button to overwrite the old version of Item Manager. If you do not, you will not upgrade and will still be running the old version.
You will now have a custom placeable available in your module. Simply add the Item Manager Placeable to the areas you want it to manage. Only place 1 per area.
If you plan to use the Creature Corpse functionality, you will also need to import the item_manager_cc.erf file. You do not need to place the resulting item anywhere. Just import the file, and the Item Manager will take care of the rest.
To control the behavior of the Item Manager, you can set "switches" in two places. The first place is on the Item Manager Placable itself. Switches here globally affect its behavior in that one area. The second place switches can be placed is on the NWN Spawner Spawnpoint. Switches are always in uppercase, and are seperated by an underscore "_". Switches are placed in the NAME field of the appropriate placeable or spawnpoint.
Here are two examples:
Spawnpoint Name: SP_SX02_CU_CC
This spawnpoint has 4 switches. SP, SX, CU, and CC. The SP and SX switches are switches for the NWN Spawner itself. The CU and CC switches are for the Item Manager and instruct the Item Manager to cleanup around this spawnpoint, and to make any creatures spawned here leave actual creature corpses when they die rather than generic loot bags.
These switches are set on the Item Manager Placeable and therefore will globally affect all behavior in this area. The CUT switch tells it to cleanup every 10 minutes, and the CUR switch tells it to cleanup in a radious of 20 meters around the spawnpoint being cleaned.
For a complete list of valid switches that you can use on your Spawnpoint to control the Item Manager behavior for that spawnpoint, see the Spawnpoint Switch Quick Reference and Spawnpoint Switches sections of this document.
~ Click on the Switch tag to see more details about its use. ~
CC - This switch is to use creature corpses for loot rather than generic loot bags upon creature death.
CU - Used to determine whether to clean up items on the ground around the spawn point.
PU10 - Give the creatures a 10 percent chance to pick up any items within 5 meters.
AI - When specified, all creatures spawned at the spawnpoint will intelligently autoequip any items in their inventory when they first spawn.
PK - Only have the creatures drop loot if a player kills them.
Item Manager Placeable Switch Quick Reference
~ Click on the Switch tag to see more details about its use. ~
CUT:10M - Cleanup around each specified spawnpoint every 10 minutes.
CUR:50 - Cleanup around each specified spawnpoint for a radius of 50 meters.
CUD:my_merchant - Cleanup items from the ground and place them inside the merchant with the tag "my_merchant": for resale.
RI - Redistribute items during cleanup to placeables in the area with an inventory (chests, crates, etc).
RIR:200 - When redistributing items to placeables, search for placeables within 200 meters of the spawnpoint being cleaned.
DI - When cleaning, items inside a loot bag or creature corpse are first dropped to the ground for one cleaning cycle instead of being cleaned up immediately.
CD:60 - Scan for open doors in the area every 60 seconds, and close any that are left open.
LD:60 - Re-Lock any doors that are left unlocked every 60 seconds.
CCB - When creating creature corpses, spawn a blood pool under the corpse.
CCE - When moving loot to the creature corpse, include the creature's equipped items.
MI:10 - When cleaning up, scan placeables (in the radius specified by RIR) and limit thier inventory to a maximum of 10 items, deleting items if needed.
DLY:1H - Delay the cleanup of "special" items for 1 Hour above the normal cleanup time.
CUE:60 - When cleaning up an item, display visual effect #60 (Small flame) at the item's location.
CAE:31 - When cleaning up around a spawnpoint, display area effect effect #31 (Delayed Fireball Effect) at the spawnpoints location.
The Item Manager is designed to work with NWNSS to extend the functionality even further. In order to achieve this, there are some switches you can set on your spawnpoints to control the Item Manager's behaviour for that specific spawnpoint.
These switches are placed into the NAME field of the NWNSS spawnpoint you wish to adjust.
See the NWNSS switch documentation for more details.
CC
This switch is to use creature corpses for loot rather than generic loot bags upon creature death.
CU
Used to determine whether to clean up items on the ground around the spawn point.
PUnn
When used the creature has a nn percent chance to pick up any items within 5 meters. This is checked each heartbeat (approximately every 6 seconds). The creature will pickup items off the ground, or grab tems that are inside the remains of another creature or player. They will only pick up one item each time.
Examples:
PU50 - Each creature spawned by the spawnpoint has a 50% chance of picking up an item on the ground, or from within a corpse, that is within 5 meters.
AI
When specified, all creatures spawned at the spawnpoint will intelligently autoequip any items in their inventory when they first spawn.
PK
Only have the creatures drop loot if a player kills them.
To further control the behavior of the Item Manager, there are several switches which are placed into the NAME field of the Item Manager Placeable. These switches affect the behavior of the Item Manager throughout the whole area.
CUT:<time>
Sets the delay between each cleanup sweep. By default, <time> is in seconds. To indicate that the time is in minutes or hours, add a "M" or "H" to the end of the time.
Examples:
CUT:60 - Cleanup around specified spawnpoints every 60 seconds.
CUT:300 - Cleanup around specified spawnpoints every 300 seconds.
CUT:10M - Cleanup around specified spawnpoints every 10 minutes.
CUT:1H - Cleanup around specified spawnpoints every 1 hour.
CUR:<meters>
Sets the radius, in meters, around each spawnpoint that should be cleaned.
Examples:
CUR:50 - Cleanup in a radius of 50 meters around each specified spawnpoint.
CUR:5 - Cleanup in a radius of 5 meters around each specified spawnpoint.
CUR:300 - Cleanup in a radius of 300 meters around each specified spawnpoint.
CUD:<destination>
By default, cleaned up items are simply destroyed from the module. With this switch you can instead move the items into the inventory of another valid object. This has many uses, such as giving all the items to an NPC, dropping them into a treasure chest, or even placing them into the inventory or a merchant so that the items can be resold!
The <destination> is the TAG of the object which will receive the items. In the case of multiple objects with that TAG, the one nearest to the item manager object will be used.
Important Note: Due to the way the script currently works, the item is actually destroyed, and then re-created on the destination. I have been unable to find any way to simply move the item. While this works fine for standard NWN items, you may find problems with any custom items you have in your module. In order for this to work correctly on custom items, the item's TAG and BLUEPRINT RESREF must be IDENTICAL in both name and case (They should both be lowercase). The BLUEPRINT RES REF can be found on the ADVANCED tab in the item properties. If they are not identical, then the item will be cleaned up and destroyed, but will NOT be recreated properly on the destination.
Examples:
CUD:my_merchant - Cleanup items and give them to the merchant with the tag "my_merchant".
RI
The Redistribute Items switch is a very handy feature. This allows you to take the items and evenly (as evenly as possible) redistribute them amongst chests, crates, barrels, and other placeables with an inventory in the area. Essentially this switch keeps the areas clean and the treasure chests stocked all at the same time.
Important Note: The RIR switch must be used in order to specify the radius to find valid placeables. If it is not used, no placeables will be found and the items will simply be destroyed. Also note that the same important rule about item tags as with the CUD switch applies here.
RIR:<meters>
This switch specifies the radius around the cleanup or spawnpoint in which to find valid placeables to use when using the RI switch.
DI
When a player kills a creature, the creature's loot is dropped in some form of Loot Bag. It doesn't always look like a bag, but essentially it is a container which holds the loot from that creature. By default, the cleanup action will cleanup all items in these bags as well in one pass. By specifying this switch however, the cleanup will be done in TWO passes. On the first cleanup pass, the items will be removed from the loot bag and dropped to the ground where the bag is. The bag will then be removed. On the second pass, the items on the ground will be treated just like any other item on the ground and be cleaned up.
CD:<seconds>
This switch causes the Item Manager to monitor all doors in the area. Whenever a door is found to be open, it will automaticly close it after the specified duration. The duration for this switch is always in seconds.
LD:<seconds>
This switch causes the Item Manager to monitor all doors in the area. Whenever a door is found to be unlocked when it was originally locked, it will automaticly lock it after the specified duration. The duration for this switch is always in seconds.
Important Note: This switch will only affect doors which are initially locked when the module loads. It will not lock any other doors. The door is relocked at the same lock DC as it was originally.
CCB
Used with the CC switch. This switch causes a blood stain to appear under the creature corpses. The blood stain will vanish with the corpse during cleanup, or upon emptying its inventory.
CCE
By default, only the items in the creatures inventory is moved to his corpse. This switch will cause the creatures equipped items to be moved as well. Equipped Creature Items are not affected.
Important Note: The "droppable" flag which can be set on individual inventory items in the NWN editor is not used when creating creature corpses, as there is no way to access it via script. Also note that the same important rule about item tags as with the CUD switch applies here.
MI:<number of items>
This switch can be used to control the amount of items kept in placeables such as chests, crates, etc. during each cleanup sweep, all placeables in the area are checked, and the number of items in its inventory counted. If there are more items in the placeable than the maximum set with this switch, then the first x items are removed and destroyed in order to bring the total item count down to the max allowed. If you use the RI switch to keep placeables stocked, then I highly suggest you also use this switch to keep them under control. The two switches are not linked though, and can be used seperately from each other.
DLY:<delay time>
This switch allows you to still cleanup "normal" items often, but have cleanup of "special" items delayed for a specified amount of time. If during normal cleanup, a special item is found, then that specific item's cleanup will be delayed by the time specified in this switch. In order to mark and item as "special", you must create a custom item in the toolset. The item's TAG must be prefixed with "dly_", for example, "dly_specialsword". The blueprint must also be the same. Any such item, when found during cleanups, will be delayed the specified amount of time.
By default, <delay time> is in seconds. To indicate that the time is in minutes or hours, add a "M" or "H" to the end of the time.
Examples:
DLY:60 - Delay cleanup of special items for 60 seconds
DLY:300 - Delay cleanup of special items for 300 seconds
DLY:10M - Delay cleanup of special items for 10 minutes
DLY:1H - Delay cleanup of special items for 1 hour
CUE:<effect_id>
This switch causes the Item Manager to display a visuall effect at the location of each individual item it cleans up. The effect IDs are listed below.
Important Note: Not all of these effects have been tested. Some probably wouldn't make sense to use, others may not even work. If you find an effect ID that doesn't work at all, please let me know and I will remove it from the list.
CAE:<effect_id>
This switch causes the Item Manager to display an area effect at the spawnpoint or cleanup point currently being cleaned. The area effect will last for 5 seconds, and will be visual only. It will not cause damage or other character effects. The effect IDs are listed below.
Important Note: Not all of these effects have been tested. Some probably wouldn't make sense to use, others may not even work. If you find an effect ID that doesn't work at all, please let me know and I will remove it from the list. Also note that I have found no way to set the SIZE of the effect. They seem to use a default size. This means that the effect used may be larger than the cleaning radius or smaller. It will not affect the radius used for cleaning, but it may look odd.
In order to get the most use out of the AI switch, you should understand the basics of how the script will choose the best weapon/armor to equip.
Weapons
If the creature has the AMBIDEXTERITY feat, then it will attempt to equip two 1-handed weapons if it can. It will favor 1-handed weapons over 2-handed weapons, but will use 2-handed weapons if that is all it has.
Weapons are evaluated by damage rolls. Only the base item type is take into account for damage rolls. Special effects are not currently used at this time.
Armor
The creature will choose the armor with the highest AC value.
Shields are chosen in the following order, from worst to best; Small Shield, Large Shield, Tower Shield.
Creatures with the AMBIDEXTERITY feat will favor a second weapon over a shield, but will equip a shield if it only has a single 1-handed weapon.
All creatures will favor 2-handed weapons over shields. Shields will only be equipped if it has only a 1-handed weapon equipped.
Note: At this time, there is no check done to ensure the creature can use the chosen item or weapon.
This section will address common issues that you may have while trying to setup your area.
Question:
When using custom items with the CUD, DI, or CC switches, my items aren't moved properly. They get destroyed from the original location, but aren't properly re-created at the destination!
Answer:
Custom items must have identical TAGs and BLUEPRINTs in order for these switches to work correctly. Both must also be in lowercase.
The easiest way to "fix" existing custom items, is by altering the tag using the procedure below:
Find the item in the palette on the right hand side, right click on it and choose EDIT.
Click on the ADVANCED tab, and highlight the BLUEPRINT. Press Ctrl-Ins to copy the blueprint to the clipboard.
Change back to the BASIC tab, and highlight the item's TAG. Press Shift-Ins to paste the blueprint.
The tag and blueprint should now both be identical. Simply click OK to save your changes to that item.
Item Manager is designed to work alongside the NWN Spawn System. Soem functions of the Item Manager also require that you use the NWN Spawn System. For the best results, use both scritps in your module.
This is a small program to help make proper names for waypoints used with NWN Spawn System. There isn't a helper application for the Item Manager itself, but this app is great for use with the NWN Spawn System, and it also includes the Item Manager switches which go on the Spawnpoint.
If you know of addition companion scripts or tools please let us know.
I would say around 75-80% of this script is all community suggested features. This script is made for the community and your feedback helps to shape it and defines what features are added, removed or adjusted.
If you have an idea that you think would make a good feature, or even just be cool, please let me know. I am constantly working on the script and I am more than happy to add any feature that would make this script even better.
If you have a problem with a feature that is not listed in the Troubleshooting section, please post about it. I don't just release this script, I also support it. :)
The history of the script
The following are topics that were used for different versions.