-
Notifications
You must be signed in to change notification settings - Fork 77
Customizing Your Schema
This page will tell you how to add new stuffs on your schema with few examples. If you think this page does not really helpful, You can go watch some existing examples on other schemas or you can comment/issue on this git.
Reminder, This Wiki does not tell you the basic knowledge of GLua. Since NutScript is more developer friendly than other Role Play Gamemodes on Garrysmod, You have to learn GLua to make new stuffs with NutScript.
If you still don't know where to learn about GLua, Go to This site.
To run NutScript, You need to create/download schema. If you're skilled enough, you can make completely new schema with blank schema (Sample Schema) Template. But, Most people are not skilled enough. So, If you're trying to make new schema and think you're not skilled enough, start with another existng schema like HL2RP, Modern RP Base.
If you're running the server, You'll have to try make your server unique to keep new/old players on your server. Here is some guide to add new and possibly unique stuffs on your server.
There must be some stuffs that you really don't like in nutscript. To change it by default, you need to create some config files.
First, you have to create sh_config.lua
file in schema/configs
folder. If the folder does not exist, you have to create it.
First, you have to create sv_database.lua
file in schema/configs
folder. If the folder does not exist, you have to create it.
You'll make pretty much items with NutScript and Most of items will have pretty similar functions. To make your work less with good efficiency, You'll have to learn how to make base. Here is simple steps to make base.
- Make Template Item.
The base item does not supports full auto-refresh on all variables on base-derived items. So, before you're making something new, I recommend you to create template item in theschema/items
folder and start work on functional stuffs. - Make the item as base.
If you're done with template item, It's time to make it as base. All you need to do is just makebase
folder inschema/items
folder and drag that template item with good name.
Remember, If your item lua file's name issh_XXX
, XXX is the classID of the Item. - Create New Items with the base.
This step will be described on down below.
Unless you're making new template/unique item everytime, Making new item won't be that hard. But, Still, There is pretty much ways to create Items.
- Creating Lua Generated Item
In Nutscript, You can generate items dynamically. This means you can create many items just like batch process. But, This feature requires some lua knowledge. If you're skilled enough, You can understand the meaning of this feature by looking at Example. - Creating Base-Derived Item
This is Typical and Most-used way to create new items. To create Base-Derived Items, You need to create new folder onschema/items
. After you creating new folder in your item folder, Place your item lua file in the folder. After then, The Framework will load that item file automatically. - Creating Unique Item
Without creating the base folder, you still can add items. But, If the item lua file is not in base folder, It will be unique item which don't has any base.
You'll meet some kind of wall If you're coding the item. Here is some guides to avoid that wall.
- Setting Default Item Data
To set default item data, You have to use the item's hook
ITEM:onInstanced(id, x, y, instancedObject)
.
Before setting up new attribute, You must think the attribute is necessary and reasonable. You must add FUNCTIONAL attribute on your schema. To add new attribute, you must create 'attributes' folder in your '/schema' folder. After Creating the folder, By making/bringing lua files in the folder, You can register new attributes for your schema. Here is some Examples that might be helpful for registering new attribute.
To add new faction, you must create 'factions' folder in your '/schema' folder. After Creating the folder, By making/bringing lua files in the folder, You can register new factions for your schema. Here is some Examples that might be helpful for registering new factions.
Before applying the files on your schema, You must keep in mind the example contains some "schema-only" features.
To add new class, you must create 'classes' folder in your '/schema' folder. After Creating the folder, By making/bringing lua files in the folder, You can register new classes for your schema. Here is some Examples that might be helpful for registering new classes.
Before applying the files on your schema, You must keep in mind the example contains some "schema-only" features.
You can get plugins in here
and place those stuffs in plugins
folder.
Cloud Repo was worked on by the Chessnut. It's still included in the framework.