Jump to content

TUTORIAL/SNIPPET 8 members have voted

  1. 1. Did this tutorial/snippet help?

    • YES
      4
    • KINDA
      2
    • NO
      2

Please sign in or register to vote in this poll.

Featured Replies

Posted
comment_17734

NOTE: This has been released on several other sites, but I decided to post my own version.

This is also my first snippet / tutorial, I hope I helped you in any way :)

Source: PI

Files: Playersave.java, Player.java, npcHandler.java

Difficulity: 1/10

CHANGE WHERE I PUT ASDF TO YOUR CUSTOM POINT.

Step 1: open Playersave.java (src/server/model/players)

Search for this -

} else if (token.equals("character-rights")) {

Then you will see this - 

} else if (token.equals("character-rights")) {
p.playerRights = Integer.parseInt(token2);

Under that somewhere add this - 

} else if (token.equals("ASDF")) {
p.ASDFPoints = Integer.parseInt(token2);

In the same file search for this - 

characterfile.write("character-rights = ", 0, 19);

Then you will see this - 

characterfile.newLine();
characterfile.write("character-rights = ", 0, 19);
characterfile.write(Integer.toString(p.playerRights), 0, Integer.toString(p.playerRights).length());

Under that somewhere add this - 

characterfile.newLine();
characterfile.write("ASDF = ", 0, 9);
characterfile.write(Integer.toString(p.ASDF), 0, Integer.toString(p.ASDF).length());

SAVE AND CLOSE

Step 2: open Player.save (src/server/model/players)

Search for - 

public int

Keep searching until you see something like this - 

public int
    safeTimer = 0,
    degradeTime, 
    KC,
    DC,
    bond,
    untbond,
    recoil = 0,	
    kingQuest = 0,
    rMQ = 0,
    bMQ = 0,

Then add this - 

public int
    safeTimer = 0,
    degradeTime, 
    KC,
    DC,
    bond,
    untbond,
    recoil = 0,	
    kingQuest = 0,
    rMQ = 0,
    bMQ = 0,
	ASDF, //<this is where your custom points go

SAVE AND CLOSE

That is it for that part of adding points to your character files.

STEP 3: open npcHandler.java (src/server/model/npcs)

Search for this - 

public void dropItems(int i) {

Under that put this - 

if (npcs[i].npcType == NPCID) {// npc that you kill to give you the points
c.ASDF += 1;
c.sendMessage("You currently have "+ c.ASDF + " ASDF Points.");
}

SAVE AND COMPILE AND YOUR DONE.

Edited by Solnes

  • 1 year later...
  • Replies 34
  • Views 4.6k
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 months later...
  • 1 month later...
  • 2 months later...
  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...
  • 1 year later...
  • 1 month later...

Create an account or sign in to comment