Advertisement
Dekita

Fblk

Feb 19th, 2013
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.41 KB | None | 0 0
  1. =begin =========================================================================
  2. ┌───────────────┐ v 1.0
  3. │ Effect Blocks™│
  4. │ By Dekita │
  5. └───────────────┘
  6. ================================================================================
  7. Script Information:
  8. ====================
  9. This script simply holds effect blocks, for use with some of my other scripts
  10. ie. scripts that enable these effects to be triggered.
  11. There is also substantial information on how they work included in this script
  12.  
  13. ================================================================================
  14. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  15. ================================================================================
  16. 1. You MUST give credit to "Dekita" !!
  17. 2. You are NOT allowed to repost this script.(or modified versions)
  18. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  19. 4. You are NOT allowed to use this script for Commercial games.
  20. 5. ENJOY!
  21.  
  22. "FINE PRINT"
  23. By using this script you hereby agree to the above terms and conditions,
  24. if any violation of the above terms occurs "legal action" may be taken.
  25. Not understanding the above terms and conditions does NOT mean that
  26. they do not apply to you.
  27. If you wish to discuss the terms and conditions in further detail you can
  28. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  29.  
  30. ================================================================================
  31. History:
  32. =========
  33. D /M /Y
  34. 17/o2/2o13 - finished,
  35.  
  36. ================================================================================
  37. INSTRUCTIONS:
  38. ==============
  39. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  40. Place above ALL other scripts that require this one
  41.  
  42. ================================================================================
  43. To Scripters:
  44. ==============
  45. If you are wanting to trigger an effect block within one of your own scripts
  46. call this method...
  47. Effect_Blocks.trigger(BLOCK)
  48. BLOCK = the effect block ie, [:common, id]
  49.  
  50. ================================================================================
  51. NOTES :
  52. ========
  53. Some of the scripts i will write use what i like to call " Effect Blocks "
  54. This may not be the correct name, but its what i like to call them.
  55.  
  56. This information descrbes all the generic effect blocks used
  57. within certain scripts of mine.
  58.  
  59. An Effect Block is basically an array that holds information.
  60.  
  61. Effect Blocks will always be used in the customization options.
  62. They are used for certain scripts that unlock achievements or change
  63. the environment at times that may not be able to be controlled by
  64. the Developer. e.g A new Level is reached, a Pokemon Evolves,
  65. The REAL WORLD time changes and controls the environment,
  66. multiple different things..
  67.  
  68. I have written them as easy to understand as possible..
  69. here is a "default" effect blocks to get things started..
  70. [:common, id]
  71. as you can see the effect block is surrounded by square brackets '[' ']'
  72. this is what holds the information held in the block ie. an array
  73. :common = basically the method, the method MUST ALWAYS be first in the block
  74. this tells the block what it was designed to control, in this case ,
  75. it triggers a common event.
  76. id = the id of the common event to trigger.
  77.  
  78. And its that easy.
  79. Of course some more complex effect blocks can be a little complicated,
  80. But ALL Effect Blocks work in this way, ie. you can read it and it tells you
  81. EXACTLY what it does..
  82.  
  83. Heres a few examples ;
  84.  
  85. [:common, 1]
  86. Triggers common event id 1.
  87.  
  88. [:switch, 169, true]
  89. This turns game switch number 169 on.
  90.  
  91. [:switch, 274, false]
  92. This turns game switch number 274 off.
  93.  
  94. As you can see you can also control game switches with effect blocks,
  95. the format of a switch effect block is this.. [:switch, id, boolean]
  96.  
  97. Now Heres a more complicated effect block..
  98. [:variable, 1, :set, 3]
  99. As with before this effect block is easy to read,
  100. ie. variable 1 set at the value of 3
  101. but unlike the others it has a larger array with a second method,
  102. this is because there is multiple things you may want to do with this block,
  103. just like you would with game variables.
  104. the secondary :variable methods are :set, :add, :sub, :div, :mul, :mod
  105. as you can see, these are standard ways of controlling variables.
  106. the variable format is .. [:variable, id, control_type, value]
  107. control_type = the secondary method called, ie :sub , :add ect
  108.  
  109. Here is a full list of all DEFAULT Effect Blocks.
  110. DEFAULT = Can be used in all of my scripts that use effect blocks.
  111. [:common, id]
  112. [:switch, id, true]
  113. [:switch, id, false]
  114. [:variable, id, :set, value]
  115. [:variable, id, :add, value]
  116. [:variable, id, :sub, value]
  117. [:variable, id, :div, value]
  118. [:variable, id, :mul, value]
  119. [:variable, id, :mod, value]
  120. [:gold, :gain, value]
  121. [:gold, :lose, value]
  122. [:item, id, amount, include equip(bool)]
  123. [:weapon, id, amount, include equip(bool)]
  124. [:armor, id, amount, include equip(bool)]
  125.  
  126. You can also create your own custom effect blocks in scripts that use them.
  127. And thats all there is to know about the basics of effect blocks..
  128.  
  129. =end #=========================================================================#
  130. module Effect_Blocks
  131. #==============================================================================#
  132. # This is simply the module that holds the default effect blocks
  133. # DO NOT modify the exsisting code, but feel free to add to it, IF
  134. # you are confident in what you are doing and need to impliment
  135. # a new common effect block.
  136. def self.trigger(block)
  137. return if block == nil
  138. case block[0]
  139. when :switch
  140. $game_switches[block[1]] = block[2]
  141. when :variable
  142. case block[2]
  143. when :set ; value = block[3]
  144. when :add ; value = ($game_variables[block[1]] + block[3])
  145. when :sub ; value = ($game_variables[block[1]] - block[3])
  146. when :div ; value = ($game_variables[block[1]] / block[3])
  147. when :mul ; value = ($game_variables[block[1]] * block[3])
  148. when :mod ; value = ($game_variables[block[1]] % block[3])
  149. end; $game_variables[block[1]] = (value).to_i
  150. when :common
  151. $game_temp.reserve_common_event( eff[1] )
  152. when :gold
  153. case block[1]
  154. when :gain ; $game_party.gain_gold(block[2].to_i)
  155. when :lose ; $game_party.lose_gold(block[2].to_i)
  156. end
  157. when :item
  158. inc_e = block[3] == nil ? false : block[3]
  159. $game_party.gain_item($data_items[block[1]],block[2].to_i,inc_e)
  160. when :weapon
  161. inc_e = block[3] == nil ? false : block[3]
  162. $game_party.gain_item($data_weapons[block[1]],block[2].to_i,inc_e)
  163. when :armor
  164. inc_e = block[3] == nil ? false : block[3]
  165. $game_party.gain_item($data_armors[block[1]],block[2].to_i,inc_e)
  166. end
  167. end
  168.  
  169. end
  170.  
  171. $imported = {} if $imported.nil?
  172. $imported[:Effect_Blocks] = true
  173.  
  174. #==============================================================================#
  175. # - SCRIPT END - #
  176. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement