[Release] Custom NPC

Experienced Elementalist
Joined
Sep 13, 2008
Messages
262
Reaction score
0
This is my First Release for an NPC. You can add it to any NPC. You Copy the Code and put it in notepad and Save it as a .js file. for example 9201101.js (T-1337). Then you put it in ur script/NPC folder of ur repack. and btw this trades Maple Coins for Pets. if you don't want it to trade maple coins then change 4001129 to something you want. and if you want it to trade something other then pets find replace the pet ID's with the item you want it to trade.


Code:
var status = 0;
function start() {
 status = -1;
 action(1, 0, 0);
}
function action(mode, type, selection) {
 if (mode == -1) {
  cm.dispose();
 } else {
  if (mode == 0 && status == 0) {
   cm.dispose();
   return;
  }
  if (mode == 1)
   status++;
  else
   status--;
  if (status == 0) {
   cm.sendSimple("Hello #h #, Welcome to #rSkyViewStory!#k\r\nWhat do you want to do?\r\n#L1##bTrade 10 #i4001129# for Baby Robo#l\r\n#L2##bTrade 10 #i4001129# for Blue Robo#k#l\r\n#L3##bTrade 10 #i4001129# for Red Robo#k#l\r\n#L4##bTrade 10 #i4001129# for Green Robo#k#l\r\n#L5##eEww, you are ugly, i won't talk to you!#n#l");
  } else if (status == 1) {
   if (selection == 1) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10);
     cm.gainItem(5000048, 1);    
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }        
   } else if (selection == 2) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10);
     cm.gainItem(5000049, 1);    
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }
   } else if (selection == 3) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10);
     cm.gainItem(5000050, 1);    
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }
   } else if (selection == 4) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10); 
     cm.gainItem(5000051, 1);   
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }
   } else {
    cm.sendOk("Oh. i see... Well then, have fun in #rSkyViewStory!#k\r\n\r\n#e*cries*#n");
    cm.dispose();
   }
  }
 }
}

Add this and save it as an .sql file if you want Henyesys park to drop Maple Coins​

Code:
INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (100100, 4001129, 1000);

INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (100101, 4001129, 1000);

INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (1110100, 4001129, 1000);

INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (1110101, 4001129, 1000);

INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (1120100, 4001129, 1000);

INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (1130100, 4001129, 1000);


INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (130101, 4001129, 1000);


INSERT INTO monsterdrops
   (`monsterid`, `itemid`, `chance`)
VALUES
   (210100, 4001129, 1000);

Credits
PHP:
ChickenMS for the idea
Me for editing it
 
Last edited:
Im only here to help edit the text and stuff on the NPCS!

Code:
var status = 0;
function start() {
 status = -1;
 action(1, 0, 0);
}
function action(mode, type, selection) {
 if (mode == -1) {
  cm.dispose();
 } else {
  if (mode == 0 && status == 0) {
   cm.dispose();
   return;
  }
  if (mode == 1)
   status++;
  else
   status--;
  if (status == 0) {
   cm.sendSimple("Hello #h #, Welcome to #[Server name]!#k\r\nWhat do you want to do?\r\n#L1##bTrade 10 #i4001129# for Baby Robo#l\r\n#L2##bTrade 10 #i4001129# for Blue Robo#k#l\r\n#L3##bTrade 10 #i4001129# for Red Robo#k#l\r\n#L4##bTrade 10 #i4001129# for Green Robo#k#l\r\n#L5##eEww, you are ugly, i won't talk to you!#n#l");
  } else if (status == 1) {
   if (selection == 1) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10);
     cm.gainItem(5000048, 1);    
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }        
   } else if (selection == 2) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10);
     cm.gainItem(5000049, 1);    
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }
   } else if (selection == 3) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10);
     cm.gainItem(5000050, 1);    
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }
   } else if (selection == 4) {
    if (cm.itemQuantity(4001129) >= 10 ) {
     cm.gainItem(4001129, -10); 
     cm.gainItem(5000051, 1);   
     cm.dispose();
    } else {
     cm.sendOk("You don't have enough #i4001129#\r\nDon't scam me or I will use this on you! #s5001001#");
     cm.dispose();
    }
   } else {
    cm.sendOk("Oh. i see... Well then, have fun in #r[server name]!#k\r\n\r\n#e*cries*#n Don't have to be so mean! Be nice!");
    cm.dispose();
   }
  }
 }
}
 
Back