Jump to content

Question

Posted (edited)

I here again, and still can't configure my event :(

event_invasion.txt

i need to add on this script a command line which will give a reward for the 3 players who kill more monsters in the event.

note : for the first player (who kill more monsters) will earn reward 1

for the second player will earn reward 2

for the third player will earn reward 3

the other players did not gain any reward, unless you kill the mvp

Edited by ZelosAvalon

5 answers to this question

Recommended Posts

Posted

Try this one.

jupe_ele,36,53,6    script    Event Invasion    105,{

setarray .@mp$[1], "prontera", "morocc", "geffen", "payon", "alberta", "izlude", "aldebaran",
   "xmas (lutie)", "comodo", "yuno", "amatsu", "gonryun", "umbala", "niflheim", "louyang", "jawaii", "ayothaya",
   "einbroch", "hugel", "rachel", "veins", "moscovia", "midgard camp", "manuk", "splendide", "brasilis", "el dicastes",
   "mora", "dewata", "malangdo island", "malaya port", "eclage";

setarray .mapflag_event, mf_nopvp, mf_nomobloot, mf_nobranch;


   // GM menu
   //It allows GMs Level 50 or more to Start and Stop invasions.

   if( getgmlevel() > .gm ) {
       if( .count ) {
           mes "[Event Invasion]";
           mes "An invasion is in progress..";
           mes "Location: " + .map_event$;
           mes "^FF0000"+.count+"^000000 Monsters left";
           mes " ";
           mes "Stop invasion?";
           if( select("No:Yes") ) close;
           donpcevent "Event Invasion::onstop";
           mes "Invasion stopped";
           announce "The Invasion has been stopped by "+strcharinfo(0),bc_all;
           close;
       }

       mes "[Event Invasion]";
       mes "Please customize the Invasion event before starting it.";
   Main:
       next;
       mes "[Event Invasion]";
       mes "MVP Item Drop:[^FF0000" + getitemname(.Item_ID) + "^000000]";
       mes "Monsters Respawn:[^FF0000" + strmobinfo(1,.mob_ID) + "^000000]";
       mes "Reward 1 place: [^FF0000" + getitemname(.gained[ 0 ]) + "^000000]";
       mes "Reward 2 place: [^FF0000" + getitemname(.gained[ 1 ]) + "^000000]";
       mes "Reward 3 place: [^FF0000" + getitemname(.gained[ 2 ]) + "^000000]";
       mes "MVP Respawn:[^FF0000" + strmobinfo(1,.Mvp_ID) + "^000000]";
       mes "Map Event will Start:[^FF0000"+.map_event$+"^000000]";

       switch(select("Item [" + getitemname(.Item_ID) + "]",
                   "Monster [" + strmobinfo(1,.mob_ID) + "]",
                   "Reward for the first place [" + getitemname(.gained[ 0 ]) + "]",
                   "Reward for the second place [" + getitemname(.gained[ 1 ]) + "]",
                   "Reward for the third place [" + getitemname(.gained[ 2 ]) + "]",
                   "MVP [" + strmobinfo(1,.Mvp_ID) + "]",
                   "Select Map Event["+.map_event$+"]:Start Event")) {
       case 1:
           next;
           mes "[Event Invasion]";
           mes "Which item would you like the MVP to drop?";
           mes "Please input the item ID:";
           input .Item_ID;
           if( getiteminfo( .Item_ID, 0 ) == -1 ) {
               .Item_ID = 0;
               mes "Unknown ID.";
           }
           goto Main;
       case 2:
           next;
           mes "[Event Invasion]";
           mes "Please input the monster ID:";
           input .mob_ID;
           if( strmobinfo( 1, .mob_ID ) == "" ) {
               .mob_ID = 0;
               mes "Unknown ID.";
           }
           goto Main;
       case 3:
           next;
           mes "[Event Invasion]";
           mes "Please input the first place will drop:";// ( here i will put id reward for the first place)
           input .gained[ 0 ];
           if( getiteminfo( .gained[ 0 ], 0 ) == -1 ) {
               .gained[ 0 ] = 0;
               mes "Unknown ID.";
           }
           goto Main;
       case 4:
           next;
           mes "[Event Invasion]";
           mes "Please input the second place will drop:";//  ( here i will put id reward for the second place)
           input .gained[ 1 ];
           if( getiteminfo( .gained[ 1 ], 0 ) == -1 ) {
               .gained[ 1 ] = 0;
               mes "Unknown ID.";
           }
           goto Main;
       case 5:
           next;
           mes "[Event Invasion]";
           mes "Please input the third place will drop:";//  ( here i will put id reward for the third place)
           input .gained[ 2 ];
           if( getiteminfo( .gained[ 2 ], 0 ) == -1 ) {
               .gained[ 2 ] = 0;
               mes "Unknown ID.";
           }
           goto Main;
       case 6:
           next;
           mes "[Event Invasion]";
           mes "Please input the MVP ID:";
           input .Mvp_ID;
           if( strmobinfo( 1, .Mvp_ID ) == "" ) {
               .Mvp_ID = 0;
               mes "Unknown ID.";
           }
           goto Main;
       case 7:
           next;
           mes "[Event Invasion]";
           for ( set .@i, 1; .@i < getarraysize(.@mp$); set .@i, .@i + 1 )
               set .@menuE$, .@menuE$ + .@mp$[.@i] + ":";
           set .map_event$, .@mp$[select( .@menuE$ )];
           mes "Map Event : "+.map_event$;

           for( .@i = 0; .@i < getarraysize( .mapflag_event ); .@i++ )
               setmapflag .map_event$, .mapflag_event[ .@i ];
           goto Main;
       case 8:
           next;
           mes "[Event Invasion]";
           if( !.Item_ID || !.mob_ID || !.Mvp_ID || .map_event$ == "" || !.gained[ 0 ] || !.gained[ 1 ] || !.gained[ 2 ] ) {
               mes "Miss some conditions.";
               goto Main;
           }
           mes "Starting the event now...";
           close2;
           goto onstart;
       }
   }

   // If a player clicks the NPC, it displays:
   mes "[Event Invasion]";
   mes .count+" monster have invaded "+.map_event$+"!";
   close;

           /////////////////////////
           //The actual NPC Script//
           /////////////////////////

//OnMinute50: // Change this to your liking ( automatic start )
onstart:
   if( .count ) end;
   set .count, .number_mob;
   sleep2 1000;
   announce "[ Rune-Midgard Guard ]: We have trouble here in the town " + .map_event$ + "!", bc_all;
   sleep2 5000;
   announce "[ Rune-Midgard Guard ]: Everyone, we need your help to get rid of these monsters!", bc_all;
   monster .map_event$,0,0,"--ja--",.mob_ID, .count, strnpcinfo(0)+"::OnMyMobDead";
   initnpctimer;
   end;




OnMyMobDead: //When a mob is killed
   .count--;
   for( .@i = 0; .@i < getarraysize( .Data ); .@i++ )
       if( getcharid(3) == .Data[ .@i ] ) {
           .Rank[ .@i ]++;
           break;
       }

   if( .@i == getarraysize( .Data ) ) {
       .Data[ .@i ] = getcharid(3);
       .Rank[ .@i ]++;
   }

   if( !.count ) {
       announce "[ Rune-Midgard Guard ]: The MvP " + strmobinfo( 1,.Mvp_ID ) + " has spawned in " + .map_event$ + "!", bc_all;
       monster .map_event$,0,0,"--ja--",.Mvp_ID,1,"Event Invasion::OnSpecialMobDead";
       for( .@j = .number_mob; .@j > 0; .@j-- )
           for( .@i = 0; .@i < getarraysize( .Rank ); .@i++ )
               if( .Rank[ .@i ] == .@j && isloggedin( .Data[ .@i ] ) ) {
                   getitem .gained[ .@W ], 1, .Data[ .@i ];
                   .@W++;
                   announce .@W +"°/ "+ rid2name( .Data[ .@i ] ) +" gained 1 "+ getitemname( .gained[ .@W-1 ] ),0;
                   if( .@W == getarraysize( .gained ) ) goto OnInit;
               }
       goto OnInit;
   } else
       announce "["+.count+"/"+.number_mob+"] " + strmobinfo(1,.mob_ID) + " left.",bc_map;
   end;


OnSpecialMobDead:
   announce strcharinfo(0)+" has fought off the Invasion and has been awarded a worthy prize!", bc_all;
   getitem .Item_ID, 1; //Change the [5] to the amount you wish to hand out.

onstop:
   killmonster .map_event$,"Event Invasion::OnSpecialMobDead";
   for( .@i = 0; .@i < getarraysize( .mapflag_event ); .@i++ )
       removemapflag .map_event$, .mapflag_event[ .@i ];

OnTimer1805000:    // 30 minutes later, kills all the mobs.
   killmonster .map_event$,"Event Invasion::OnMyMobDead";
   set .count, 0;
   stopnpctimer;

OnInit:
   deletearray .Data[ 0 ], getarraysize( .Data );
   deletearray .Rank[ 0 ], getarraysize( .Rank );
//- Config
//-- Number of mob spawn
   .number_mob = 250;
//-- GM Level to access the GM Menu.
   set .gm, 50;
   end;
}

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...