Advertisement
Emistry

[RO] LMPQ

Dec 14th, 2019
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 14.19 KB | None | 0 0
  1. // https://bbb.hidden-street.net/party-quest/ludibrium-maze/stage-1
  2.  
  3. prontera,155,181,4  script  Pietri#LMPQ_Register    4_M_PIERROT,{
  4.     doevent "lmpq_main::OnRegister";
  5. }
  6.  
  7. new_zone04,100,29,4 script  Pietri#LMPQ 4_M_PIERROT,{
  8.     // changecamera(424, 42, -31);
  9.     if (strnpcinfo(2) == "LMPQ") {
  10.         doevent "lmpq_main::OnTalk";
  11.     }
  12.     else {
  13.         sscanf(strnpcinfo(2), "%d-%d", .@room, .@portal);
  14.         mes "^0055FF[ "+strnpcinfo(1)+" ]^000000";
  15.         mes "You're currently at Room #"+.@room;
  16.         mes " ";
  17.         mes " ";
  18.         mes "^777777Now you have to decide. Which portals will lead you to Room 16?^000000";
  19.         close;
  20.     }
  21.     end;
  22.    
  23.     OnTouch:
  24.         sscanf(strnpcinfo(2), "%d-%d", .@room, .@portal);
  25.         if (.@portal == 1) {
  26.             .@room = (.@room + 4) % 16;
  27.         }
  28.         else if (.@portal == 2) {
  29.             .@room = (.@room + 7) % 16;
  30.         }
  31.         else if (.@portal == 3) {
  32.             .@room = (.@room - 3) % 16;
  33.             if (.@room < 0)
  34.                 .@room = 16 + .@room;
  35.         }
  36.         else {
  37.             showscript "Invalid Portal#"+strnpcinfo(2);
  38.             end;
  39.         }
  40.         .@room = (.@room % 16);
  41.         if (.@room == 0) {
  42.             if (!getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ")) {
  43.                 warp .@map$, .@x, .@y - rand(5, 10);
  44.             }
  45.         }
  46.         else if (!getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#"+.@room+"-2")) {
  47.             warp .@map$, .@x, .@y + rand(5, 15);
  48.             showscript "<LMPQ> You entered Room #"+.@room;
  49.         }
  50.         else {
  51.             showscript "Invalid Portal#"+strnpcinfo(2);
  52.         }
  53.         end;
  54.        
  55.     OnLMPQEnable:
  56.         sscanf(strnpcinfo(2), "%d-%d", .@room, .@portal);
  57.         if (.@room > 0 && .@portal == 0) {
  58.             delwaitingroom;
  59.             waitingroom "LMPQ Room # "+.@room, 0;
  60.         }
  61.         end;
  62.        
  63.     OnLMPQDisable:
  64.         delwaitingroom;
  65.         end;
  66. }
  67.  
  68. -   script  Pietri::lmpq_main   -1,{
  69.    
  70.     OnInit:
  71.         // ticket ItemID + amount
  72.         .nameid = 512;
  73.         .amount = 100;
  74.         // bonus EXP given for each tickets
  75.         .exp_per_item = 50;
  76.         // Quest duration (minute)
  77.         .duration = 15;
  78.         // Required party member
  79.         .min_pt_member = 0;
  80.        
  81.         // Announcements within the map.
  82.         setarray .announce$,
  83.             "The objective of this party quest is to collect at least "+.amount+"x "+getitemname(.nameid)+" by killing monsters.",
  84.             "Bring the items to Pietri who will be waiting for you all at the last room (henceforth known as Room 16).",
  85.             "Navigating through the maze needs a firm foundation of how the rooms operate.",
  86.             "Each room of the maze consists of 3 portals (with the exception of Room 16).",
  87.             "Each type of monster drops a certain amount of tickets.",
  88.             "The more passes you have, the more experience points you will obtain at the end of the PQ.",
  89.             "Its absolutely vital for party members to follow the party leaders instructions so that all of you will not be lost.",
  90.             "Once you reach Room 16 with the tickets, talk to the NPC Pietri.",
  91.             "On exiting this PQ, you will be given experience points (based on the number of tickets you've obtained) and prizes.",
  92.             "That's all information for you all. Get ready, LMPQ shall be starting now...";
  93.         .announce_size = getarraysize(.announce$);
  94.        
  95.         getmapxy(.map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ");
  96.         setmapflag .map$, mf_noteleport;
  97.         setmapflag .map$, mf_nowarp;
  98.         setmapflag .map$, mf_nowarpto;
  99.         setmapflag .map$, mf_nobranch;
  100.         setmapflag .map$, mf_nosave;
  101.         setmapflag .map$, mf_nomemo;
  102.         setmapflag .map$, mf_nomobloot;
  103.         setmapflag .map$, mf_nomvploot;
  104.        
  105.         getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ_Register");
  106.         mapwarp .map$, .@map$, .@x, .@y;
  107.        
  108.         // bindatcmd("lmpq", strnpcinfo(3)+"::OnRoomWarp"); // quick access for each room.
  109.         end;
  110.        
  111.     OnRoomWarp:
  112.         if (getgmlevel() >= 99){
  113.             .@room = atoi(.@atcmd_parameters$[0]);
  114.             callsub(L_Warp, .@room);
  115.         }
  116.         end;
  117.    
  118.     L_Warp:
  119.         .@room = getarg(0, 0);
  120.         if (!getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#"+.@room+"-2")) {
  121.             warp .@map$, .@x, .@y + 15;
  122.         }
  123.         else {
  124.             showscript "Invalid Portal#"+.@room;
  125.         }
  126.         return;
  127.        
  128.     OnRegister:
  129.         .@party_id = getcharid(1);
  130.         .@is_leader = (getcharid(0) == getpartyleader(.@party_id, 2));
  131.        
  132.         mes "^0055FF[ "+strnpcinfo(1)+" ]^000000";
  133.         if (.status || getmapusers(.map$) > 0) {
  134.             mes "Sorry, currently another party are currently challenging the party quest now.";
  135.             mes "Try again later.";
  136.         }
  137.         else if (!.@is_leader) {
  138.             mes "You're not party leader.";
  139.         }
  140.         else if (.min_pt_member > 0 && !instance_check_party(.@party_id, .min_pt_member)) {
  141.             mes "Sorry, we required at least "+.min_pt_member+" online party members to participate this party quest.";
  142.             mes "Try again later.";
  143.         }
  144.         else {
  145.             .party_id = .@party_id;
  146.             .status = 1;
  147.             mes "Your party has successfully registered for the Party Quest.";
  148.             close2;
  149.             donpcevent strnpcinfo(3)+"::OnStart";
  150.             end;
  151.         }
  152.         close;
  153.        
  154.     OnTalk:
  155.         // changecamera(424, 42, -31);
  156.         .@party_id = getcharid(1);
  157.         .@is_leader = (getcharid(0) == getpartyleader(.@party_id, 2));
  158.        
  159.         mes "^0055FF[ "+strnpcinfo(1)+" ]^000000";
  160.         mes "Hey, I am "+strnpcinfo(1)+"...";
  161.         mes "Have you heard about LMPQ?";
  162.         next;
  163.         mes "^0055FF[ "+strnpcinfo(1)+" ]^000000";
  164.         if (.status != 1 || !.party_id) {
  165.             mes "Hope you enjoy the party quest. Try again next time.";
  166.             delitem .nameid, countitem(.nameid);
  167.             close2;
  168.             warp "SavePoint", 0, 0;
  169.             end;
  170.         }
  171.         else if (!.@is_leader) {
  172.             mes "You're not party leader.";
  173.         }
  174.         else if (countitem(.nameid) < .amount) {
  175.             mes "You're required to collect "+.amount+"x "+getitemname(.nameid)+" to clear the Party Quest.";
  176.         }
  177.         else {
  178.             .status = 2;
  179.             mes "Great! Your party manage to complete the task given, hence the LMPQ is done here!";
  180.             .@count = countitem(.nameid);
  181.             delitem .nameid, .@count;
  182.             close2;
  183.             getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ_Register");
  184.             getpartymember .@party_id, 2;
  185.             .@size = $@partymembercount;
  186.             copyarray(.@aid, $@partymemberaid, .@size);
  187.             for (.@i = 0; .@i < .@size; .@i++) {
  188.                 if (attachrid(.@aid[.@i])) {
  189.                     if (strcharinfo(3) == .map$) {
  190.                         dispbottom "<SYSTEM> Your team completed LMPQ by turning-in "+.@count+"x "+getitemname(.nameid);
  191.                         getexp((.exp_per_item * .@count), (.exp_per_item * .@count));
  192.                        
  193.                         // Reward (if any)
  194.                         if (.@count < 100) { // submit < 100 tickets.
  195.                             getitem 512, 10;
  196.                         }
  197.                         else if (.@count < 200) { // submit < 200 tickets.
  198.                             getitem 512, 10;
  199.                         }
  200.                         else { // submit more than 200 tickets.
  201.                             getitem 512, 30;
  202.                         }
  203.                        
  204.                         warp .@map$, .@x, .@y;
  205.                     }
  206.                     detachrid;
  207.                 }
  208.             }
  209.             awake strnpcinfo(3);
  210.             end;
  211.         }
  212.         close;
  213.        
  214.     OnStart:
  215.         if (.status == 1) {
  216.             killmonsterall(.map$);
  217.             if (.party_id > 0) {
  218.                 .@room = rand(1, 15);
  219.                 getpartymember .party_id, 2;
  220.                 .@size = $@partymembercount;
  221.                 copyarray(.@aid, $@partymemberaid, .@size);
  222.                 for (.@i = 0; .@i < .@size; .@i++) {
  223.                     if (attachrid(.@aid[.@i])) {
  224.                         delitem .nameid, countitem(.nameid);
  225.                         callsub(L_Warp, .@room);
  226.                         detachrid;
  227.                     }
  228.                 }
  229.                 sleep 5000;
  230.                 donpcevent "::OnLMPQEnable";
  231.                 // announce
  232.                 for (.@i = 0; .@i < .announce_size; .@i++) {
  233.                     mapannounce .map$, "<SYSTEM> " + .announce$[.@i], bc_map;
  234.                     sleep 500;
  235.                 }
  236.                 donpcevent strnpcinfo(3)+"::OnSummon";
  237.                
  238.                 sleep (.duration * 60000);
  239.                
  240.                 // time's out, no winner.
  241.                 if (.status == 1) {
  242.                     mapannounce .map$, "<SYSTEM> Time's UP, it seem like your party failed to complete this quest.", bc_map;
  243.                     sleep 5000;
  244.                 }
  245.             }
  246.             .party_id = 0;
  247.             .status = 0;
  248.             mapwarp .map$, .map$, 100, 18;
  249.             donpcevent "::OnLMPQDisable";
  250.             killmonsterall(.map$);
  251.         }
  252.         end;
  253.        
  254.     L_OnSummon:
  255.         .@x1 = getarg(0, 0);
  256.         .@y1 = getarg(1, 0);
  257.         .@x2 = getarg(2, 0);
  258.         .@y2 = getarg(3, 0);
  259.         .@label$ = getarg(4, "");
  260.        
  261.         .@getargcount = getargcount() - 1;
  262.         for (.@i = 5; .@i <= .@getargcount; .@i += 2) {
  263.             .@mob_id = getarg(.@i, 0);
  264.             .@amount = getarg(.@i+1, 1);
  265.             if (.@mob_id > 0 && .@amount > 0)
  266.                 areamonster .map$, .@x1, .@y1, .@x2, .@y2, "--ja--", .@mob_id, .@amount, .@label$;
  267.         }
  268.         return;
  269.        
  270.     OnSummon:
  271.         killmonsterall(.map$);
  272.         // callsub(L_OnSummon, .@x1, .@y1, .@x2, .@y2, "event_label", <mob_id>, <amount>, ..., <mob_id>, <amount>);
  273.        
  274.         callsub(L_OnSummon, 8, 128, 31, 151, strnpcinfo(3)+"::OnKill", 1002, 10, 1613, 10); // Room 1
  275.         callsub(L_OnSummon, 48, 128, 71, 151, strnpcinfo(3)+"::OnKill", 1784, 10, 1113, 10); // Room 2
  276.         callsub(L_OnSummon, 88, 128, 111, 151, strnpcinfo(3)+"::OnKill", 1242, 10, 1031, 10); // Room 3
  277.         callsub(L_OnSummon, 128, 128, 151, 151, strnpcinfo(3)+"::OnKill", 1002, 10, 1113, 10); // Room 4
  278.         callsub(L_OnSummon, 168, 128, 191, 151, strnpcinfo(3)+"::OnKill", 1784, 10, 1031, 10); // Room 5
  279.         callsub(L_OnSummon, 8, 88, 31, 111, strnpcinfo(3)+"::OnKill", 1242, 10, 1113, 10); // Room 6
  280.         callsub(L_OnSummon, 48, 88, 71, 111, strnpcinfo(3)+"::OnKill", 1002, 10, 1613, 10); // Room 7
  281.         callsub(L_OnSummon, 88, 88, 111, 111, strnpcinfo(3)+"::OnKill", 1784, 10, 1113, 10); // Room 8
  282.         callsub(L_OnSummon, 128, 88, 151, 111, strnpcinfo(3)+"::OnKill", 1242, 10, 1031, 10); // Room 9
  283.         callsub(L_OnSummon, 168, 88, 191, 111, strnpcinfo(3)+"::OnKill", 1002, 10, 1113, 10); // Room 10
  284.         callsub(L_OnSummon, 8, 48, 31, 71, strnpcinfo(3)+"::OnKill", 1784, 10, 1031, 10); // Room 11
  285.        
  286.         // special
  287.         callsub(L_OnSummon, 8, 88, 31, 111, strnpcinfo(3)+"::OnSummon2", 1902, 3); // Room 6
  288.         callsub(L_OnSummon, 48, 88, 71, 111, strnpcinfo(3)+"::OnSummon2", 1902, 2); // Room 7
  289.         end;
  290.        
  291.     OnSummon2:
  292.         if (.status == 1 && playerattached()) {
  293.             showscript "!!!";
  294.             sleep2 3000;
  295.             getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
  296.             callsub(L_OnSummon, .@x - 5, .@y - 5, .@x + 5, .@y + 5, strnpcinfo(3)+"::OnKill2", F_Rand(1090, 1096, 1120, 1388, 1582), rand(1,2));
  297.         }
  298.         end;
  299.        
  300.     OnKill:
  301.         if (.status == 1 && playerattached()) {
  302.             // each kill drop 1 tickets at 25% rate
  303.             getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
  304.             if (rand(100) < 25) {
  305.                 makeitem(.nameid, 1, .@map$, .@x + rand(-2, 2), .@y + rand(-2, 2));
  306.             }
  307.         }
  308.         end;
  309.        
  310.     OnKill2:
  311.         if (.status == 1 && playerattached()) {
  312.             // each kill drop random 3~5 tickets at 100% rate
  313.             getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
  314.             makeitem(.nameid, rand(3, 5), .@map$, .@x + rand(-2, 2), .@y + rand(-2, 2));
  315.         }
  316.         end;
  317. }
  318.  
  319. // Pietri Room Portal.
  320. new_zone04,99,10,4  duplicate(Pietri#LMPQ)  Pietri#0-2  WARPNPC,2,2
  321.  
  322. // Room's number signboard
  323. new_zone04,20,149,4 duplicate(Pietri#LMPQ)  Pietri#1-0  4_M_PIERROT
  324. new_zone04,60,149,4 duplicate(Pietri#LMPQ)  Pietri#2-0  4_M_PIERROT
  325. new_zone04,100,149,4    duplicate(Pietri#LMPQ)  Pietri#3-0  4_M_PIERROT
  326. new_zone04,140,149,4    duplicate(Pietri#LMPQ)  Pietri#4-0  4_M_PIERROT
  327. new_zone04,180,149,4    duplicate(Pietri#LMPQ)  Pietri#5-0  4_M_PIERROT
  328.  
  329. new_zone04,20,109,4 duplicate(Pietri#LMPQ)  Pietri#6-0  4_M_PIERROT
  330. new_zone04,60,109,4 duplicate(Pietri#LMPQ)  Pietri#7-0  4_M_PIERROT
  331. new_zone04,100,109,4    duplicate(Pietri#LMPQ)  Pietri#8-0  4_M_PIERROT
  332. new_zone04,140,109,4    duplicate(Pietri#LMPQ)  Pietri#9-0  4_M_PIERROT
  333. new_zone04,180,109,4    duplicate(Pietri#LMPQ)  Pietri#10-0 4_M_PIERROT
  334.  
  335. new_zone04,20,69,4  duplicate(Pietri#LMPQ)  Pietri#11-0 4_M_PIERROT
  336. new_zone04,60,69,4  duplicate(Pietri#LMPQ)  Pietri#12-0 4_M_PIERROT
  337. new_zone04,100,69,4 duplicate(Pietri#LMPQ)  Pietri#13-0 4_M_PIERROT
  338. new_zone04,140,69,4 duplicate(Pietri#LMPQ)  Pietri#14-0 4_M_PIERROT
  339. new_zone04,180,69,4 duplicate(Pietri#LMPQ)  Pietri#15-0 4_M_PIERROT
  340.  
  341. // Portal of each rooms
  342. new_zone04,8,128,4  duplicate(Pietri#LMPQ)  Pietri#1-1  WARPNPC,2,2
  343. new_zone04,20,128,4 duplicate(Pietri#LMPQ)  Pietri#1-2  WARPNPC,2,2
  344. new_zone04,31,128,4 duplicate(Pietri#LMPQ)  Pietri#1-3  WARPNPC,2,2
  345.  
  346. new_zone04,48,128,4 duplicate(Pietri#LMPQ)  Pietri#2-1  WARPNPC,2,2
  347. new_zone04,60,128,4 duplicate(Pietri#LMPQ)  Pietri#2-2  WARPNPC,2,2
  348. new_zone04,71,128,4 duplicate(Pietri#LMPQ)  Pietri#2-3  WARPNPC,2,2
  349.  
  350. new_zone04,88,128,4 duplicate(Pietri#LMPQ)  Pietri#3-1  WARPNPC,2,2
  351. new_zone04,100,128,4    duplicate(Pietri#LMPQ)  Pietri#3-2  WARPNPC,2,2
  352. new_zone04,111,128,4    duplicate(Pietri#LMPQ)  Pietri#3-3  WARPNPC,2,2
  353.  
  354. new_zone04,128,128,4    duplicate(Pietri#LMPQ)  Pietri#4-1  WARPNPC,2,2
  355. new_zone04,140,128,4    duplicate(Pietri#LMPQ)  Pietri#4-2  WARPNPC,2,2
  356. new_zone04,151,128,4    duplicate(Pietri#LMPQ)  Pietri#4-3  WARPNPC,2,2
  357.  
  358. new_zone04,168,128,4    duplicate(Pietri#LMPQ)  Pietri#5-1  WARPNPC,2,2
  359. new_zone04,180,128,4    duplicate(Pietri#LMPQ)  Pietri#5-2  WARPNPC,2,2
  360. new_zone04,191,128,4    duplicate(Pietri#LMPQ)  Pietri#5-3  WARPNPC,2,2
  361.  
  362. new_zone04,8,88,4   duplicate(Pietri#LMPQ)  Pietri#6-1  WARPNPC,2,2
  363. new_zone04,20,88,4  duplicate(Pietri#LMPQ)  Pietri#6-2  WARPNPC,2,2
  364. new_zone04,31,88,4  duplicate(Pietri#LMPQ)  Pietri#6-3  WARPNPC,2,2
  365.  
  366. new_zone04,48,88,4  duplicate(Pietri#LMPQ)  Pietri#7-1  WARPNPC,2,2
  367. new_zone04,60,88,4  duplicate(Pietri#LMPQ)  Pietri#7-2  WARPNPC,2,2
  368. new_zone04,71,88,4  duplicate(Pietri#LMPQ)  Pietri#7-3  WARPNPC,2,2
  369.  
  370. new_zone04,88,88,4  duplicate(Pietri#LMPQ)  Pietri#8-1  WARPNPC,2,2
  371. new_zone04,100,88,4 duplicate(Pietri#LMPQ)  Pietri#8-2  WARPNPC,2,2
  372. new_zone04,111,88,4 duplicate(Pietri#LMPQ)  Pietri#8-3  WARPNPC,2,2
  373.  
  374. new_zone04,128,88,4 duplicate(Pietri#LMPQ)  Pietri#9-1  WARPNPC,2,2
  375. new_zone04,140,88,4 duplicate(Pietri#LMPQ)  Pietri#9-2  WARPNPC,2,2
  376. new_zone04,151,88,4 duplicate(Pietri#LMPQ)  Pietri#9-3  WARPNPC,2,2
  377.  
  378. new_zone04,168,88,4 duplicate(Pietri#LMPQ)  Pietri#10-1 WARPNPC,2,2
  379. new_zone04,180,88,4 duplicate(Pietri#LMPQ)  Pietri#10-2 WARPNPC,2,2
  380. new_zone04,191,88,4 duplicate(Pietri#LMPQ)  Pietri#10-3 WARPNPC,2,2
  381.  
  382. new_zone04,8,48,4   duplicate(Pietri#LMPQ)  Pietri#11-1 WARPNPC,2,2
  383. new_zone04,20,48,4  duplicate(Pietri#LMPQ)  Pietri#11-2 WARPNPC,2,2
  384. new_zone04,31,48,4  duplicate(Pietri#LMPQ)  Pietri#11-3 WARPNPC,2,2
  385.  
  386. new_zone04,48,48,4  duplicate(Pietri#LMPQ)  Pietri#12-1 WARPNPC,2,2
  387. new_zone04,60,48,4  duplicate(Pietri#LMPQ)  Pietri#12-2 WARPNPC,2,2
  388. new_zone04,71,48,4  duplicate(Pietri#LMPQ)  Pietri#12-3 WARPNPC,2,2
  389.  
  390. new_zone04,88,48,4  duplicate(Pietri#LMPQ)  Pietri#13-1 WARPNPC,2,2
  391. new_zone04,100,48,4 duplicate(Pietri#LMPQ)  Pietri#13-2 WARPNPC,2,2
  392. new_zone04,111,48,4 duplicate(Pietri#LMPQ)  Pietri#13-3 WARPNPC,2,2
  393.  
  394. new_zone04,128,48,4 duplicate(Pietri#LMPQ)  Pietri#14-1 WARPNPC,2,2
  395. new_zone04,140,48,4 duplicate(Pietri#LMPQ)  Pietri#14-2 WARPNPC,2,2
  396. new_zone04,151,48,4 duplicate(Pietri#LMPQ)  Pietri#14-3 WARPNPC,2,2
  397.  
  398. new_zone04,168,48,4 duplicate(Pietri#LMPQ)  Pietri#15-1 WARPNPC,2,2
  399. new_zone04,180,48,4 duplicate(Pietri#LMPQ)  Pietri#15-2 WARPNPC,2,2
  400. new_zone04,191,48,4 duplicate(Pietri#LMPQ)  Pietri#15-3 WARPNPC,2,2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement