Newbie Spellweaver
- Joined
- Sep 4, 2011
- Messages
- 24
- Reaction score
- 0
Alright, so I'm working on a NPC, and I've run into an issue; I need to know how to specify what status something goes to.
For example, I have multiple choices in the first status, which is a sendSimple. The first three choices bring up a list of items obtained from a defined array, while the last one, which I'm working on, I want to be a "Gachapon" type action. Doing this, I need to be able to have the script go like this:
What would you like to use your vote points on ( Gachapon ) >> Are you sure you'd like to use one vote point for gachapon? >> receive item @ Dispose.
Here's my script.
And selection 3 is what I'm focusing on:
I'm aware it's very sloppy at this point. Once I get it working, I will clean it up a bit.
Anyway, I would like selection 3 to have a sendSimple asking if they're sure they want to use their vote point. For example: cm.sendSimple("Are you sure you'd like to use #rOne Vote Point#k on this Gachapon?\r\n\r\n#L0#I'm sure\r\n#L1#No thank you.");
Then from there, I'd like to send "L0" & "L1" to a different status not defined, such as status 7 in which I could add.
Is there any way to define which status the sendSimple gets redirected to?
Thanks in advance,
Kyle.
For example, I have multiple choices in the first status, which is a sendSimple. The first three choices bring up a list of items obtained from a defined array, while the last one, which I'm working on, I want to be a "Gachapon" type action. Doing this, I need to be able to have the script go like this:
What would you like to use your vote points on ( Gachapon ) >> Are you sure you'd like to use one vote point for gachapon? >> receive item @ Dispose.
Here's my script.
PHP:
var status = -1;
var nitems;
var np;
var ditems;
var dp;
var mitems = Array("#v4080100#Match Cards", "#v4080000#Omok", "#v4080001#Omok", "#v4080002#Omok", "#v4080003#Omok", "#v4080004#Omok", "#v4080005#Omok", "#v4080006#Omok", "#v4080007#Omok", "#v4080008#Omok", "#v4080009#Omok", "#v4080010#Omok", "#v4080011#Omok");
var mp = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
var mhair;
var fhair;
var hairnew;
var gitems = Array(1702302, 3010155);
function start() {
action(1, 0, 0);
if (cm.isGMS()) {
fhair = Array(34000, 34010, 34020, 34030, 34040, 34050, 34060, 34070, 34080, 34090, 34100, 34110, 34120, 34130, 34140, 34150, 34160, 34180, 34190, 34210, 34220, 34250, 34260, 34270, 34310, 34320, 34330, 34340, 34360, 34400, 34410, 34420, 34450, 34470, 34480, 34490, 34540);
mhair = Array(33000, 33030, 33040, 33050, 33060, 33070, 33080, 33090, 33100, 33110, 33120, 33130, 33150, 33160, 33170, 33180, 33190, 33210, 33220, 33240, 33250, 33270, 33280, 33290, 33350, 33360, 33370, 33380, 33390, 33400, 33440, 33450, 33460, 33500, 33510, 33520, 33580, 33590);
nitems = Array("5k Cash", "#v2340000#White Scroll (level 70+)", "#v2049100#Chaos Scroll x 5 (level 70+)", "#v5220000#Gachapon Ticket x5", "#v5220000#Gachapon Ticket x 25", "#v5062000#Miracle Cube x 5", "#v5062000#Miracle Cube x 25", "#v5062001#Premium Miracle Cube x 2", "#v5040004#Hyper Teleport Rock (1 Day)");
np = Array(1, 8, 8, 1, 5, 1, 3, 1, 1);
ditems = Array("#v2450018#2x EXP Card (1 Hour)", "#v5211067#1.2x EXP Card (1 Day)", "#v5211068#1.5x EXP Card (1 Day)", "#v5360000#2x Drop/Meso Card (1 Day)");
dp = Array(1, 2, 3, 3, 5, 8, 6);
bitems = Array("#v5150053#VIP Hairstyle Coupon", "#v5151036#VIP Hair Color Coupon", "#v5152057#VIP Cosmetics Coupon", "#v5152053#Royal Face Coupon", "#v5150040#Royal Hair Coupon");
bp = Array(1, 1, 1, 2, 2);
} else {
fhair = Array(34000, 34010, 34020, 34030, 34040, 34050, 34070, 34080, 34090, 34100, 34110, 34120, 34140, 34160, 34180, 34200, 34210, 34240, 34250, 34060, 34130, 34150, 34170, 34190, 34230, 34220, 34260, 34270, 34280, 34290, 34300, 34310, 34320, 34330, 34340, 34360, 34390, 34430, 34450, 34480, 34510);
mhair = Array(33000, 33010, 33020, 33030, 33040, 33070, 33080, 33100, 33120, 33130, 33140, 33150, 33160, 33170, 33210, 33240, 33250, 33260, 33010, 33050, 33060, 33090, 33110, 33180, 33190, 33200, 33220, 33230, 33270, 33280, 33290, 33300, 33310, 33320, 33340, 33350, 33380, 33390, 33420, 33430, 33480, 33510, 33520);
nitems = Array("2 million mesos", "10k Cash", "#v2340000#White Scroll (level 70+)", "#v2049100#Chaos Scroll x 5 (level 70+)", "#v5220000#Ga-cha-pon Ticket x 25", "#v5050000#AP Reset x 5", "#v5050000#AP Reset x 26", "#v5062000#Miracle Cube x 4", "#v5062000#Miracle Cube x 21", "#v2022179#Onyx Apple x 4", "#v2022179#Onyx Apple x 21", "#v5062001#Premium Miracle Cube x 2", "#v2530000#Lucky Day (level 70+)", "#v2531000#Protection Scroll (level 70+)");
np = Array(2, 2, 10, 4, 2, 2, 10, 2, 10, 2, 10, 18, 10, 20);
ditems = Array("#v2450018#2x EXP Card (1 Hour)", "#v5211074#1.2x EXP Card (1 Day)", "#v5211077#1.5x EXP Card (1 Day)", "#v5360017#2x Drop/Meso Card (1 Day)", "#v4030004#Clone (1 Day, Untradeable)");
dp = Array(8, 16, 6, 8, 8, 6);
}
}
function action(mode, type, selection) {
if (mode != 1) {
cm.dispose();
return;
}
status++;
if (status == 0) {
cm.sendSimple("Hello! I'm the #r#eVoting Point NPC#n#k. If you have voted on our site, you will get a point each time! I see you have #e#r" + cm.getPlayer().getVPoints() + "#n#k voting points! I can redeem your points for cool things! What would you like...?\r\n\r\n#b#L0#Trade for Common Items#l\r\n#L1#Trade for Special Items#l\r\n#L2#Trade for Beauty Coupons#l\r\n#L3#Vote Point Gachapon");
} else if (status == 1) {
status += selection;
var selStr;
var it;
var ip;
if (selection == 0) {
selStr = "#rCommon Items?#k Well, here's my selection...\r\n\r\n";
it = nitems;
ip = np;
} else if (selection == 1) {
selStr = "#rSpecial Items?#k Well, these are items you can't get anywhere else. Here's my selection...\r\n\r\n";
it = ditems;
ip = dp;
} else if (selection == 2) {
selStr = "#rBeauty Coupons?#k Well, these coupons are sure to tone your beauty strive. Here's my selection...\r\n\r\n";
it = bitems;
ip = bp;
} else if (selection == 3) {
var rand = java.lang.Math.floor(java.lang.Math.random() * gitems.length);
if (cm.getPlayer().getVPoints() < 1) {
cm.sendOk("You need at least #r1 Vote Point#k to use this.");
} else if (cm.getInventory(1).getNextFreeSlot() <= -1 || cm.getInventory(2).getNextFreeSlot() <= -1 || cm.getInventory(3).getNextFreeSlot() <= -1 || cm.getInventory(4).getNextFreeSlot() <= -1) {
cm.sendOk("You need space for this item.");
} else {
cm.gainItem(gitems[rand], 1);
}
cm.dispose();
} else if (selection == 4) {
cm.sendYesNo("Once you proceed with this selection, you can't go back! Are you sure you want to #ereset ALL YOUR AP? (DOES NOT reset HP or MP)#k");
return;
} else {
cm.dispose();
return;
}
for (var i = 0; i < it.length; i++) {
selStr += "#b#L" + i + "#Trade " + ip[i] + " points for " + it[i] + "#l#k\r\n";
}
cm.sendSimple(selStr);
} else if (status == 2) { //normal item
if (cm.getPlayer().getVPoints() < np[selection]) {
cm.sendOk("You don't have enough voting points. You only have " + cm.getPlayer().getVPoints());
} else {
var passed = false;
switch(selection) {
case 0:
if (cm.getPlayer().getCSPoints(1) > (2147473647)) {
cm.sendOk("You have too much Cash.");
} else {
cm.getPlayer().modifyCSPoints(1, 10000, false);
passed = true;
}
break;
case 1:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(2340000)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2340000, 1);
passed = true;
}
break;
case 2:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(2049100, 5)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2049100, 5);
passed = true;
}
break;
case 3:
if (!cm.canHold(5220000, 5)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5220000, 5);
passed = true;
}
break;
break;
case 4:
if (!cm.canHold(5220000, 25)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5220000, 25);
passed = true;
}
break;
case 5:
if (!cm.canHold(5062000, 5)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5062000, 5);
passed = true;
}
break;
case 6:
if (!cm.canHold(5062000, 20)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5062000, 20);
passed = true;
}
break;
case 7:
if (!cm.canHold(5062001, 2)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5062001, 2);
passed = true;
}
break;
case 8:
if (!cm.canHold(5040004, 1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItemPeriod(cm.isGMS() ? 5040004 : 5040004, 1, 1, "Vote Points");
passed = true;
}
break;
case 9:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(2022179, 4)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2022179, 4);
passed = true;
}
break;
case 10:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(2022179, 21)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2022179, 21);
passed = true;
}
break;
case 11:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(5062001, 2)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5062001, 2);
passed = true;
}
break;
case 12:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(2530000, 1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2530000, 1);
passed = true;
}
break;
case 13:
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("You must be level 70 or above to get this item.");
} else if (!cm.canHold(2531000, 1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2531000, 1);
passed = true;
}
break;
}
if (passed) {
cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - np[selection]);
cm.sendOk("Thank you for purchasing my item.");
}
}
cm.dispose();
} else if (status == 3) { // donators item
if (cm.getPlayer().getVPoints() < dp[selection]) {
cm.sendOk("You don't have enough voting points. You only have " + cm.getPlayer().getVPoints());
} else {
var passed = false;
switch(selection) {
case 0:
if (!cm.canHold(2450018, 1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(2450018, 1);
passed = true;
}
break;
case 1:
if (!cm.canHold(cm.isGMS() ? 5211067 : 5211074)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItemPeriod(cm.isGMS() ? 5211067 : 5211074, 1, 1, "Rental");
passed = true;
}
break;
case 2:
if (!cm.canHold(cm.isGMS() ? 5211068 : 5211077)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItemPeriod(cm.isGMS() ? 5211068 : 5211077, 1, 1, "Rental");
passed = true;
}
break;
case 3:
if (!cm.canHold(cm.isGMS() ? 5360000 : 5360017)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItemPeriod(cm.isGMS() ? 5360000 : 5360017, 1, 1, "Rental");
passed = true;
}
break;
case 4:
if (!cm.canHold(4030004)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItemPeriod(4030004, 1, 1, "Rental");
passed = true;
}
break;
}
if (passed) {
cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - dp[selection]);
cm.sendOk("Thank you for the purchase~");
}
}
cm.dispose();
} else if (status == 4) {
if (cm.getPlayer().getVPoints() < bp[selection]) {
cm.sendOk("You don't have enough voting points. You only have " + cm.getPlayer().getVPoints());
} else {
var passed = false;
switch(selection) {
case 0:
if (!cm.canHold(5151036, 1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5150053, 1);
passed = true;
}
break;
case 1:
if (!cm.canHold(5151036,1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5151036,1);
passed = true;
}
break;
case 2:
if (!cm.canHold(5152057,1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5152057,1);
passed = true;
}
break;
case 3:
if (!cm.canHold(5152053,1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5152053,1);
passed = true;
}
break;
break;
case 4:
if (!cm.canHold(5150040,1)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(5150040,1);
passed = true;
}
break;
}
if (passed) {
cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - bp[selection]);
cm.sendOk("Thank you for purchasing my item.");
}
}
cm.dispose();
} else if (status == 5) { // donators item
if (cm.getPlayer().getVPoints() < mp[selection]) {
cm.sendOk("You don't have enough voting points. You only have " + cm.getPlayer().getVPoints());
} else {
var passed = false;
switch(selection) {
case 0:
if (!cm.canHold(4080100)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(4080100, 1);
passed = true;
}
break;
case 1:
case 2:
case 3:
case 4:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
if (!cm.canHold(4079999 + selection)) {
cm.sendOk("You have too many items.");
} else {
cm.gainItem(4079999 + selection, 1);
passed = true;
}
break;
}
if (passed) {
cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - mp[selection]);
cm.sendOk("Thank you for the purchase~");
}
}
cm.dispose();
} else if (status == 6) {
if (cm.getPlayer().getVPoints() < 35) {
cm.sendOk("You don't have enough voting points. You only have " + cm.getPlayer().getVPoints());
} else {
cm.getPlayer().resetStatsByJob(false);
cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - 35);
cm.sendOk("Thank you for the purchase~");
}
cm.dispose();
}
}
And selection 3 is what I'm focusing on:
PHP:
} else if (selection == 3) {
var rand = java.lang.Math.floor(java.lang.Math.random() * gitems.length);
if (cm.getPlayer().getVPoints() < 1) {
cm.sendOk("You need at least #r1 Vote Point#k to use this.");
} else if (cm.getInventory(1).getNextFreeSlot() <= -1 || cm.getInventory(2).getNextFreeSlot() <= -1 || cm.getInventory(3).getNextFreeSlot() <= -1 || cm.getInventory(4).getNextFreeSlot() <= -1) {
cm.sendOk("You need space for this item.");
} else {
cm.gainItem(gitems[rand], 1);
}
cm.dispose();
I'm aware it's very sloppy at this point. Once I get it working, I will clean it up a bit.
Anyway, I would like selection 3 to have a sendSimple asking if they're sure they want to use their vote point. For example: cm.sendSimple("Are you sure you'd like to use #rOne Vote Point#k on this Gachapon?\r\n\r\n#L0#I'm sure\r\n#L1#No thank you.");
Then from there, I'd like to send "L0" & "L1" to a different status not defined, such as status 7 in which I could add.
Is there any way to define which status the sendSimple gets redirected to?
Thanks in advance,
Kyle.