i think it's like this.
make an array, then
if i'm not wrong, thats it, if you has a pool of item to be selected. if it's for gm, usePHP Code:case 1:
cm.whatever;
cm.ProDonatorItem(<itemID>, c.getPlayer());
break;
case 2:
cm.whatver;
cm.ProDonatorItem(<itemID>, c.getPlayer());
break;
HELPPPPPPPPPPPPHP Code:cm.MakeGMItem(itemID, cm.getPlayer());
sendGetText: You're supposed to input the item id is it? If you input the item id, you assign a variable itemid to store the cm.getText then use the variable in the method.
cm.ProDonatorItem(<variable>, c.getPlayer());
If you want different str,dex,luk and int, you need to use alot of variable to store each individual cm.getText
I'm doing it in a npc which gives item which has the value that I've pre-set in npc scripting(like if someone hits level200 they will gain an item with random stats and random potential line and random speed/jump/scroll slots blabla.
IT IS PRESET IN A NPC, NOT HAVING TO INSERT IT WHEN I TALK TO THE NPC.
What I wanted is a java source code with the function that makes an item with customize stats which is gonna be pre inserted in a npc (not mass cm.sendGetText/Number when talking to the npc)
I hope you understand what I meant lol
Then create a method like this:
PHP Code:public void ProDonatorItem(int item, MapleClient c){
Equip eu = new Equip(item, equip.getNextFreeSlot());
MapleJob job = eu.getJob(); // JOB
short hand = eu.getHands(); // HANDS
byte level = eu.getLevel(); // LEVEL
eu.setStr((short) <predefined>); // STR
eu.setDex((short) <predefined>); // DEX
eu.setInt((short) <predefined>); // INT
eu.setLuk((short) <predefined>); //LUK
eu.setUpgradeSlots((byte) <predefined>); // Feel free to change
eu.setJob(job);
eu.setHands(hand);
eu.setLevel(level);
eu.setSpeed(speed);
eu.setJump(jump);
c.getPlayer().getInventory(MapleInventoryType.EQUIP).addFromDB(eu);
c.getPlayer().getInventory(MapleInventoryType.EQUIP).removeItem(slot);
}
So your telling me to input a variable? Could you possibly show a example? I'm trying to make it so that it will link to all the equips and when they open the npc they will just need to type in the name of the equip so ex. "Lionheart Cutlass" and it will give it to them with the modded stats, or are there no ways to do that and I have to make a array for all the equips?
Sorry for bothering you, hecari, but I still don't understand what you're trying to say. Okay let's say, I wanna make a npc with this
If (status==1)
cm.ProDonatoraItem(8273839 10(str) 20(str) 12(int) 17(luk) 200(hp) 200(mp) 20(speed) 20(jump) 600001(potential1) 60001 (potential2) 600001(potential3)
Cm.dispose
If (status==2)
Cm.ProdonatorItem (4727627 50(str) 20(dex) 30(int) 50(luk) 200(hp) 200(mp) 20(speed) 20(jump) 600001(potential1) 60001 (potential2) 600001(potential3)
If (status==3)
Cm.ProdonatorItem (467627 50(str) 20(dex) 30(int) 50(luk) 200(hp) 200(mp) 20(speed) 20(jump) 600001(potential1) 60001 (potential2) 600001(potential3)
Of course the brackets won't be here, only the values, so do I do that? Like not all the item has he same stat so I'd do it like this. Thanks
Yes, you can do that. What I'm recommending is if you only have those 3 option, might as well just hard-code it into the source like
PHP Code:public void makeDonatorItem1(int item, MapleClient c) {
// code put here
}
public void makeDonatorItem2(int item, MapleClient c) {
// code put here
}
What do you mean by variable hecari o-o sorry for bothering you just sort of clueless at the moment xD
var itemid_inputted;
itemid_inputted = Integer.parseInt(cm.getText()); //I forget how to parse a text to int in javascript.
cm.ProDonatorItem(itemid_inputted, c);
Yes finally you understood what I meant. In my opinion, since I'm gonna have more than 10 items to be given out as some event prizes and starter pack items, so I would prefer a line of code that can be fully customized with any item that I want to give up rather than the same stats (yes I fully understand that I can make multiple method but I prefer full customization to the item stats)
Hecari can you tell me if this script is correct? of inputting what you told me toPHP Code:var status = 0;
var itemid_inputted;
var selected = 1;
var wui = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
selected = 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.sendAcceptDecline("Hello #h #, Welcome to the IOC Reward Choice! The required amount of Donation Points is 1000 DP, Would you like trade in your points for a IOC? \r\n \r\n You currently have #r#e" + cm.getPlayer().getPoints() + " Donation Points. \r\n\r\n Please check your inventory ");
} else if (status == 1) {
if (cm.getChar().isDonator() == true && cm.getPlayer().getPoints() >= 1000 && for (int i : GameConstants.itemBlock)) {
var String = "Please Choose your desired Item or NX equip that you wish to gain as a IOC Reward. Please check your Inventory to make sure you have enough room because, we don't give back refunds. Enjoy!\r\n\r\n";
cm.sendGetText(String+cm.EquipList(cm.getC())); //or is it cm.getPlayer().getClient() ? .___. or (cm.getC()));
} else {
cm.sendOk("You do not have the requirements. You must be a Donator to use this NPC, a requirement of 1000 DP to purchase, or simply you are purchasing something that does not exist.");
cm.dispose();
}
} else if (status == 2) {
itemid_inputted = Integer.parseInt(cm.getText("Please type in what you would like to receive"));
if (cm.getPlayer().getPoints() > 1000 ) {
cm.getPlayer().gainPoints(-1000);
if (cm.canHold(itemid_inputted)) {
cm.ProDonatorItem(itemid_inputted, c);
cm.reloadChar();
cm.dispose();
} else {
cm.sendOk("Your inventory is full.");
}
cm.dispose();
}
}
}
I see, do you have any knowledgeable idea on how to make it search item by name for it? and method that would be best suggested?
I recommend referencing the !search <item> command and implement it into the a function in npc.