Jump to content
  • 0

MvP Sumoner


Question

Posted

Hello I wanted to put this npc mvp to invoke the player choose in exchange for bloody twig with a chance of 50% chance to fail for non vip.

 


06guild_01,50,93,4 script MVP Summoner 404,{

mes "[MVP Summoner]";
mes "Hi, what can I do for you ?";
next;
switch (select("Summon MVP","Summon Mini Boss","Heal","Leave this room")) {

case 1:
mes "[MVP Summoner]";
mes strcharinfo(0)+" It can only be summon 2 Monster in the Room.";
next;
switch (select( "Bacsojin","Baphomet","Dark Lord","Detale","Doppelgangger","Dracula","Drake","Eddga","Evil Snake Lord","Garm","Golden Thief Bug","Gopinich","Incantation Samurai","Knight of Windstorm","Maya","Mistress","Moonlight Flower","Orc Hero","Orc Lord","Osiris","Pharaoh","Phreeoni","RSX 0806","Tao Gunka","Turtle General")){

case 1 :

if ( getmapmobs("this") > 2 ){
mes "[MVP Summoner]";
mes "I cannot summon another monster when there are monsters around.";
close;}
else if ( zeny < 10000 ) {
mes "[MVP Summoner]";
mes "Sorry, you don't have enough money to summon";
close;}
set Zeny, zeny -10000;
monster "this", 49, 49, "--ja--",1630,1;
announce "MVP Summoner: "+strcharinfo(0)+" have been summon Bacsojin, only him can kill it.",bc_map,0x70DBDB;
close;

2 answers to this question

Recommended Posts

Posted
At first sight it will not work, the switch has one case twice. 
 
At the moment:
case 1: -something-
case 1: - something else-

 

 

 
I guess your idea is something like this:
 
 
case 1:

    if (monter>monsterlimit){
        - do something
    }
    else {
        -do something else
    }

 

Also, I suggest to define a temporal character variable to spawn the monster inside in each case:
 
case 1:
    monster =monsterid;

case 2:
    monster=monsterid2;

case n:
    monster=monsteridn;

 

 
Then you just need to spawn with one line may be at the end of the script : (I did not use the correct variable definition, this is just the idea)
 
 
monster "this", 49, 49, "--ja--",monsterid,1;

 

 
 
The way you have scripted the npc, it is a little repetitive (this is just my opinion), I also suggest something like this:
 
keep everithing until the first "case 1 :" (line 7, more or less). There, define a variable I told you and after the switch use the confirmation and filters. Something like this (I stink to write pseudocode, I hope you understand the idea):
 
[your previous code]

case 1:
     monster=monterid1;
case 2:
     monster=monterid2;
case 3:
     monster=monterid3;
...

if(zeny<price) {//zeny filter

    mesages -> you are poor
    close;
}

if (monsters in map with a certain event< monster allowed){//amount of monsters
 
mesages -> your are great, here is your monster!
action  -> spawn the monster giving a certain event
[the event is important or it will count the slaves, as far as I know]
}
else{ //therefore the maximum amount reached
    mesage-> there is already the maximum amount of monsters
    close;
 
}

 

 

About to use close or end I am not sure, rathena uses other standard (if I am not wrong, eA user).
 
If you use this optimization your script will do the same in less lines.
  • 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...