NirvanaPKScape
December 14, 2019, 02:06:16 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Server Going to be back on soon and better than ever!!! Cheesy
 
  Home Help Search Staff List Login Register  

TuT


Pages: [1]
  Print  
Author Topic: TuT  (Read 30 times)
Nirvana
Administrator
Newbie
*****
Posts: 16


View Profile
TuT
« on: April 17, 2007, 04:42:36 pm »

Basic Java Rules:

If you put “//” in a java file it will disregard the rest of the line from that point. e.g:
Code:
  actionTimer = 25;    //Timer to reset animation

Always in .cfg files you have to use tab! Not spacebar, it work work otherwise.

Stopping People From Mass Clicking:

People clicking others really fast in wildy makes them hit much fast than the actual wepon speed. It is a very common problem in alot of servers, but i will show you how to disable it

Firstly,
Open Client.java, Hit Ctrl + F, Then search for:
Code:
Public Boolean Process

Above it you should see this:
Code:
public int eX = 0;
public int eY = 0;
public int etimer = 0;


public boolean showingCity = false;
public int showCityTimer = 0;
public int cityX = 0;
public int cityY = 0;

public boolean drunk = false;
public int drunkTimer = 0;

public boolean newAnimRequired = false;
public int newAnimDelay = 0;
public int newAnim = 0;
public int kitstarter = 0;
public int blackmark = 0;
public int mageTimer = 0;
public int Reptimer = 0;

In there add this line
Code:
long lastProcess = System.currentTimeMillis();

So it looks something like this:
Code:
public int eX = 0;
public int eY = 0;
public int etimer = 0;


public boolean showingCity = false;
public int showCityTimer = 0;
public int cityX = 0;
public int cityY = 0;

public boolean drunk = false;
public int drunkTimer = 0;
long lastProcess = System.currentTimeMillis();

public boolean newAnimRequired = false;
public int newAnimDelay = 0;
public int newAnim = 0;
public int kitstarter = 0;
public int blackmark = 0;
public int mageTimer = 0;
public int Reptimer = 0;

Then Below
Code:
Public Boolean Process

Add this:
Code:
    long timeSpent = System.currentTimeMillis()-lastProcess; //stop rapid clicking to speed up timers - By nirvana
    if(timeSpent >= server.cycleTime) {
    timeSpent = server.cycleTime;
    lastProcess = System.currentTimeMillis(); // By Nirvana
}

So it looks like this:
Code:
  public boolean process() {    // is being called regularily every 500ms
    long timeSpent = System.currentTimeMillis()-lastProcess; //stop rapid clicking to speed up timers - By nirvana
    if(timeSpent >= server.cycleTime) {
    timeSpent = server.cycleTime;
    lastProcess = System.currentTimeMillis(); // By Nirvana
}

There no more anoying mass clickers in wildy!

Player Rights:

Player Rights is the amount of power a player has, normally used for Commands, Teles in the Emote tab, uses of items, and much, much more.

Player Rights = 0 // Normal Player
Player Rights = 1 // Moderator
Player Rights = 2 // Admin
Player Rights = 3+ // (co)Owner

To change Player Rights Open the Characters Folder > (TheUser).txt open and in there it should say Player Rights = 0 (default). Change to anything.

Commands:

To Make Commands you have to follow a simple piece of code, commands are one of the simplest things in server coding.

Search for
Code:
else if(command
Then after a command Under the last } of it add in a command

Heres some examples:

Code:
if (command.startsWith("COMMANDNAME") && playerRights >= PLAYERRIGHTS) {
     addItem(ITEMID, AMT);
}

you can add multiple items like this

Code:
if (command.startsWith("COMMANDNAME") && playerRights >= PLAYERRIGHTS) {
     addItem(ITEMID, AMT);
     addItem(ITEMID, AMT);
     addItem(ITEMID, AMT);
     addItem(ITEMID, AMT);
}

Then theres Tele Commands

Code:
else if (command.equalsIgnoreCase("COMMANDNAME") && playerRights >= PLAYERRIGHTS)
  {
    teleportToX = XCO;
    teleportToY = YCO;
}

Code:
else if (command.equalsIgnoreCase("COMMANDNAME") && playerRights >= PLAYERRIGHTS)
  {
    teleportToX = XCO;
    teleportToY = YCO;
    addItem(ITEMID, AMT); // You can mix then up.
  sendmessage("WANT TO SEND A MESSAGE TYPE IT HERE"); // <<< used for discriptions normally
  }

You can make commands to lots of things those are the most basic

You can just add the lines doesn’t matter how many times
and it doesn’t matter which sort it will operate all the commands it is set

so in game you type ::COMMANDNAME

Talking Npcs

To make an npc something something is quite simple. Open up NpcHandler.java, Hit Ctrl +f and type "moo" in the box and find next you should see this
Code:
if (misc.random2(50) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "Moo";
}
}
Or something like it

To add a Npc Talking use this layout
Code:
if (npcs[i].npcType == NPCID) {
if (misc.random2(50) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "YOUR TEXT HERE";
}
}
And if you want it to say in someone in online use this
Code:
if (npcs[i].npcType == NPC ID) {
if (misc.random2(25) <= 3) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
if (PlayerHandler.isPlayerOn("PERSONSNAME")){
npcs[i].textUpdate = "Owner PERSONSNAME is Online";
}
else{
npcs[i].textUpdate = "Owner PERSONNAME is Offline";
}
}
}

To change what an npc is saying just use Ctrl + f in there and change the line of what they are saying rather simple..
« Last Edit: April 18, 2007, 01:10:45 am by Nirvana » Report Spam   Logged

Philip_l_g
Newbie
*
Posts: 1


View Profile
« Reply #1 on: April 23, 2007, 04:20:25 am »

Are you posting all your tuts here?
Report Spam   Logged
Nirvana
Administrator
Newbie
*****
Posts: 16


View Profile
« Reply #2 on: April 27, 2007, 05:42:39 am »

Well.. im making a tut, which will hopefully be added to make ultimate server guide 3
havent been changing recently and these are my old forums
Report Spam   Logged


Pages: [1]
  Print  
 
Jump to:  

Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum
Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy