From 44862dca9b6f26513f23ea1fd79365c7a8d33d9e Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 1 Jun 2019 21:30:02 -0300 Subject: Use rand2() instead of rand() in several places --- npc/002-1/chefgado.txt | 2 +- npc/003-1/ishi.txt | 2 +- npc/003-1/lieutenantdausen.txt | 4 ++-- npc/003-1/quirino.txt | 2 +- npc/003-1/swezanne.txt | 2 +- npc/003-10/slots.txt | 6 +++--- npc/005-3/barrel.txt | 8 +------- npc/006-1/crazyfefe.txt | 2 +- npc/009-5/joaquim.txt | 2 +- npc/012-4/wyara.txt | 2 +- npc/017-1/stranger.txt | 2 +- npc/017-3/dimonds.txt | 2 +- npc/017-3/slots.txt | 6 +++--- npc/functions/goodbye.txt | 2 +- npc/functions/news.txt | 4 ++-- npc/functions/nurse.txt | 4 ++-- npc/functions/random-talk.txt | 12 ++++++------ 17 files changed, 29 insertions(+), 35 deletions(-) (limited to 'npc') diff --git a/npc/002-1/chefgado.txt b/npc/002-1/chefgado.txt index f47a3d9f8..5d464e965 100644 --- a/npc/002-1/chefgado.txt +++ b/npc/002-1/chefgado.txt @@ -91,7 +91,7 @@ L_Reward: end; L_Complete: - .@r = rand(3); + .@r = rand2(3); if (.@r == 0) npctalk3 l("What are you doing in my kitchen?! Get out, it's not a place for kids!"); if (.@r == 1) npctalk3 l("Where is the salt?! This is sugar! Proper sailors need salt, not sugar!"); if (.@r == 2) npctalk3 l("Are you going to stand here all day long? Go wash the dishes or go away."); diff --git a/npc/003-1/ishi.txt b/npc/003-1/ishi.txt index e371acfc5..2283af685 100644 --- a/npc/003-1/ishi.txt +++ b/npc/003-1/ishi.txt @@ -159,7 +159,7 @@ L_Items: //debugmes "Setting reward"; // could be if (!.@lucked) but for sanity... if (.@reward$ == "") - set .@reward$, @Items$[rand(getarraysize(@Items$))]; + .@reward$=any_of(@Items$); //debugmes "Check weight"; .@weight = checkweight(.@reward$,1); diff --git a/npc/003-1/lieutenantdausen.txt b/npc/003-1/lieutenantdausen.txt index 7f0569819..74503a99a 100644 --- a/npc/003-1/lieutenantdausen.txt +++ b/npc/003-1/lieutenantdausen.txt @@ -286,7 +286,7 @@ OnInit: // Render random guard answer after bringing him water function script GuardsGratitude { - switch (rand(6)) + switch (rand2(6)) { case 0: .@message$ = l("God bless you! You have saved me from sweltering!"); @@ -307,7 +307,7 @@ function script GuardsGratitude { .@message$ = l("Who are you? Thanks for the help."); break; default: - .@message$="Thank you!"; + .@message$=l("Thank you!"); break; } diff --git a/npc/003-1/quirino.txt b/npc/003-1/quirino.txt index 44cb3a007..669cb61ed 100644 --- a/npc/003-1/quirino.txt +++ b/npc/003-1/quirino.txt @@ -91,7 +91,7 @@ L_SignUp: if(@cartinventorylist_count>=1) goto L_Full; // Warp player - if (rand(1,2) == 1) + if (rand2(1,2) == 1) warp "001-8", rand(42, 57), 42; else warp "001-8", rand(42, 57), 57; diff --git a/npc/003-1/swezanne.txt b/npc/003-1/swezanne.txt index ade6a9b8a..d201f62b0 100644 --- a/npc/003-1/swezanne.txt +++ b/npc/003-1/swezanne.txt @@ -29,7 +29,7 @@ L_Heroics: next; mesn; - .@d=rand(1,6); + .@d=rand2(1,6); if (.@d == 1) .@deed$="protected our cities!"; else if (.@d == 2) .@deed$="did great acts of bravery!"; diff --git a/npc/003-10/slots.txt b/npc/003-10/slots.txt index 1a1d5e6f4..c3e845b27 100644 --- a/npc/003-10/slots.txt +++ b/npc/003-10/slots.txt @@ -59,9 +59,9 @@ L_Spin: mesc l("Spinning..."); next; delitem CasinoCoins, 1; - .@a=rand(1,7); - .@b=rand(1,7); - .@c=rand(1,7); + .@a=rand2(1,7); + .@b=rand2(1,7); + .@c=rand2(1,7); symbol(.@a); symbol(.@b); symbol(.@c); diff --git a/npc/005-3/barrel.txt b/npc/005-3/barrel.txt index c70ce6664..23476ac32 100644 --- a/npc/005-3/barrel.txt +++ b/npc/005-3/barrel.txt @@ -13,12 +13,6 @@ // 3 Bomb Defused. // 4 Quest Completed. -// TODO FIXME: KNOWN BUG -// It is a known bug that using .questCheck and .questState is ABSOLUTELY WRONG -// A NPC variable affects the whole server, lasting until server restart. -// Therefore, by using "." variables, it will only work at localhosts. -// TODO FIXME: KNOWN BUG - function script CheckBarrel { @barrel_count = 0; @count_tmp = 0; @@ -40,7 +34,7 @@ L_BarrelTally: killmonster("005-3", "Trainer::OnKillHouseMaggot"); setq CandorQuest_Barrel, 3; } - @rand = rand(7); + @rand = rand2(7); if (@rand == 0) getitem Coal,1; else if (@rand == 1) diff --git a/npc/006-1/crazyfefe.txt b/npc/006-1/crazyfefe.txt index e120c2db1..6d7236aa7 100644 --- a/npc/006-1/crazyfefe.txt +++ b/npc/006-1/crazyfefe.txt @@ -222,7 +222,7 @@ function NextRound { mapannounce "006-1", "The wave nÂș "+$@FEFE_WAVE+" is starting with " + $@FEFE_CAVE_PLAYER_COUNT + " player(s) left alive." , 0; - .@amount=$@FEFE_WAVE+$@FEFE_CAVE_PLAYER_COUNT+rand(1,2); + .@amount=$@FEFE_WAVE+$@FEFE_CAVE_PLAYER_COUNT+rand2(1,2); freeloop(true); for (.@i = 0; .@i < .@amount; ++.@i) { diff --git a/npc/009-5/joaquim.txt b/npc/009-5/joaquim.txt index 3362a2ef4..fb8ed9b6c 100644 --- a/npc/009-5/joaquim.txt +++ b/npc/009-5/joaquim.txt @@ -27,7 +27,7 @@ L_TooWeak: L_Weak: mesn; - .@r=rand(1,5); + .@r=rand2(1,5); switch (.@r) { case 1: mesq l("Watch out! My wife was gravely wounded the other day. Don't forget your shield when leaving this holy place!"); diff --git a/npc/012-4/wyara.txt b/npc/012-4/wyara.txt index 861abd1f1..cf0c29cc2 100644 --- a/npc/012-4/wyara.txt +++ b/npc/012-4/wyara.txt @@ -73,7 +73,7 @@ L_Piberries: inventoryplace PiberriesInfusion, 1; Zeny=Zeny-50; - delitem Piberries, rand(3,4); + delitem Piberries, rand2(3,4); getitem PiberriesInfusion, 1; getexp 10, 0; goto L_Piberries; diff --git a/npc/017-1/stranger.txt b/npc/017-1/stranger.txt index 1beeb5264..9d75731d1 100644 --- a/npc/017-1/stranger.txt +++ b/npc/017-1/stranger.txt @@ -112,7 +112,7 @@ L_Hard: L_Fail: mes ""; mesn; - if (rand(1,2) == 1) { + if (rand2(1,2) == 1) { mesq l("Sorry, but that's not right."); next; mesn; diff --git a/npc/017-3/dimonds.txt b/npc/017-3/dimonds.txt index 06980aae3..e32654722 100644 --- a/npc/017-3/dimonds.txt +++ b/npc/017-3/dimonds.txt @@ -616,7 +616,7 @@ OnInit: close; Zeny=Zeny-100; recovery(getcharid(3)); - if (rand(1,3) == 1) + if (rand2(1,3) == 1) sc_start SC_POISON, 60000, 0, 10000; else sc_start SC_ATTHASTE_POTION1, 60000, 5; diff --git a/npc/017-3/slots.txt b/npc/017-3/slots.txt index d77761d72..3394a8fb7 100644 --- a/npc/017-3/slots.txt +++ b/npc/017-3/slots.txt @@ -63,9 +63,9 @@ L_Spin: mesc l("Spinning..."); next; delitem CasinoCoins, 2; - .@a=rand(1,7); - .@b=rand(1,7); - .@c=rand(1,7); + .@a=rand2(1,7); + .@b=rand2(1,7); + .@c=rand2(1,7); symbol(.@a); symbol(.@b); symbol(.@c); diff --git a/npc/functions/goodbye.txt b/npc/functions/goodbye.txt index 620883b8c..b52146188 100644 --- a/npc/functions/goodbye.txt +++ b/npc/functions/goodbye.txt @@ -28,7 +28,7 @@ function script goodbye_msg { l("Cheers!"), l("Take care!"); - return .byemsg$[rand(getarraysize(.byemsg$))]; + return any_of(.byemsg$); } diff --git a/npc/functions/news.txt b/npc/functions/news.txt index df0c4dc90..eb2a9c5b8 100644 --- a/npc/functions/news.txt +++ b/npc/functions/news.txt @@ -296,7 +296,7 @@ function script GameNews { mesc l("This somehow affected the whole economy."); next; mesc l("Some adventurer broke what was previously thought as maximum level, and is now level 40!"); - mes l("##9Was that not sufficient, this someone acquired MAGIC and is now under @@'s group.", (rand(0,1) ? "Colin" : "Luca")); + mes l("##9Was that not sufficient, this someone acquired MAGIC and is now under @@'s group.", (rand2(0,1) ? "Colin" : "Luca")); next; mesc l("The Magic Council finished the reform on their guest hall."); mesc l("Soren, the architect responsible for it, is very happy with the new design."); @@ -396,7 +396,7 @@ function script Journalman { mesc l("The Monster King Army left the cities! What will happen next? Anxiety grows!"); break; case 2: - mesc l("The Monster King Army is attacking towns at random! Players already caused a loss of about @@ officers!", ($MK_TEMPVAR+rand(-1,1))/5); + mesc l("The Monster King Army is attacking towns at random! Players already caused a loss of about @@ officers!", ($MK_TEMPVAR+rand2(-1,1))/5); break; default: Exception(l("I do now know what this means: GS-@@-ICXN-@@", $GAME_STORYLINE, $@MK_TEMPVAR), RB_DEFAULT|RB_SPEECH); break; diff --git a/npc/functions/nurse.txt b/npc/functions/nurse.txt index 0e6b0b4b4..7335c74f6 100644 --- a/npc/functions/nurse.txt +++ b/npc/functions/nurse.txt @@ -27,7 +27,7 @@ function script Nurse { mesn getarg(0); // Random message - .@temp = rand(1,4); + .@temp = rand2(1,4); switch (.@temp) { case 1: mesq l("You don't look too well; let me treat your wounds."); @@ -72,7 +72,7 @@ function script Nurse { sc_end(SC_SLOWPOISON); percentheal 100,100; // We can also use "recovery()" but that revives players :o mesn getarg(0); - @temp = rand(1,4); + @temp = rand2(1,4); if(@temp == 1) mesq l("Here you go!"); if(@temp == 2) mesq l("Painless, wasn't it?"); if(@temp == 3) mesq l("You should be more careful."); diff --git a/npc/functions/random-talk.txt b/npc/functions/random-talk.txt index 4a4202f34..b9df6783a 100644 --- a/npc/functions/random-talk.txt +++ b/npc/functions/random-talk.txt @@ -19,7 +19,7 @@ function script hello { - switch (rand(3)) { + switch (rand2(3)) { case 0: npctalkonce(l("Heya!")); break; @@ -38,7 +38,7 @@ function script hello { } function script moubootalk { - switch (rand(4)) { + switch (rand2(4)) { case 0: npctalkonce(l("Moooooo!")); break; @@ -57,7 +57,7 @@ function script moubootalk { function script sailortalk { - .@rand = rand(8); + .@rand = rand2(8); if (.@rand == 0) goodbye; if (.@rand == 1) npctalkonce(l("Arr, I'm bored!")); if (.@rand == 2) npctalkonce(l("Hey! Good to hear from you!")); @@ -101,7 +101,7 @@ function script villagertalk { return; } - switch (rand(4)) { + switch (rand2(4)) { case 0: darn_or_smile(); break; @@ -123,7 +123,7 @@ function script villagertalk { } function script legiontalk { - switch (rand(15)) { + switch (rand2(15)) { case 0: npctalkonce(l("Do I look like a tree? I feel like one.")); //speech( @@ -183,7 +183,7 @@ function script legiontalk { } function script asleep { - switch(rand(5)) { + switch(rand2(5)) { case 0: npctalkonce(l("Zzzzzzzzz...")); break; case 1: npctalkonce(l("Rrrr... Pchhhh...")); break; case 2: npctalkonce(l("Ggrmm... Grmmmm...")); break; -- cgit v1.2.3-70-g09d2