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.