gldfunc_treasure.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //===== eAthena Script =======================================
  2. //= War of Emperium Guild Treasure Room Functions
  3. //===== By: ==================================================
  4. //= holyAngelX (1.0)
  5. //= 1.1 by Akaru and ho|yAnge|X
  6. //===== Current Version: =====================================
  7. //= 1.3
  8. //===== Compatible With: =====================================
  9. //= eAthena 0.1+; RO Episode 4+
  10. //===== Description: =========================================
  11. //= F_GldTreas spawns treasure chests used by the guild master.
  12. //= F_GldTreasSw allows the player to get out of the treasure room.
  13. //==============================================
  14. //= Break down of arguments used in the F_GldTreas:
  15. //= arg(0): name of guild castle
  16. //= arg(1): name of script that called the function
  17. //= arg(2): $variable for number of boxes to spawn for specific castle
  18. //= arg(2): $variable to be used as a counter
  19. //= arg(4): $variable for box/monster id number.
  20. //= arg(5): box/monster id#
  21. //= arg(6): x1 coordinate for areamonster call
  22. //= arg(7): y1 coordinate for areamonster call
  23. //= arg(8): x2 coordinate for areamonster call
  24. //= arg(9): y1 coordinate for areamonster call
  25. //= arg(10):
  26. //= Break down of arguments used in the F_GldTreasSw:
  27. //= arg(0): name of guild castle.
  28. //= arg(1): x1 coordinate for warp back to guild castle
  29. //= arg(2): y1 coordinate for warp back to guild castle
  30. //===== Additional Comments: =================================
  31. //= v1.2 Treasure room Spawn, and Treasure room Switch scripts now use these functions.[kobra_k88]
  32. //= v1.2a Function now returns to script that called it. Removed TreasureSpawn2.
  33. //= Changed back to using specific global variables for number of boxes and the box id. [kobra_k88]
  34. //= v1.2b Added a check to allow un broken treasure chests to respawn after map server restart.[kobra_k88]
  35. //= 1.3 Fixed treasure boxes spawn. (Unrolled one loop a bit) [Lupus]
  36. //============================================================
  37. //================================================
  38. // Treasure Spawning Function
  39. //================================================
  40. function script F_GldTreas {
  41. if(getarg(10) == 1) goto TreasureSpawn;
  42. SetCastleData getarg(0)+".gat",4,0;
  43. SetCastleData getarg(0)+".gat",5,0;
  44. KillMonster getarg(0)+".gat","Treasure_"+getarg(1)+"::OnDied";
  45. if (GetCastleData(getarg(0)+".gat",2) > 100) return;
  46. if (GetCastleData(getarg(0)+".gat",1) == 0) return;
  47. set getarg(2),GetCastleData(getarg(0)+".gat",2)/5+4;
  48. if (getarg(2) <= 0) return;
  49. set getarg(3), getarg(2); //sets the counter variable = to the box number amount
  50. TreasureSpawn:
  51. set getarg(4), getarg(5); //sets the box id variable = to the box id
  52. set $@temp, rand(4);
  53. if ($@temp > 2) set getarg(4), getarg(4) + 1;
  54. areamonster getarg(0)+".gat",getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  55. set getarg(3), getarg(3) - 1;
  56. if(getarg(3) <= 0) return;
  57. set getarg(4), getarg(5); //sets the box id variable = to the box id
  58. set $@temp, rand(4);
  59. if ($@temp > 2) set getarg(4), getarg(4) + 1;
  60. areamonster getarg(0)+".gat",getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  61. set getarg(3), getarg(3) - 1;
  62. if(getarg(3) <= 0) return;
  63. set getarg(4), getarg(5); //sets the box id variable = to the box id
  64. set $@temp, rand(4);
  65. if ($@temp > 2) set getarg(4), getarg(4) + 1;
  66. areamonster getarg(0)+".gat",getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  67. set getarg(3), getarg(3) - 1;
  68. if(getarg(3) <= 0) return;
  69. set getarg(4), getarg(5); //sets the box id variable = to the box id
  70. set $@temp, rand(4);
  71. if ($@temp > 2) set getarg(4), getarg(4) + 1;
  72. areamonster getarg(0)+".gat",getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  73. set getarg(3), getarg(3) - 1;
  74. if(getarg(3) <= 0) return;
  75. set getarg(4), getarg(5); //sets the box id variable = to the box id
  76. set $@temp, rand(4);
  77. if ($@temp > 2) set getarg(4), getarg(4) + 1;
  78. areamonster getarg(0)+".gat",getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  79. set getarg(3), getarg(3) - 1;
  80. if(getarg(3) > 0) goto TreasureSpawn;
  81. return;
  82. }
  83. //==============================================================
  84. // Treasure Room Switch
  85. //===============================================================
  86. function script F_GldTreasSw {
  87. mes " ";
  88. mes "There is little switch over here";
  89. mes "Would you like to pull the switch down?";
  90. next;
  91. menu "Yes",M_1,"No",-;
  92. close;
  93. M_1:
  94. warp getarg(0)+".gat",getarg(1),getarg(2);
  95. return;
  96. }