![]() |
Advanced Control-NPC
Here is an advanced (sorta) Control-NPC script I made that is easy to customize for your server. I'll go threw the steps (below the code).
If you notice anythnig that is still specific to my server, please tell me and I will remove it! I think I got everything. Here is the code: Code of DB-NPC Control-NPC PHP Code:
1) Set this.logPlayer and this.announcePlayer to what you prefer. logPlayer logs when a player logs in or out. announcePlayer announces in RC when a player logs in or out. 2) Set all the different files. joinFile is the list of classes to be joined to the player. weaponsFile is a list of the weapons to be added to the player. notifyFile is a list of players that when logged in display a notice on RC, hence the name. Are also logged. pmFile is the pm that the NPC-server sends on logon. You can leave any one of these blank to disable it. 3) Set this.joinMessage. This is displayed in RC when a player logs on. You could do something like "STOP WATCHING RC! GO DEVELOP!". Leave blank to disable. 4) Set this.resetVars. This is handy for setting vars on login, such as clientr.frozen and clientr.disconnect. The format is { VAR, VALUE }. For player. vars, leave out the player., so it would be fullhearts, x, y, z, etc. 5) Leave everything alone until you get down to specialLogin() function. 6) Here put custom login things. For example, you may want to warp the player to a certain level when they login. Add that here. Maybe you need to do something special with a DB NPC when they log in. Add that here. 7) Add all of this in the DB-NPC Control-NPC. If you need help with that, ask me! If you have any questions about any of this, please tell me and I will be happy to help! If I find bugs I will fix the code. Thank you! Please, please, PLEASE, leave me feedback, this is my first useful script I've released since my return, so I'm wondering if it is any good. Thank you! Chris Zakuto PS: Don't tell MiZZo (Jave), he'll freak out. He doesn't like me giving away scripts on [CENSORED UNTIL LATER NOTICE] that I make. Oh well. |
Good job here Chris to help servers customize everything in their NPC Control when they've got a wealth of information. ++ rep
|
Quote:
|
Wow. I'm impressed ^_^ Perhaps when I'm able to log in, I can try this out :P
|
I personally don't like the idea of using files to store info that could simply be placed in arrays.
|
Quote:
|
Quote:
Also, imagine a long login message that was in the control NPC. Would simply get messy. This is just an effective way of storing information so that it can easily be changed. Also eventually it would be easier to access through other scripts, but there's really no need in this particular application. |
Kind of unneeded, but I like the idea if you want people to be able to edit the control npc without giving NC.
|
Quote:
Man, this makes me think of how unorganized every NPC Server I work with ends up being. :( |
You have a weapons list in a text file....
Anyhoo, I split the Control-NPC up into the dbnpc and a class to keep it organised. The class contained (what became) the bigass onRcChat() event as well as the onPM() event. I always have login message handled by another weapon which did use text files and also a quick edit for staff ^^. Big PMs piss me off :whatever: |
NPC Server PMs = Poop.
onLogin GUIs are so much cooler. |
Quote:
|
Quote:
http://forums.graalonline.com/forums...ad.php?t=77694 - My companion (for those of you who aren't going to click that, it's my Login Message GUI--same one used on Utopia) |
Hmm, I don't see why you don't just put the player initialisation/logon stuff into the onCreated() function of a player-joined class. My Control-NPC on Rudora is scripted to do nothing but join classes to the player, and forward some events onto other NPCs. That way, it's very easy to see what should be doing what, while keeping things separated and organised.
|
| All times are GMT +2. The time now is 12:17 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.