Zunath's Structure System Created by Zunath
Requirements for use:
-
NWNX set up for MySQL or SQLite use (refer to www.nwnx.org for installation instructions for NWNX)
-
CEP2
DESCRIPTION:
This player housing system is designed to give the player more choices than what is found in other housing systems. They are able to freely build their own houses, furniture, etc WITHOUT the need for a DM to intervene. No longer will you have to go into the toolset every time someone builds a house in your game - this system handles all that.
Players realistically build all furniture and houses. They are welcome to work together on projects to make the production process much faster.
All structures are completely persistent and all housing interiors are instanced - meaning a few areas will serve all your players.
INSTALLATION:
(Note beforehand: All scripts are prefixed with "struc_" or "const_". If you have scripts with these prefixes, you may encounter problems. Additionally, these instructions assume you have set up NWNX and CEP2 and they are working perfectly.)
1.) Import "struc_system" into your module. You may receive a message saying you are missing files - this isn't anything to worry about, so just ignore it. It will also ask you if you wish to overwrite any of your current files. Do not overwrite anything!
2.) Go into your module properties and open up the script that is located on your "OnActivateItem" node.
3.) At the bottom of this script, you need to add the following lines. Your script will look a little like this:
void main() {
< Bunch of code that already exists >
ExecuteScript("struc_tool_onuse", OBJECT_SELF); // Player Housing
ExecuteScript("struc_activ_furn", OBJECT_SELF); // Player Housing
}
All you need to do is add those two lines starting with ExecuteScript. Save the script and close it.
4.) Now move on to your OnClientEnter script and open it up.
5.) Again, you will need to add a line to your script. Your code will look a little like this:
void main() {
< Bunch of code that already exists >
ExecuteScript("struc_mod_enter", OBJECT_SELF); // Player Housing
}
(If you do not have a script already on your OnClientEnter node, place "struc_mod_enter" on that node.)
6.) Now move on to your OnModuleLoad script and open it up.
7.) Like before, you will need to add a line to your script. Your code will look a little like this:
void main() {
< Bunch of code that already exists >
ExecuteScript("struc_load_plc", OBJECT_SELF); // Player Housing
}
(If you do not have a script already on your OnModuleLoad node, place "struc_load_plc" on that node.)
8.) Now, for every area you wish to make buildable you need to open up the variables on the area and add the following:
Variable Name: BUILDABLE Variable Type: Int Variable Value: 1
This will make it so players can build a structure in this area. If a player tries to place a structure or create a construction site in an area not marked as buildable, they will be prevented from doing so.
That's it! You're all set up. All you need to do now is scatter resources (Nails, Wood, Iron, Cloth, and Leather) around your module.
BUILDING PROCESS:
Building a structure requires a few steps. The following will explain how you create a structure.
1.) Equip a blunt object. Typically hammers are used but other blunt objects can be used as well. Keep in mind however that you may lose resources if you use any other item besides a hammer.
2.) Use your structure building tool anywhere. If the area is able to be built in, a construction site will appear.
3.) Open up the construction site and go through the options until you find a structure you would like to build.
4.) When the blueprint is set, all you need to do is acquire the necessary resources. Once that's done just start bashing the construction site. You will slowly build the structure.
5.) Once you are finished building, you will find your structure inside of the construction site. Just take it out and now you can place it inside your house or anywhere in a buildable area. Note that ANYONE may take structures that are not placed inside houses.
And that's it! Really simple, huh?
If you built a house, there's a few more steps for actually entering the house.
6.) You will receive a House Tool - this is your master key and will allow you to enter your house and create key copies.
7.) Use your house tool on your house. A dialogue will appear and ask you what you wish to do. You can either enter the house or destroy it. Just click enter the house and if there is an instance available, you will be ported directly to it.
8.) Optionally you can create copies of your key by using the house tool on itself (Not your character, the tool!) This key can then be passed around to your friends.
9.) Your house tool gives you complete control over all of your furniture inside of your house. If you use the tool on a piece of furniture you can choose to rotate it around or pick it up. Note that this only works inside of YOUR house. If you wish to move or pick up structures outside of your house, you will need to use your Structure Building tool on the structure.
LIMITATIONS:
Due to a limitation with the game, you CANNOT sell furniture via NPC merchants. All data stored on the item is deleted when sold or bought from an NPC store. You can, however, sell resources such as wood, nails, iron, cloth, and leather.
That's everything you need to know to use this system. However if you wish to make some changes to how this all works or just want to learn a little more, read on!
CUSTOMIZATION:
House Resource Requirements:
By default, houses require 450 Wood, 350 Iron, 200 Nails, 100 Cloth, and 50 Leather. They are supposed to be quite hard to obtain. However if you wish to modify these amounts open up the script "struc_on_disturb" and look at line 319.
You will see the following:
CreateRecipe("rotd_house", "House", 450, 350, 200, 100, 50);
You may change the numbers as you see fit.
Adding more structures:
If you wish to add your own structures to this system, it will require a little scripting knowledge to do. Take a look at the "struc_on_disturb" script and follow the examples. You will also need to make an item with the same tag and resref of the placeable you want to be created. Additionally, place an int variable on the item named "FURNITURE" with a value of 1.
Adding more housing instances:
Five housing instances have been created by default. However if you have a very active world with many houses you may need to increase the number of instances. The following is the process for doing so:
1.) Create a copy of one of the housing instances. Make sure the resource name is "struc_house###" where ### represents what number of instances you are currently on. So if you are making your sixth instance, it would look like this: "struc_house006"
2.) Open up your new area. You will see a door inside it. Open the properties for this door.
3.) On the "tag" node, you will see "struc_housedoor_###". All you need to do is change that ### to whatever number instance this is. So for example if this is your sixth instance, this door's tag would be "struc_housedoor_006".
4.) Open up the script "struc_hconv_ente".
5.) You will this on line 8: int MAX_NUMBER_HOUSE_INSTANCES = 5; All you need to do is change that 5 to however many instances you have in your module. So if you have six instances, you will change that number to 6. Note that it is simply "6", not "006".
Repeat this process as many times as needed.
Reporting Bugs:
If you find a bug in this system please let me know! You can either post about it on the page on the vault or you can directly e-mail me at: coolty3001@yahoo.com
Special Thanks:
(In no particular order)
- Windwar, for teaching me how to script and some functions used. Without you I wouldn't be able to do any of this!
- Skipper Warlock, Awaaaaaak!
- Secutor
- Chass, for the very original idea found on her Isandor and Xenograph servers
- HunterAP, for the awesome instanced housing idea
- Everyone I kidnapped on Dark Hour for testing
- Papillion and everyone who worked on NWNX2
- CEP2 team - Awesome house placeables!
I know there's lots of people I'm missing, so lemme know if I forgot you! :)
Disclaimer:
You are free to use this system and modify it as you see fit, however I am not responsible for any damage that may be caused by the use of this package.
Creature Appearances Aberrations, Constructs, Dragons, Plants