// TMW-2 Script // Author: // Crazyfefe // Jesusalva // // Do not add void items to array. // note : the rare item system suck. 001-1,124,85,0 script Ishi NPC_PLAYER,{ if (!#Mobpt) { mesn l("Ishi, the Rewards Master"); mesq l("I am a Mob Points transmutter. Please ask my friend Aidan what those are."); close; } mesn l("Ishi, the Rewards Master"); mesq l("Welcome! I'm a Mob Point Transmutter. I see you have @@ Mob Points."); // @WildX I could not decide if we should use a shop (where players can choose their // reward) or if we should use a lottery (for the sake of randomness). I left here // the old lottery, but I'm not very optimistic of this getting in at all. // The code for a shop is really simple to do, just shout if you want it. // // I also see a thousand of possible improvements and cleanups past this line. // As gumi said he can clean up, I'll save myself the work to do so. setarray @Items$, "Croconut","Plushroom","BlueCottonDye"; setarray @Rares$, "BrimmedHat", 5, "LousyMoccasins", 5; next; do { select rif(Mobpt >= BaseLevel ** 2,l("1")), rif(Mobpt >= (BaseLevel ** 2)*2,l("2")), rif(Mobpt >= (BaseLevel ** 2)*3,l("3")), rif(Mobpt >= (BaseLevel ** 2)*4,l("4")), rif(Mobpt >= (BaseLevel ** 2)*5,l("5")), rif(Mobpt >= (BaseLevel ** 2)*6,l("6")), rif(Mobpt >= (BaseLevel ** 2)*7,l("7")), rif(Mobpt >= (BaseLevel ** 2)*8,l("8")), rif(Mobpt >= (BaseLevel ** 2)*9,l("9")), rif(Mobpt >= (BaseLevel ** 2)*10,l("10")), rif(Mobpt >= (BaseLevel ** 2)*11,l("Give me as many as I deserve!")), l("Sorry, I have to go now."); switch (@menu) { case 1 : @var = 1; goto L_Items; break; case 2 : @var = 2; goto L_Items; break; case 3 : @var = 3; goto L_Items; break; case 4 : @var = 4; goto L_Items; break; case 5 : @var = 5; goto L_Items; break; case 6 : @var = 6; goto L_Items; break; case 7 : @var = 7; goto L_Items; break; case 8 : @var = 8; goto L_Items; break; case 9 : @var = 9; goto L_Items; break; case 10 : @var = 10; goto L_Items; break; case 11 : goto L_Give_all; break; default : goto L_Close; break; } } while (@menu != 12); closedialog; goodbye; close; L_Close: @var=0; closedialog; goodbye; close; L_Items: for (.@i = 0; .@i < @var; .@i ++) { // Setup .@lucked=0; .@reward$=""; getinventorylist; if (@inventorylist_count == 100) goto L_NoPlace; // Test rares @lucky = rand(10000) + 1; for (.@b = 0; .@b < getarraysize(@Rares$); .@b=.@b+2) { if (.@b == 0) @control = 0; if(@lucky >= (@control + 1) && @lucky <= @control + atoi(@Rares$[.@b+1])) { .@lucked=1; .@reward$ = @Rares$[.@b]; } @control = @control + atoi(@Rares$[.@b+1]); } // Test reward. Could be (!.@lucked) but I thought this check would be safer if (.@reward$ == "") set .@reward$, @Items$[rand(getarraysize(@Items$))]; // If you don't have weight, abort NOW. .@weight = checkweight(.@reward$,1); if (!.@weight) goto L_NoPlaceWeight; // Reduce points and get item Mobpt = Mobpt - BaseLevel ** 2; getitem .@reward$,1; // Print stuff. Special text if rare. if (.@lucked) { mes ""; mes l("Wow!"); mes l("I can't believe."); mes l("you got lucky and got a(n) @@!", getitemlink(.@reward$)); mes ""; } else { mesq l("You received one @@!", getitemlink(.@reward$)); } } close; L_Continue: mesq l("You still have @@ Monster Points! Do you want more items?", Mobpt); do { select l("Yes"), l("No"); switch (@menu) { case 1: goto L_Give_all; break; case 2: goto L_Close; break; } } while (@menu != 2); L_NoPlace : mesq l("You seem to run out of place, you should go to the storage."); close; L_NoPlaceWeight : mesq l("You can't carry more items, you should go to the storage."); close; L_Give_all: @var = Mobpt / BaseLevel ** 2; if (@var > 30) { // limit to prevent a possible server lag. @var = 30; mes l("You have too much points. I can't allow you to take all at once right now. I'll try to give you 30, and you come back later!"); next; } goto L_Items; close; OnInit: .@npcId = getnpcid(0, .name$); setunitdata(.@npcId, UDT_HEADMIDDLE, LegionCopperArmor); setunitdata(.@npcId, UDT_HEADBOTTOM, BrownTrousers); setunitdata(.@npcId, UDT_WEAPON, LousyMoccasins); // Boots setunitdata(.@npcId, UDT_HAIRSTYLE, 4); setunitdata(.@npcId, UDT_HAIRCOLOR, 13); .sex = G_MALE; .distance = 5; end; }