From b6a2e5b2f4ea1842b54d6ab230735358139e47c7 Mon Sep 17 00:00:00 2001 From: eaac Date: Sun, 11 Jun 2006 16:35:39 +0000 Subject: * eAAC update: - Added Vending Machine, made by Celestria. - Updated and fixed Coin Banker, by me :P. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7090 54d463be-8e91-2dee-dedb-b68131a5f0ec --- npc/Changelog.txt | 3 + npc/custom/eAAC_Scripts/banker.txt | 155 +++++++++-------- npc/custom/eAAC_Scripts/vendmachine.txt | 298 ++++++++++++++++++++++++++++++++ npc/scripts_eaac.conf | 7 + 4 files changed, 395 insertions(+), 68 deletions(-) create mode 100644 npc/custom/eAAC_Scripts/vendmachine.txt (limited to 'npc') diff --git a/npc/Changelog.txt b/npc/Changelog.txt index dbe108881..5d7ac2c94 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -37,6 +37,9 @@ Musashiden Date Added ====== 06/11 + * eAAC update: + - Added Vending Machine, made by Celestria. [erKURITA] + - Updated and fixed Coin Banker, by me :P. [erKURITA] * Updated all job quests, Valhallana, to completely save/restore ALL Quest Skills [Lupus] IMPORTANT! Don't forget to update all files, includin new Global_Functions.txt 06/09 diff --git a/npc/custom/eAAC_Scripts/banker.txt b/npc/custom/eAAC_Scripts/banker.txt index eb745f938..29dcdccb1 100644 --- a/npc/custom/eAAC_Scripts/banker.txt +++ b/npc/custom/eAAC_Scripts/banker.txt @@ -36,6 +36,18 @@ //| the amount of zeny you've inputted and the sum of //| the coin's values. +//| Revision: +//| v.2.5: Replaced all the coin names with a variable that has +//| getitemname( @zenyamount) { - mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); goto L_Overzeny; } else - mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); next; if (@totalzeny > @zenyamount) mes @npcname$; @@ -299,7 +314,7 @@ L_Mix: menu "It's enough, thanks",L_Payoff,"No, I want some more",-; next; mes @npcname$; - mes "Now ^999999Silver^000000 coins. How many coins do you want?"; + mes "Now ^999999"+@name2$+"s^000000. How many coins do you want?"; next; input @silvercoins; next; @@ -307,16 +322,16 @@ L_Mix: set @totalcoins,@bronzecoins+@silvercoins; mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000"; mes "Coins:"; - mes " ^996600Bronze^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000"; - mes " ^999999Silver^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000"; + mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000"; + mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000"; mes "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"; if (@totalzeny > @zenyamount) { - mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); goto L_Overzeny; } else - mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); next; if (@totalzeny > @zenyamount) goto L_Overzeny; mes @npcname$; @@ -324,24 +339,24 @@ L_Mix: menu "It's enough, thanks",L_Payoff,"No, I want some more",-; next; mes @npcname$; - mes "Now ^FFCC00Gold^000000 coins. How many coins do you want?"; + mes "Now ^FFCC00"+@name3$+"s^000000. How many coins do you want?"; input @goldcoins; next; set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice+@goldcoins*@goldprice; set @totalcoins,@bronzecoins+@silvercoins+@goldcoins; mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000"; mes "Coins:"; - mes " ^996600Bronze^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000"; - mes " ^999999Silver^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000"; - mes " ^FFCC00Gold^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000"; + mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000"; + mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000"; + mes " ^FFCC00"+@name3$+"s^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000"; mes "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"; if (@totalzeny > @zenyamount) { - mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); goto L_Overzeny; } else - mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); next; if (@totalzeny > @zenyamount) goto L_Overzeny; mes @npcname$; @@ -349,29 +364,29 @@ L_Mix: menu "It's enough, thanks",L_Payoff,"No, I want some more",-; next; mes @npcname$; - mes "Now ^CCCCCCMithril^000000 Coins. How many coins do you want?"; + mes "Now ^CCCCCC"+@name4$+"s^000000. How many coins do you want?"; input @mithrilcoins; next; set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice+@goldcoins*@goldprice+@mithrilcoins*@mithrilprice; set @totalcoins,@bronzecoins+@silvercoins+@goldcoins+@mithrilcoins; mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000"; mes "Coins:"; - mes " ^996600Bronze^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000"; - mes " ^999999Silver^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000"; - mes " ^FFCC00Gold^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000"; - mes " ^CCCCCCMithril^000000: "+@mithrilcoins+" ^CC0000"+@mithrilcoins*@mithrilprice+"^000000"; + mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000"; + mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000"; + mes " ^FFCC00"+@name3$+"s^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000"; + mes " ^CCCCCC"+@name4$+"s^000000: "+@mithrilcoins+" ^CC0000"+@mithrilcoins*@mithrilprice+"^000000"; mes "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"; if (@totalzeny > @zenyamount) { - mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); goto L_Overzeny; } else - mes "TOTAL: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; - mes "Zeny Left: "+@zenyammount-@totalzeny; + mes "TOTAL: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000"; + mes "Zeny Left: "+(@zenyamount-@totalzeny); next; if (@totalzeny > @zenyamount) goto L_Overzeny; mes @npcname$; - mes "Is this ok?: "+@bronzecoins+" bronze, "+@silvercoins+" silver, "+@goldcoins+" gold, "+@mithrilcoins+" mithril coins, for a total amount of "+@totalzeny; + mes "Is this ok?: "+@bronzecoins+" "+@name1$+"s, "+@silvercoins+" "+@name2$+"s, "+@goldcoins+" "+@name3$+"s, "+@mithrilcoins+" "+@name4$+"s, for a total amount of "+@totalzeny; menu "Yes, it's ok",L_Payoff,"No, I want to re-intro them",L_Mix,"Sorry, I dont want anything",L_Menu; L_Payoff: @@ -394,7 +409,11 @@ L_Payoff: L_Overzeny: next; mes @npcname$; - mes "Sorry, I can't do anything else. Either the sum of all the coins you inputted is bigger than the zeny amount inputted, or the inputted amout of zeny is bigger that your total Zeny. Please retry"; + mes "Sorry, I can't do anything else. Either the sum of all the coins you inputted is bigger than the zeny amount inputted, or the inputted amout of zeny is bigger that your total Zeny. Please retry."; next; goto L_Menu; -} \ No newline at end of file + +OnInit: +setitemscript 671,"{}"; +end; +} diff --git a/npc/custom/eAAC_Scripts/vendmachine.txt b/npc/custom/eAAC_Scripts/vendmachine.txt new file mode 100644 index 000000000..807a14e28 --- /dev/null +++ b/npc/custom/eAAC_Scripts/vendmachine.txt @@ -0,0 +1,298 @@ +//===================================== +// Vending Machine Script +// v2.3 +//===================================== +// by Celestria +//===================================== +// Changelog: +// 2.3 - Added in "Slam" feature, as well as admin ability to turn machine on and off. +// - Added admin menu. Allows GMs to put machines in/out of service, and to clear +// all jammed items. +// +// 2.2 - Added in/Renamed some variables to allow a single machine to block on several +// items simultaneously. This fix also allows the two-item drop to work with every +// item the machine is jammed on. +// +// 2.1 - Fixed an error where if one machine jammed on a menu item (say 3 for example), +// if another machine also jammed on the same menu item (3 in this case), the original +// machine to jam would be unjammed. +// - This fix only allows a machine to jam one item at a time. Will fix in the future. +// +// 2.0 - Completely redid the script using a call-function. +// Now all replica scripts can simply be a copy of Vending Machine, +// but with variables modified to suit it''s intended use. +// +// 1.1 - Fixed $jamplayer1 not being a string, thanks to Terces. +// - Changed random number that intiates jam to 1, to allow for faster modification of jam rates. +// +// 1.0 - Creted a script for selling numerous items that would occasionally jam on players. +// - Used numbered variables to allow for multiplacation of the script. +//===================================== + +p_track01.gat,45,58,4 script Vending Machine#1 910,{ + + set @machine,1; //sets the unique number of this machine + //DO NOT have two machines with the same number + + set @jamrate,1000; //Odds of machine jamming will be 1 in @jamrate + + set @slam,0; //set this to 0 to turn on the slam feature, any other setting disables it. + set @fallrate,10; //Odds of machine falling on someone who hits it are 1 in @fallrate + set @freerate,10000; //Odds of machine giving an item to someone who hits it are 1 in @freerate + + set @admin,99; //sets GM level needed to access Admin menu + + // the following sets the items for sale. Script currently only handles 10 items. + setarray @item[0], 12143, 519, 565; + setarray @price[0], 100, 50, 200; + + set @itemn$[0], getitemname(@item[0]); + set @itemn$[1], getitemname(@item[1]); + set @itemn$[2], getitemname(@item[2]); + set @itemn$[3], getitemname(@item[3]); + set @itemn$[4], getitemname(@item[4]); + set @itemn$[5], getitemname(@item[5]); + set @itemn$[6], getitemname(@item[6]); + set @itemn$[7], getitemname(@item[7]); + set @itemn$[8], getitemname(@item[8]); + set @itemn$[9], getitemname(@item[9]); + + set @menu$[0], @itemn$[0]+" - "+@price[0]; + set @menu$[1], @itemn$[1]+" - "+@price[1]; + set @menu$[2], @itemn$[2]+" - "+@price[2]; + set @menu$[3], "Cancel"; + set @menu$[4], ""; + set @menu$[5], ""; + set @menu$[6], ""; + set @menu$[7], ""; + set @menu$[8], ""; + set @menu$[9], ""; + set @menu$[10], ""; // "Cancel" only. Used if vending ten items. + + callfunc "F_Vend1"; +} + + + + + + + + + +//=============================================================================================== +// Functions +// +// !!!DO NOT EDIT BELOW THIS LINE!!! +// +//=============================================================================================== + +function script F_Vend1 { + + if(getgmlevel() >= @admin) goto M_Admin; + +M_Player: + if($outorder[@machine]) goto M_Ooo; + if(@slam) callfunc "F_Vend2"; + mes "You see a vending machine. What would you like to do?"; + next; + menu "Buy an item",M_Vend,"Hit it",M_Hit; + +M_Vend: + callfunc "F_Vend2"; + end; + +M_Hit: + callfunc "F_Slam"; + end; + +M_Admin: + mes "[Admin Mode]"; + mes "What would you like to do?"; + next; + menu "Player Mode",M_Player,"Post 'Out of Order'",M_Ooo2,"Remove 'Out of Order'",M_Ooo3,"Fix Jammed Items",M_Fix; + +M_Ooo: + mes "Out of Order"; + close; + +M_Ooo2: + set $outorder[@machine],1; + mes "The machine is now Out of Service"; + close; + +M_Ooo3: + set $outorder[@machine],0; + mes "The machine is now in service."; + close; + +M_Fix: + set $itemjam0$[@machine],"0"; + set $itemjam1$[@machine],"0"; + set $itemjam2$[@machine],"0"; + set $itemjam3$[@machine],"0"; + set $itemjam4$[@machine],"0"; + set $itemjam5$[@machine],"0"; + set $itemjam6$[@machine],"0"; + set $itemjam7$[@machine],"0"; + set $itemjam8$[@machine],"0"; + set $itemjam9$[@machine],"0"; + mes "All jammed items have been fixed."; + close; +} + +function script F_Vend2 { + + if(strcharinfo(0)==$itemjam0$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam1$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam2$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam3$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam4$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam5$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam6$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam7$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam8$[@machine]) goto B_StillJammed; + if(strcharinfo(0)==$itemjam9$[@machine]) goto B_StillJammed; + set @jammed,rand(1,@jamrate); + mes "You peek inside the vending machine to see what's available."; + next; + menu @menu$[0],M_Ite0, @menu$[1],M_Ite1, @menu$[2],M_Ite2, @menu$[3],M_Ite3, + @menu$[4],M_Ite4, @menu$[5],M_Ite5, @menu$[6],M_Ite6, @menu$[7],M_Ite7, + @menu$[8],M_Ite8, @menu$[9],M_Ite9, @menu$[10],M_Ite10; + + M_Ite0: + set @num, 0; + goto B_Buy; + M_Ite1: + set @num, 1; + goto B_Buy; + M_Ite2: + set @num, 2; + goto B_Buy; + M_Ite3: + set @num, 3; + goto B_Buy; + M_Ite4: + set @num, 4; + goto B_Buy; + M_Ite5: + set @num, 5; + goto B_Buy; + M_Ite6: + set @num, 6; + goto B_Buy; + M_Ite7: + set @num, 7; + goto B_Buy; + M_Ite8: + set @num, 8; + goto B_Buy; + M_Ite9: + set @num, 9; + goto B_Buy; + M_Ite10: + set @num, 10; + goto B_Buy; + + + +B_Cancel: + mes "On second thoughts, you decide not to buy anything."; + close; + +B_StillJammed: + mes "You shake and punch the vending machine, but it appears no matter how much energy you exert, the dang item isn't + +going to come loose."; + next; + mes "["+strcharinfo(0)+"]"; + mes "DANG VENDING MACHINES!"; + close; + +B_Broke: + mes "As you put your last zeny in, you realise you don't have enough to afford the product."; + mes "Sadly you hit the refund button and pick up what little zeny you have."; + close; + +B_Buy: + if (@menu$[@num] == "Cancel") goto B_Cancel; + if(@num==0){if($itemjam0$[@machine]!="0") set @jammed,0;} + if(@num==1){if($itemjam1$[@machine]!="0") set @jammed,0;} + if(@num==2){if($itemjam2$[@machine]!="0") set @jammed,0;} + if(@num==3){if($itemjam3$[@machine]!="0") set @jammed,0;} + if(@num==4){if($itemjam4$[@machine]!="0") set @jammed,0;} + if(@num==5){if($itemjam5$[@machine]!="0") set @jammed,0;} + if(@num==6){if($itemjam6$[@machine]!="0") set @jammed,0;} + if(@num==7){if($itemjam7$[@machine]!="0") set @jammed,0;} + if(@num==8){if($itemjam8$[@machine]!="0") set @jammed,0;} + if(@num==9){if($itemjam9$[@machine]!="0") set @jammed,0;} + if(Zeny < @price[@num]) goto B_Broke; + set Zeny,Zeny-@price[@num]; + if(@jammed == 1) goto B_Jamitem; + mes "Vrrrrrrrr~"; + mes "*clunk*"; + next; + if(@jammed == 0) goto B_Get2; + getitem @item[@num],1; + mes "A "+@itemn$[@num]+" pops out."; + close; +B_Get2: + getitem @item[@num],2; + mes "What the!?"; + mes "Two "+@itemn$[@num]+"s popped out!"; + mes "It must be your lucky day."; + if(@num==0) set $itemjam0$[@machine],"0"; + if(@num==1) set $itemjam1$[@machine],"0"; + if(@num==2) set $itemjam2$[@machine],"0"; + if(@num==3) set $itemjam3$[@machine],"0"; + if(@num==4) set $itemjam4$[@machine],"0"; + if(@num==5) set $itemjam5$[@machine],"0"; + if(@num==6) set $itemjam6$[@machine],"0"; + if(@num==7) set $itemjam7$[@machine],"0"; + if(@num==8) set $itemjam8$[@machine],"0"; + if(@num==9) set $itemjam9$[@machine],"0"; + close; +B_Jamitem: + mes "Vrrrrrrrr~"; + mes "*click*"; + next; + mes "["+strcharinfo(0)+"]"; + mes "Dammit!"; + mes "I hate it when these damn things jam!"; + if(@num==0) set $itemjam0$[@machine],strcharinfo(0); + if(@num==1) set $itemjam1$[@machine],strcharinfo(0); + if(@num==2) set $itemjam2$[@machine],strcharinfo(0); + if(@num==3) set $itemjam3$[@machine],strcharinfo(0); + if(@num==4) set $itemjam4$[@machine],strcharinfo(0); + if(@num==5) set $itemjam5$[@machine],strcharinfo(0); + if(@num==6) set $itemjam6$[@machine],strcharinfo(0); + if(@num==7) set $itemjam7$[@machine],strcharinfo(0); + if(@num==8) set $itemjam8$[@machine],strcharinfo(0); + if(@num==9) set $itemjam9$[@machine],strcharinfo(0); + close; +} + +function script F_Slam { + + set @fall,rand(1,@fallrate); + set @free,rand(1,@freerate); +R_Item: + set @num,rand(9); + if(@item[@num]==0) goto R_Item; + + mes "You give the vending machine a good solid whack."; + next; + mes "..."; + next; + if(@fall==1){ + mes "The machine shakes, and then falls directly on top of you."; + close2; + percentheal -100,-100; + end;} + if(@free==1){ + getitem @item[@num],1; + mes "The machine shakes, and then drops an item."; + close;} + mes "The machine shakes, but nothing happens"; + close; +} \ No newline at end of file diff --git a/npc/scripts_eaac.conf b/npc/scripts_eaac.conf index d2e8063d4..43c29b293 100644 --- a/npc/scripts_eaac.conf +++ b/npc/scripts_eaac.conf @@ -75,3 +75,10 @@ // Forum topic for support: //| http://www.eathena.ws/board/index.php?showtopic=80615 //npc: npc/custom/eAAC_Scripts/banker.txt + +// -------------------------------------------------------------- +// ---------------------- Vending Machine------------------------ +// Script made by Celestria +// Forum topic for support: +//| http://www.eathena.ws/board/index.php?showtopic=91261 +//npc: npc/custom/eAAC_Scripts/vendmachine.txt -- cgit v1.2.3-60-g2f50