Advertisement
Dekita

eblock 1.1

Mar 8th, 2013
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.08 KB | None | 0 0
  1. =begin =========================================================================
  2. ┌───────────────┐ v 1.1
  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. o7/o3/2o13 - changed import method,
  35. - compatability with $D13x equip,
  36. 17/o2/2o13 - finished,
  37.  
  38. ================================================================================
  39. INSTRUCTIONS:
  40. ==============
  41. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  42. Place above ALL other scripts that require this one
  43.  
  44. ================================================================================
  45. To Scripters:
  46. ==============
  47. If you are wanting to trigger an effect block within one of your own scripts
  48. call this method...
  49. Effect_Blocks.trigger(BLOCK)
  50. BLOCK = the effect block ie, [:common, id]
  51.  
  52. ================================================================================
  53. NOTES :
  54. ========
  55. Some of the scripts i will write use what i like to call " Effect Blocks "
  56. This may not be the correct name, but its what i like to call them.
  57.  
  58. This information descrbes all the generic effect blocks used
  59. within certain scripts of mine.
  60.  
  61. An Effect Block is basically an array that holds information.
  62.  
  63. Effect Blocks will always be used in the customization options.
  64. They are used for certain scripts that unlock achievements or change
  65. the environment at times that may not be able to be controlled by
  66. the Developer. e.g A new Level is reached, a Pokemon Evolves,
  67. The REAL WORLD time changes and controls the environment,
  68. multiple different things..
  69.  
  70. I have written them as easy to understand as possible..
  71. here is a "default" effect blocks to get things started..
  72. [:common, id]
  73. as you can see the effect block is surrounded by square brackets '[' ']'
  74. this is what holds the information held in the block ie. an array
  75. :common = basically the method, the method MUST ALWAYS be first in the block
  76. this tells the block what it was designed to control, in this case ,
  77. it triggers a common event.
  78. id = the id of the common event to trigger.
  79.  
  80. And its that easy.
  81. Of course some more complex effect blocks can be a little complicated,
  82. But ALL Effect Blocks work in this way, ie. you can read it and it tells you
  83. EXACTLY what it does..
  84.  
  85. Heres a few examples ;
  86.  
  87. [:common, 1]
  88. Triggers common event id 1.
  89.  
  90. [:switch, 169, true]
  91. This turns game switch number 169 on.
  92.  
  93. [:switch, 274, false]
  94. This turns game switch number 274 off.
  95.  
  96. As you can see you can also control game switches with effect blocks,
  97. the format of a switch effect block is this.. [:switch, id, boolean]
  98.  
  99. Now Heres a more complicated effect block..
  100. [:variable, 1, :set, 3]
  101. As with before this effect block is easy to read,
  102. ie. variable 1 set at the value of 3
  103. but unlike the others it has a larger array with a second method,
  104. this is because there is multiple things you may want to do with this block,
  105. just like you would with game variables.
  106. the secondary :variable methods are :set, :add, :sub, :div, :mul, :mod
  107. as you can see, these are standard ways of controlling variables.
  108. the variable format is .. [:variable, id, control_type, value]
  109. control_type = the secondary method called, ie :sub , :add ect
  110.  
  111. Here is a full list of all DEFAULT Effect Blocks.
  112. DEFAULT = Can be used in all of my scripts that use effect blocks.
  113. [:common, id]
  114. [:switch, id, true]
  115. [:switch, id, false]
  116. [:variable, id, :set, value]
  117. [:variable, id, :add, value]
  118. [:variable, id, :sub, value]
  119. [:variable, id, :div, value]
  120. [:variable, id, :mul, value]
  121. [:variable, id, :mod, value]
  122. [:gold, :gain, value]
  123. [:gold, :lose, value]
  124. [:item, id, amount, include equip(bool)]
  125. [:weapon, id, amount, include equip(bool)]
  126. [:armor, id, amount, include equip(bool)]
  127. Note ~
  128. for :weapon and :armor, if using my $D13x equip system, the amount will become
  129. the teir of the equip rather than the amount.(equip can also only be added)
  130.  
  131. You can also create your own custom effect blocks in scripts that use them.
  132. And thats all there is to know about the basics of effect blocks..
  133.  
  134. =end #=========================================================================#
  135. module Effect_Blocks
  136. #==============================================================================#
  137. # This is simply the module that holds the default effect blocks
  138. # DO NOT modify the exsisting code, but feel free to add to it, IF
  139. # you are confident in what you are doing and need to impliment
  140. # a new common effect block.
  141. def self.trigger(block)
  142. return if block == nil
  143. case block[0]
  144. when :switch
  145. $game_switches[block[1]] = block[2]
  146. when :variable
  147. case block[2]
  148. when :set ; value = block[3]
  149. when :add ; value = ($game_variables[block[1]] + block[3])
  150. when :sub ; value = ($game_variables[block[1]] - block[3])
  151. when :div ; value = ($game_variables[block[1]] / block[3])
  152. when :mul ; value = ($game_variables[block[1]] * block[3])
  153. when :mod ; value = ($game_variables[block[1]] % block[3])
  154. end; $game_variables[block[1]] = (value).to_i
  155. when :common
  156. $game_temp.reserve_common_event( eff[1] )
  157. when :gold
  158. case block[1]
  159. when :gain ; $game_party.gain_gold(block[2].to_i)
  160. when :lose ; $game_party.lose_gold(block[2].to_i)
  161. end
  162. when :item
  163. $game_party.gain_item($data_items[block[1]],block[2].to_i)
  164. when :weapon
  165. inc_e = block[3] == nil ? false : block[3]
  166. if $D13x[:Equip]['core']
  167. Cloning_101.start_clone(:weapon, block[1], block[2].to_i)
  168. else
  169. $game_party.gain_item($data_weapons[block[1]],block[2].to_i,inc_e)
  170. end
  171. when :armor
  172. inc_e = block[3] == nil ? false : block[3]
  173. if $D13x[:Equip]['core']
  174. Cloning_101.start_clone(:armor, block[1], block[2].to_i)
  175. else
  176. $game_party.gain_item($data_armors[block[1]],block[2].to_i,inc_e)
  177. end
  178. end
  179. end
  180.  
  181. end
  182.  
  183. $imported = {} if $imported.nil?
  184. $imported[:Effect_Blocks] = {} if $imported[:Effect_Blocks].nil?
  185. $imported[:Effect_Blocks]['core'] = true
  186.  
  187. #==============================================================================#
  188. # http://dekitarpg.wordpress.com/ #
  189. #==============================================================================#
  190. # - SCRIPT END - #
  191. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement