Creation/Dev/Basics of NPC-Control: Difference between revisions

From Graal Bible
Line 41: Line 41:


=== [[Image:rc_npclist_normal.png]] Database NPC list ===
=== [[Image:rc_npclist_normal.png]] Database NPC list ===
The Database NPC list gives a list of [[Database NPCs]] on the server. Database NPCs have the capability to be anywhere on a server, they have their own identity (#N) and have the ability inside NC to allow the user to modify it's flags and script.
The Database NPC list gives a list of [[Database NPCs]] on the server. Database NPCs have the capability to be anywhere on a server, they have their own identity (#N) and have the ability inside NC to allow the user to modify its flags and script.


Like classes, you can add a new Database NPC by clicking the '''Add''' button, which will present you with a screen like this.
Like classes, you can add a new Database NPC by clicking the '''Add''' button, which will present you with a screen like this.

Revision as of 22:57, 7 September 2009

What is NC?

NC stands for NPC-Control, which allows server administrators to control the NPC Server, and to add, edit, update and delete scripts on a server.

NC is a part of RC (the tool which server staff use to administrate servers), and requires the "NPC-Control" right on the server. When NC is active, you will find five NPC-Server related buttons inside your RC.

What are these buttons?

Rc classlist normal.png Class list

Class list.PNG

The Class list brings up a list of all the classes currently saved on the NPC-Server. Classes are scripts on a server which can be brought into any other script, such as a level NPC, or a Putnpc2 NPC.

You can add scripts to the server by clicking the Add button, at which you will be asked to name the class. When you have named the class, you will then be given a window to put your script into. Clicking Apply will save your script, and place it in the Classes list, where you can return and modify your script at any time.

If you want to delete a class, select it in the Class list and then press the Delete button.

Rc levellist normal.png NPC Level list

The NPC Level list shows an editable list of levels, which are being served by the NPC-Server.

Rc localnpcs normal.png Local NPC list

The Local NPC list button, when clicked, asks for a level name. After entering a level name, the NC will give you information and statistics on NPCs in that level. A typical NPC may look like this.

Variables dump from npc Control-Train

Control-Train.type: OBJECT
Control-Train.scripter: Skyld
Control-Train.level: era_skyldoffice.nw

Attributes:
Control-Train.image: 
Control-Train.script: size: 1042
Control-Train.visibility flags: visible
Control-Train.id: 1008
Control-Train.head: 
Control-Train.xprecise: 30.5
Control-Train.yprecise: 30
Control-Train.timeout: 0.22192
Control-Train.scripttime (in the last min): 0.003244
Control-Train.scriptcalls: 60

These are all details related to the given NPC, such as it's present image, any visual statistics such as head, body, and colours, timeout, script size, timeouts and position. Variables in the NPC that were set on the serverside may also be shown here.

This is quite a useful way of finding out details for NPCs in a level, in case you need to debug them.

Rc npclist normal.png Database NPC list

The Database NPC list gives a list of Database NPCs on the server. Database NPCs have the capability to be anywhere on a server, they have their own identity (#N) and have the ability inside NC to allow the user to modify its flags and script.

Like classes, you can add a new Database NPC by clicking the Add button, which will present you with a screen like this.

Dbnpc addwindow.PNG

Here, you can specify various things about the NPC, such as it's Name ID, it's script ID, the type of NPC (mainly for identification purposes), the scripter's name and it's default level, X and Y.

The names and IDs must be unique when creating a Database NPC.

When you create your NPC, it will be added to the Database NPC list, and from here, you can start to work with it. Right-clicking a Database NPC will give you a menu that looks like this.

Dbnpc selectmenu.PNG

From here, you can:

  • View Attributes which shows attributes of the NPC, like the Local NPC list does
  • Edit Script which allows you to edit the script for the database NPC
  • Edit Flags which allows you to modify the this. flags for the database NPC
  • Reset which clears the this. flags of the NPC, warps it to it's default location and restarts script execution
  • Delete which removes the Database NPC and it's flags from the server
  • Warp which asks for a new location to position the Database NPC at
  • Update Level which instructs the server to update the level that the Database NPC is in.

Rc weaponlist normal.png Weapon NPC list

Weapons list.PNG

The weapons list contains a list of all the weapon scripts on the server. Weapon NPCs can be added to players, and appear in the Weapon Select.

Like Classes, you can add new weapons by clicking Add and specifying a name. Then you can save a script into NC and add it into the player's attributes.

You can re-edit a weapon NPC by selecting it in the Weapons list and clicking Edit, or deleting by clicking Delete.

Weapon NPCs also accept an Image, which can be set at the top of the Script Editing window, and will give the weapon an icon to display in the player's Weapon Select.

RC Commands

There are a couple of "RC Commands" which allow control over the NPC-Server. To use them, simply type them into RC. The main ones are as follows:

  • /savenpcs which saves a copy of NPC-Server NPCs into the database. The NPC-Server must be online for this command to work.
  • /npcstart which instructs the NPC-Server to start, if it has not done so already.
  • /npcshutdown which instructs the NPC-Server to shut down, say, for a restart.
  • /npckill can be used to kill the NPC-Server in case there was a scripting problem that completely froze the server or /npcstart is not working. Using this command will mean that the data of the last few minutes will be lost, so it is preferred to use /npcshutdown if possible.