Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Drop cash item NPC! Please help!

Initiate Mage
Joined
Jul 23, 2012
Messages
36
Reaction score
0
Hi guys. I tried to use the npc. But it says its
Not coded. Now I have a lot of cash junks in my inventory. Anyone can kindly help?
 
Experienced Elementalist
Joined
Apr 18, 2009
Messages
211
Reaction score
38
He's asking for you to post whatever NPC script you're trying to use
 
Upvote 0
Initiate Mage
Joined
Jul 21, 2012
Messages
67
Reaction score
0
sorry. i found a fix for that already.

Code:
/*
  GM Custom Equipment Creator
  Author: ElternalFire
*/

importPackage(java.util);
importPackage(net.sf.odinms.client);
importPackage(net.sf.odinms.server);
importPackage(net.sf.odinms.tools);

importPackage(net.sf.odinms.server.maps);

var equip = null;
var change = null;
var ii = MapleItemInformationProvider.getInstance();

var statNames = new Array("STR", "DEX", "INT", "LUK", "HP", "MP", "Weapon attack",
	"Magic attack", "Weapon defense", "Magic defense", "Accuracy", "Avoidability", "Speed", "Jump", "Slots to Upgrade", "Own");

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == -1) {
		cm.dispose();
	} else {
		if ((status == 1 || status == 3 || status == 4) && mode == 0) {
			cm.dispose();
			return;
		}
	
		if (mode == 1)
			status++;
		else if (mode == 0)
			status--;
			
		if (status == 0) {
			if (cm.getChar().gmLevel() > 0) {
				cm.sendYesNo("Welcome #b[GM] #h ##k! Can i do something for you ?");
			}
		}if (status == 1) {
			cm.sendGetNumber("Enter the equip ID.", 1000000, 1000000, 1999999);
		} else if (status == 2) {
			// This is a bit slow
			var items = ii.getAllItems().toArray();
			for (var i = 0; i < items.length; i++) {
				if (items[i].getLeft() == selection) {
					equip = ii.getEquipById(selection);
					cm.sendYesNo("Do you want to create #b#z" + selection + "##k?");
					return;
				}
			}
			
			cm.sendPrev("The item you are trying to create does not exist.");
		} else if (status == 3) {
			var s = "You are creating: #b#z" + equip.getItemId() + "##k.\r\nSelect a stat to change it.\r\n";
			for (var i = 0; i < 16; i++) {
				s += "#L" + i + "##b" + statNames[i] + ": " + getEquipStat(i) + "#k#l\r\n";
			}
			
			s += "\r\n#L16##bCreate the equipment#k#l";
			cm.sendSimple(s);
		} else if (status == 4) {
			if (selection == 16) {
				var newSlot = cm.getChar().getInventory(MapleInventoryType.EQUIP).addItem(equip);
				if (newSlot == -1) {
					cm.sendOk("Please make sure your equipment inventory is not full.");
					cm.dispose();
					return;
				}
				cm.getChar().getClient().getSession().write(MaplePacketCreator.addInventorySlot(MapleInventoryType.EQUIP, equip));
				cm.sendOk("Have fun with your new #b#t" + equip.getItemId() + "##k!");
				cm.dispose();
			} else {
				change = selection;
				if (selection == 15) {
					cm.sendGetText("Enter the new value for #bowner#k.");
					return;
				}
				
				var def = getEquipStat(selection);
				cm.sendGetNumber("Enter the new value for #b" + statNames[selection] + "#k.", def, 0, 32767);
			}
		} else if (status == 5) {
			setEquipStat(change, selection);
			status = 3;
			action(2, 0, 0);
		}
	}

function getEquipStat(i) {
	switch (i) {
		case 0: return equip.getStr();
		case 1: return equip.getDex();
		case 2: return equip.getInt();
		case 3: return equip.getLuk();
		case 4: return equip.getHp();
		case 5: return equip.getMp();
		case 6: return equip.getWatk();
		case 7: return equip.getMatk();
		case 8: return equip.getWdef();
		case 9: return equip.getMdef();
		case 10: return equip.getAcc();
		case 11: return equip.getAvoid();
		case 12: return equip.getSpeed();
		case 13: return equip.getJump();
		case 14: return equip.getUpgradeSlots();
		case 15: return equip.getOwner() == "" ? "(none)" : equip.getOwner();;
	}
}

function setEquipStat(i, v) {
	switch (i) {
		case 0: equip.setStr(v); break;
		case 1: equip.setDex(v); break;
		case 2: equip.setInt(v); break;
		case 3: equip.setLuk(v); break;
		case 4: equip.setHp(v); break;
		case 5: equip.setMp(v); break;
		case 6: equip.setWatk(v); break;
		case 7: equip.setMatk(v); break;
		case 8: equip.setWdef(v); break;
		case 9: equip.setMdef(v); break;
		case 10: equip.setAcc(v); break;
		case 11: equip.setAvoid(v); break;
		case 12: equip.setSpeed(v); break;
		case 13: equip.setJump(v); break;
		case 14: equip.setUpgradeSlots(v); break;
		case 15: equip.setOwner(cm.getText()); break;
	}
}
}



how do i put in this?
 
Upvote 0
Skilled Illusionist
Joined
Jul 19, 2012
Messages
313
Reaction score
11
copy the code above, paste it in any random npc in server/scripts/npc, eg 9000041, then go in game, do !pnpc 9000041 and summon the npc, then click on the npc. though i don't have time to read the use of the npc so i don't know if it's the right script to drop cash item
 
Upvote 0
Initiate Mage
Joined
Feb 14, 2011
Messages
58
Reaction score
2
Sorry. It's in MySQL under what?
bbhing98 is saying go to your source folder (Example: C:\Users\Computer\Desktop\v116/server/scripts/npc) and make a .js file (For example 9000041.js) and copy your npc script into 9000041.js
 
Upvote 0
Initiate Mage
Joined
Jul 23, 2012
Messages
36
Reaction score
0
So lets say the npc is 94000001, I change the name to xxxxxxx.js and copy the script and paste it in right? After that, do I need to say. Recompile or re execute ?

To add on, I have to find a npc code and name is as "NPCcode.js" right?
 
Upvote 0
Initiate Mage
Joined
Feb 14, 2011
Messages
58
Reaction score
2
So lets say the npc is 94000001, I change the name to xxxxxxx.js and copy the script and paste it in right? After that, do I need to say. Recompile or re execute ?

To add on, I have to find a npc code and name is as "NPCcode.js" right?
You only need to recompile when you changed something in the src directory other than that it should be changed instantly for npcs but for events it requires a server restart. Yes find a npc code you would like to use and insert the npc script into it then ingame type !makepnpc or whatever the command is for your source.

Btw Making npcs doesn't involve MySQL but to change the player npcs name/location etc.. you have to use MySQL
 
Upvote 0
Initiate Mage
Joined
Jul 23, 2012
Messages
36
Reaction score
0
Well. I guess I couldn't thank you enough (Y) That was the answer I was looking for!

Sorry. One last question. Will npc scripts in other versions work here? If the script has error, what will they show? Next. Please add me on msn! Keith_wong96@hotmail.com
 
Upvote 0
Initiate Mage
Joined
Feb 14, 2011
Messages
58
Reaction score
2
Well. I guess I couldn't thank you enough (Y) That was the answer I was looking for!

Sorry. One last question. Will npc scripts in other versions work here? If the script has error, what will they show? Next. Please add me on msn! Keith_wong96@hotmail.com
Not sure if it matters about the version but each source has different method of codes. The error should appear in your .bat file (launcher.bat) it should tell you which line is unreadable.
 
Upvote 0
Back
Top