- Joined
- Jun 23, 2012
- Messages
- 554
- Reaction score
- 70
EDIT: Updated as of 4/26/2013 to fix a functional error in which the opposing party could not summon monsters because they did not have the necessary items to set the variables in the NPC to true.
Hey, it's Thane Krios and I bring to you the Custom CPQ add-on that was released several years ago under my decently ancient account: lfatelhighdef. It's been a long time since I've released anything so I've decided to rework and improve my past release. There were several issues with it in the past, mainly with the scripts themselves, but I believe I've worked out all the kinks. I tested this alone, and not with the recommended 4 people to ensure it works flawlessly with parties, but after re-reading the code twice I do believe it doesn't contain any serious issues.
Assistant Blue and Red (NPC script IDs are 2042009 and 2042004)
Spiegelmann at main map
Spiegelmann at defeat and victorious stages
cm.getPlayerCount(map) function
cm.getMonsterCount function
cm.summonMobAtPosition function
cm.spawnMobOnDiffMap Function
cm.mapMessage
Credits go to me and my alias (lfatelhighdef), and Kevintjuh93 for his wonderful v83 source.
One can find the initial release of this PQ here: http://forum.ragezone.com/f427/add-custom-cpq-727685/
PS: Only Assistant Red and Blue were edited during this recent endeavor. Spiegelmann has remained untouched since 2011.
Screen Shots
Hey, it's Thane Krios and I bring to you the Custom CPQ add-on that was released several years ago under my decently ancient account: lfatelhighdef. It's been a long time since I've released anything so I've decided to rework and improve my past release. There were several issues with it in the past, mainly with the scripts themselves, but I believe I've worked out all the kinks. I tested this alone, and not with the recommended 4 people to ensure it works flawlessly with parties, but after re-reading the code twice I do believe it doesn't contain any serious issues.
What is the Custom CPQ?
Custom CPQ was an idea that entered my mind a few years ago (2 or 3 years ago). I, myself, am no Java coder and am only versed in the language of Java script. I'd self taught myself since 2008ish and had been looking for a more challenging endeavor to take upon myself. The product in the end was CPQ.
Custom CPQ was an idea that entered my mind a few years ago (2 or 3 years ago). I, myself, am no Java coder and am only versed in the language of Java script. I'd self taught myself since 2008ish and had been looking for a more challenging endeavor to take upon myself. The product in the end was CPQ.
- CPQ is a remake of the renowned Carnival PQ of pre-bb Maplestory
- Whoever kills all mobs first wins
- Players must be levels 30-50
- Upon entering the lobby, the leader must speak to the assistant to begin the PQ.
- The PQ cannot begin if there is no other team present.
- Monsters spawn when conditions are met, and players must eliminate all monsters.
- Upon death monsters drop Maple Coins, which are used to summon more mobs through the assistants
- Upon elimination of mobs, the victorious party will be taken to the victory stage, and the loser to their defeated stage. Parties gain respective exp according to the EXP rates of their servers
NOTE: Please set the drop rate for Maple Coin near or at 50%. Too low may make the PQ end too quickly, and too high will make it never ending
Assistant Blue and Red (NPC script IDs are 2042009 and 2042004)
PHP:
/*Map: Monster Carnival Room 4 Lobby: mapt* Credits go to Thane Krios (alias: lfatelhighdef)*/
var status;
var min = 2;
var max = 6;
var coin = 4001129;
var startspiece = 4001254; // this is the item given to players to let the NPC know whether or not the PQ has began.
// IMPORTANT
// Change it to some undroppable item so they cannot abuse respawning. And make sure to change Spiegelmann's removal of the item so that players do not keep the PQ starting item when they leave
// IMPORTANT
var map = 980000400;
var mapt = 980000300;
var starts = 0;
var finish;
var leave;
var players;
var mobs = [[9300128, 9300129, 9300130, 9300131, 9300132, 9300133, 9300134, 9300135, 9300136],[2,2,3,4,4,5,6,10,20,30],
["Brown Teddy", "Bloctopus", "Ratz", "Chronos", "Toy Trojan", "Tick-Tock", "Robo", "King Block", "Master Chronos", "Rombot"]]; // mobs, cost // name
// brown teddy, bloctopus, ratz, chronos, toy trojan, tick-tock, robo, king block, master chronos, rombot
function start() {
status = -1;
action(1,0,0);
}
function action(mode, type, selection) {
if (mode == -1) {
return;
cm.dispose();
} else if (mode == 0) {
status--;
} else {
status++;
}
if (status == 0) {
var party = cm.partyMembersInMap(); var count = cm.getPlayerCount(map); var countt = cm.getPlayerCount(mapt); var mob = cm.getMonsterCount(map);
var mobt = cm.getMonsterCount(mapt); var yours = cm.getMapId(); var your = cm.getMonsterCount(yours);
(count == 0 || countt == 0 ? players = 0 : players = 1); // note to self, change players back
(!cm.haveItem(startspiece,1) ? starts = 0 : starts = 1); // if they do not have starting item then the PQ has not begun
(cm.haveItem(startspiece,1) && cm.getMapId()==map && countt < 1 ? finish = 0 : cm.haveItem(startspiece,1) && cm.getMapId()==map && mob == 0 ? finish = 1 :
cm.haveItem(startspiece,1) && cm.getMapId()==mapt && count < 1 ? finish = 0 : cm.haveItem(startspiece,1) && cm.getMapId()==mapt && mobt == 0 ? finish = 1 : finish = -1);
// the above is a series of checks to see which team has won, and which team has lost. 0 = lose, 1 = win
if (cm.getParty() == null) {
cm.warp(980000504);
cm.sendOk("You have been warped out due to not being in a party.");
cm.dispose();
} else if (!cm.haveItem(startspiece,1) && (mob > 0 || mobt > 0)) {
cm.givePartyItems(startspiece, 1, cm.getPartyMembers());
cm.mapMessage(5, "Your party has been updated to active. You will now be able to summon monsters.");
cm.dispose();
} else if (finish == 0) {
cm.warpParty(980000404);
cm.mapMessage(5, "Sorry! The enemy team has won the match. Please talk to Spiegelmann to gain your rewards!");
cm.dispose();
} else if (finish == 1) {
cm.warpParty(980000403);
cm.mapMessage(5, "Congratulations! You have won the carnival game! Please talk to Spiegelmann for a handsome reward for your participation!");
cm.dispose();
} else if (players == 0) {
leave = 1;
cm.sendYesNo("You must wait for an opposing party to enter before you can starts the PQ. Would you like to leave?\r\n\r\n#eChoosing to leave will exit your entire party.#n");
} else if (starts == 0) {
if (!cm.isLeader()) {
cm.sendOk("Please wait for the leaders to begin the PQ. Both teams are ready and able-bodied to begin the game.");
cm.dispose();
} else if (!cm.haveItem(startspiece,1)) {
if (cm.getMapId()==map) {
cm.givePartyItems(startspiece, 1, cm.getPartyMembers());
cm.mapMessage(5, "You have been given a Shiny Maple Coin. Do not drop this item. If you do, then you will be unable to spawn any more monsters.");
cm.summonMobAtPosition(9300133,3,-111,162);
cm.summonMobAtPosition(9300136,3,231,162);
cm.summonMobAtPosition(9300136,3,36,162);
cm.summonMobAtPosition(9300133,3,185,162);
cm.summonMobAtPosition(9300136,3,295,-138);
cm.summonMobAtPosition(9300133,3,115,-138);
cm.spawnMobOnDiffMap(mapt,9300133,3,-111,162);
cm.spawnMobOnDiffMap(mapt, 9300136,3,231,162);
cm.spawnMobOnDiffMap(mapt, 9300136,3,36,162);
cm.spawnMobOnDiffMap(mapt, 9300133,3,185,162);
cm.spawnMobOnDiffMap(mapt, 9300136,3,295,-138);
cm.spawnMobOnDiffMap(mapt, 9300133,3,115,-138);
cm.dispose();
} else {
cm.summonMobAtPosition(9300133,3,-111,162);
cm.summonMobAtPosition(9300136,3,231,162);
cm.summonMobAtPosition(9300136,3,36,162);
cm.summonMobAtPosition(9300133,3,185,162);
cm.summonMobAtPosition(9300136,3,295,-138);
cm.summonMobAtPosition(9300133,3,115,-138);
cm.spawnMobOnDiffMap(map,9300133,3,-111,162);
cm.spawnMobOnDiffMap(map, 9300136,3,231,162);
cm.spawnMobOnDiffMap(map, 9300136,3,36,162);
cm.spawnMobOnDiffMap(map, 9300133,3,185,162);
cm.spawnMobOnDiffMap(map, 9300136,3,295,-138);
cm.spawnMobOnDiffMap(map, 9300133,3,115,-138);
}
}
} else {
txt = "These are the monsters that you can summon on the opposing map. You will spawn a total of #e21#n mobs on the other side each time you select a mob to spawn.";
for (var i = 0; i < mobs[0].length; i++)
txt += "\r\n#L"+i+"##o"+mobs[0][i]+"# - #b"+mobs[1][i]+"#k #i"+coin+"#";
cm.sendSimple(txt);
}
} else if (status == 1) {
if (leave == 1) {
cm.warpParty(980000000);
cm.dispose();
} else if (!cm.haveItem(coin, mobs[1][selection])) {
cm.sendOk("You cannot summon this monster, #b#o"+mobs[0][selection]+"##k. You are lacking #b"+(mobs[1][selection] - cm.haveItem(coin))+"#k #i"+coin+"#.");
cm.dispose();
} else {
if (cm.getMapId()==map) {
cm.mapMessage(5, ""+cm.getPlayer().getName+" has summoned 21 "+mobs[2][selection]+" on the enemy's side!");
cm.gainItem(coin, -mobs[1][selection]);
cm.spawnMobOnDiffMap(mapt, mobs[0][selection], 7, -207, 162);
cm.spawnMobOnDiffMap(mapt,mobs[0][selection], 7, 221, -138);
cm.spawnMobOnDiffMap(mapt, mobs[0][selection], 7, 232, 162);
cm.dispose();
} else {
cm.mapMessage(5, ""+cm.getPlayer().getName+" has summoned 21 "+mobs[2][selection]+" on the enemy's side!");
cm.gainItem(coin, -mobs[1][selection]);
cm.spawnMobOnDiffMap(map, mobs[0][selection], 7, -207, 162);
cm.spawnMobOnDiffMap(map,mobs[0][selection], 7, 221, -138);
cm.spawnMobOnDiffMap(map, mobs[0][selection], 7, 232, 162);
cm.dispose();
}
}
}
}
Spiegelmann at main map
PHP:
var server = "DynastyMS";
var status;
var min = 2;
var max = 6;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
}
if (mode == 0) {
cm.sendOk("Come back later then.");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
var party = cm.partyMembersInMap();
var open = true;
var players = cm.getPlayerCount(980000100);
if (status == 0) {
if (cm.getMapId()==100000000) {
if (cm.getLevel() < 30 || cm.getLevel() > 50) {
cm.sendOk("You are not eligible for #rCustom CPQ#k. It is available only for levels #r30-50#k.");
cm.dispose();
} else {
cm.sendYesNo("Would you like to go to #bCPQ#k?");
}
} else if (cm.getMapId()!=980000000) {
cm.sendOk("Hey, you can start #bCPQ#k with me in Kerning City.");
cm.dispose();
} else if (cm.getParty() == null) {
cm.sendNext("Hey! Welcome to the #rCustom Monster Carnival#k of #d"+server+"#k.");
} else if (!cm.isLeader()) {
cm.sendOk("You are not the leader. Please have the leader speak to me to initiate the #rMonster Carnival#k.");
cm.dispose();
} else {
cm.sendYesNo("Good. Your party is ready. Have you spoken to another party's leader and decided upon the map you wish to take on?");
}
} else if (status == 1) {
if (cm.getMapId()==100000000) {
cm.warp(980000000);
cm.dispose();
} else if (cm.getParty() == null) {
cm.sendNext("In this #rMonster Carnival#k, you will need #b2#k parties. You can find some at the lobby and speak to each party's leaders for a match to be set up.");
} else {
cm.sendSimple("Choose from the maps. You must have the correct number of players according to each map.\r\n\r\n#L0#Map 0 - #L1#Map 0 Challenger#b (2 - 4 players only)#k\r\n#L2#Map 1 - #L3#Map 1 Challenger #b(2 - 4 players only)#k\r\n#L4#Map 2 - #L5#Map 2 Challenger #b(3 - 6 players only)#k #e"+
"UNAVAILABLE#n");
}
} else if (status == 2) {
var party = cm.partyMembersInMap();
if (cm.getParty() == null) {
cm.sendNext("Each party will choose what map they wish to be on. When choosing a map, the selection adjacent to it is the map in which the opposite party will be in.\r\n\r\n#bExample: #k#bMap 1#k - 1st Party : #bMap 2#k - 2nd Party");
} else if (selection == 0 && cm.getPlayerCount(980000100) < 1 && party >= 2 && party <= 4) {
cm.warpParty(980000100);
cm.dispose();
} else if (selection == 1 && cm.getPlayerCount(980000200) < 1 && party >= 2 && party <= 4) {
cm.warpParty(980000200);
cm.dispose();
} else if (selection == 2 && cm.getPlayerCount(980000400) < 1 && party >= 2 && party <= 4) {
cm.warpParty(980000400);
cm.dispose();
} else if (selection == 3 && cm.getPlayerCount(980000300) < 1 && party >= 2 && party <= 4) {
cm.warpParty(980000300);
cm.dispose();
} else if (selection == 4 && cm.getPlayerCount(980000500) < 1 && party >= 3 && party <= 6) {
cm.warpParty(980000500);
cm.dispose();
} else if (selection == 5 && cm.getPlayerCount(980000600) < 1 && party >= 3 && party <= 6) {
cm.warpParty(980000600);
cm.dispose();
} else {
cm.sendOk("There is already a party inside participating in the #rPQ#k, or the number of people in your party are incorrect for this map.");
cm.dispose();
}
} else if (status == 3) {
if (cm.getParty() == null) {
cm.sendOk("A large group of monsters will spawn for both maps. Players must eliminate the horde of monsters as fast as they can. The monsters will drop a certain item used for spawning monsters to your opponent's map. Whoever kills all monsters on the map first wins.");
cm.dispose();
}
}
}
Spiegelmann at defeat and victorious stages
PHP:
/*Map: Monster Carnival Room 4 Lobby: 980000400*/
var status;
var min = 2;
var max = 6;
var coin = 4001129;
var scoin = 4001254;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
}
if (mode == 0) {
cm.sendOk("Come back later then.");
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
var party = cm.partyMembersInMap();
if (cm.getMapId()!=103000000) {
if (cm.getMapId()==980000403 || cm.getMapId()==980000103 || cm.getMapId()==980000503) {
cm.sendOk("Hey! Good job on winning! Your party has received #r6,000#k EXP TIMES the current EXP rate");
cm.mapMessage(6,"[CPQ Assistant] Good job on winning! The party members in the map will receive 6,000 EXP TIMES the current EXP rate.");
} else if (cm.getParty()){
cm.sendOk("Aww! Better luck next time. You'll do better. Your party has received #r2,000#k EXP TIMES the current EXP rate.");
cm.mapMessage(6,"[CPQ Assistant] Aww! Better luck next time! Party members in the map will receive 2,000 EXP TIMES the current EXP rate.");
} else {
cm.sendOk("I'll warp you out right now.");
}
} else {
cm.sendYesNo("Do you want join the #bMonster Carnival#k?");
}
} else if (status == 1) {
var party = cm.partyMembersInMap();
if (cm.getMapId()!=103000000) {
if (cm.getMapId()==980000403 || cm.getMapId()==980000103 || cm.getMapId()==980000503) {
cm.warp(980000000);
cm.gainExp(6000 * 15);
cm.removeAll(scoin)
cm.removeAll(coin);
cm.dispose();
} else if (cm.getParty()){
cm.warp(980000000);
cm.gainExp(2000 * 15);
cm.removeAll(scoin);
cm.removeAll(coin);
cm.dispose();
} else {
cm.warp(100000000);
cm.dispose();
}
} else {
cm.warp(980000000);
cm.dispose();
}
}
}
cm.getPlayerCount(map) function
PHP:
public int getPlayerCount(int mapid) {
return c.getChannelServer().getMapFactory().getMap(mapid).getCharacters().size();
}
cm.getMonsterCount function
PHP:
public int getMonsterCount (int map) {
return c.getChannelServer().getMapFactory().getMap(map).getMonsterCount();
}
cm.summonMobAtPosition function
PHP:
public void summonMobAtPosition(int mobid, int amount, int posx, int posy) {
if (amount <= 1) {
MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
npcmob.setHp(npcmob.getMaxHp());
getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, new Point(posx, posy));
} else {
for (int i = 0; i < amount; i++) {
MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
npcmob.setHp(npcmob.getMaxHp());
getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, new Point(posx, posy));
}
}
}
cm.spawnMobOnDiffMap Function
PHP:
public void spawnMobOnDiffMap(int mapid, int mobid, int amount, int xpos, int ypos) {
MapleMap target = c.getChannelServer().getMapFactory().getMap(mapid);
for (int x = 0; x < amount; x++) {
target.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobid), new Point(xpos, ypos));
}
}
cm.mapMessage
PHP:
public void mapMessage(int type, String message) {
getPlayer().getMap().broadcastMessage(MaplePacketCreator.serverNotice(type, message));
}
Credits go to me and my alias (lfatelhighdef), and Kevintjuh93 for his wonderful v83 source.
One can find the initial release of this PQ here: http://forum.ragezone.com/f427/add-custom-cpq-727685/
PS: Only Assistant Red and Blue were edited during this recent endeavor. Spiegelmann has remained untouched since 2011.
Screen Shots
Last edited:

