Advertisement
Dekita

Dekita RPG's

Oct 22nd, 2012
1,036
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.84 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Random Parameter Gains™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script simply randomizes actors parameter gains on level up.
  9. use notetags to set an actor's/class's individual parameter gains.
  10. use script calls to change them during gameplay.
  11. set the default gains in the customisation.
  12. You can also set enemies to have random params(params change each encounter).
  13. plug and play ^_^
  14.  
  15. if anyone doesnt know what a "param" is... "shakes head in disapproval"
  16.  
  17. ================================================================================
  18. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  19. ================================================================================
  20. 1. You must give credit to "Dekita"
  21. 2. You are NOT allowed to repost this script.(or modified versions)
  22. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  23. 4. You are NOT allowed to use this script for Commercial games.
  24. 5. ENJOY!
  25.  
  26. "FINE PRINT"
  27. By using this script you hereby agree to the above terms and conditions,
  28. if any violation of the above terms occurs "legal action" may be taken.
  29. Not understanding the above terms and conditions does NOT mean that
  30. they do not apply to you.
  31. If you wish to discuss the terms and conditions in further detail you can
  32. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  33.  
  34. ================================================================================
  35. History:
  36. =========
  37. D /M /Y
  38. 22/10/2o12 - started and finished,
  39.  
  40. ================================================================================
  41. Credit and Thanks to :
  42. =======================
  43.  
  44. ================================================================================
  45. Known Bugs:
  46. ============
  47. N/A
  48.  
  49. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  50. If a new bug is found please contact me at
  51. http://dekitarpg.wordpress.com/
  52.  
  53. ================================================================================
  54. INSTRUCTIONS:
  55. ==============
  56. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  57.  
  58. ================================================================================
  59. Script Calls:
  60. ==============
  61. change_rpg(actor_id, par_id, gain, min, max)
  62.  
  63. actor_id = the id of the actor
  64. par_id = the id of the parameter you want to change
  65. gain = the guaranteed gain (before min and max values)
  66. min = the minimum extra value gained
  67. max = the maximum extra value gained
  68.  
  69. no_rpg_gains(actor_id, bool)
  70. use this script call to stop/start random param gains
  71. bool = true / false
  72. true = use random gains
  73. false= DONT use random gains
  74.  
  75. ================================================================================
  76. NoteTags:
  77. ==========
  78. <rpg: par_id, gain, min, max>
  79. <rpg: par_id, min, max> <- THIS ONE IS FOR ENEMIES ONLY !
  80.  
  81. par_id = the id of the parameter you want to change
  82. gain = the guaranteed gain (before min and max values)
  83. min = the minimum extra value gained
  84. max = the maximum extra value gained
  85.  
  86. e.g
  87. <rpg: 0, 100, -50, 50>
  88. this will make param_id 0 gain 100 each level with a random loss of 50
  89. and a random gain of 50
  90.  
  91. <no rand gains>
  92. use this notetag to make an actor/class not have random gains (they will gain
  93. params equal to their class settings in the database)
  94.  
  95. =end #==========================================================================#
  96.  
  97. module Dekita__R_P_G
  98.  
  99. # Gain = The guaranteed gain before min and max values.
  100. # Min = the minimum extra gain(can be negative).
  101. # Max = the maximum extra gain.
  102.  
  103. # Param_id = 0.
  104. HP_Gain = 100
  105. HP_Min = -50
  106. HP_Max = 50
  107.  
  108. # Param_id = 1.
  109. MP_Gain = 100
  110. MP_Min = -50
  111. MP_Max = 50
  112.  
  113. # Param_id = 2.
  114. ATK_Gain = 10
  115. ATK_Min = -5
  116. ATK_Max = 5
  117.  
  118. # Param_id = 3.
  119. DEF_Gain = 10
  120. DEF_Min = -5
  121. DEF_Max = 5
  122.  
  123. # Param_id = 4.
  124. MAT_Gain = 10
  125. MAT_Min = -5
  126. MAT_Max = 5
  127.  
  128. # Param_id = 5.
  129. MDF_Gain = 10
  130. MDF_Min = -5
  131. MDF_Max = 5
  132.  
  133. # Param_id = 6.
  134. AGI_Gain = 10
  135. AGI_Min = -5
  136. AGI_Max = 5
  137.  
  138. # Param_id = 7.
  139. LUK_Gain = 10
  140. LUK_Min = -5
  141. LUK_Max = 5
  142.  
  143.  
  144. #####################
  145. # CUSTOMISATION END #
  146. # # Do not remove this. #####################
  147. p 'Loaded : DPBz - Random Parameter Gains (RPG)'
  148.  
  149. ACT_CLA_Note = /<rpg: (.*), (.*), (.*), (.*)>/i
  150. No_Rand_Note = /<no rand gains>/i
  151. ENEMY___Note = /<rpg: (.*), (.*), (.*)>/i
  152.  
  153. end # Dekita__R_P_G
  154. #===============================================================================#
  155. # http://dekitarpg.wordpress.com/ #
  156. #===============================================================================#
  157. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  158. # YES?\.\. #
  159. # OMG, REALLY? #
  160. # WELL SLAP MY FACE AND CALL ME A DRAGON.\..\.. #
  161. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  162. #===============================================================================#
  163. # - SCRIPT BEGIN - #
  164. #==============================================================================
  165. class Object
  166. #==============================================================================
  167.  
  168. if !$imported[:Dekita__CORE]
  169. def dpbz_randy(min, max)
  170. min + rand(max - min + 1)
  171. end
  172. end #imported[:Dekita__CORE]
  173.  
  174. end # class Object
  175.  
  176. #==============================================================================
  177. module DataManager
  178. #==============================================================================
  179.  
  180. class <<self; alias load_database_DPBz_Rand_PAR_ga1n load_database; end
  181. def self.load_database
  182. load_database_DPBz_Rand_PAR_ga1n
  183. load_notetags_DPBz_Rand_PAR_ga1n
  184. end
  185.  
  186. def self.load_notetags_DPBz_Rand_PAR_ga1n
  187. groups = [$data_actors, $data_classes, $data_enemies]
  188. for group in groups
  189. for obj in group
  190. next if obj.nil?
  191. obj.load_notetags_DPBz_Rand_PAR_ga1n
  192. end
  193. end
  194. end
  195.  
  196. end # DataManager
  197.  
  198. #==============================================================================
  199. class RPG::Actor < RPG::BaseItem
  200. #==============================================================================
  201.  
  202. attr_accessor :rand_par
  203. attr_accessor :use_dpbz_rpg_feat
  204.  
  205. def load_notetags_DPBz_Rand_PAR_ga1n
  206. @use_dpbz_rpg_feat = true
  207. @rand_par = []
  208. @rand_par[0] = [Dekita__R_P_G::HP_Gain, Dekita__R_P_G::HP_Min, Dekita__R_P_G::HP_Max]
  209. @rand_par[1] = [Dekita__R_P_G::MP_Gain, Dekita__R_P_G::MP_Min, Dekita__R_P_G::MP_Max]
  210. @rand_par[2] = [Dekita__R_P_G::ATK_Gain, Dekita__R_P_G::ATK_Min, Dekita__R_P_G::ATK_Max]
  211. @rand_par[3] = [Dekita__R_P_G::DEF_Gain, Dekita__R_P_G::DEF_Min, Dekita__R_P_G::DEF_Max]
  212. @rand_par[4] = [Dekita__R_P_G::MAT_Gain, Dekita__R_P_G::MAT_Min, Dekita__R_P_G::MAT_Max]
  213. @rand_par[5] = [Dekita__R_P_G::MDF_Gain, Dekita__R_P_G::MDF_Min, Dekita__R_P_G::MDF_Max]
  214. @rand_par[6] = [Dekita__R_P_G::AGI_Gain, Dekita__R_P_G::AGI_Min, Dekita__R_P_G::AGI_Max]
  215. @rand_par[7] = [Dekita__R_P_G::LUK_Gain, Dekita__R_P_G::LUK_Min, Dekita__R_P_G::LUK_Max]
  216. self.note.split(/[\r\n]+/).each { |line|
  217. case line
  218. when Dekita__R_P_G::ACT_CLA_Note
  219. @rand_par[$1.to_i] = [$2.to_i, $3.to_i, $4.to_i]
  220. p "Reading : DPBz - RPG notes for #{name}, par_id #{$1.to_s}, gain #{$2.to_s}, min #{$3.to_s}, max #{$4.to_s}"
  221. when Dekita__R_P_G::No_Rand_Note
  222. @use_dpbz_rpg_feat = false
  223. p "Reading : DPBz - RPG notes No Rand Gains for #{name}"
  224. end
  225. } # self.note.split
  226. end
  227.  
  228. end # RPG::Actor < RPG::BaseItem
  229.  
  230. #==============================================================================
  231. class RPG::Class < RPG::BaseItem
  232. #==============================================================================
  233.  
  234. attr_accessor :rand_par
  235. attr_accessor :use_dpbz_rpg_feat
  236.  
  237. def load_notetags_DPBz_Rand_PAR_ga1n
  238. @use_dpbz_rpg_feat = true
  239. @rand_par = []
  240. @rand_par[0] = [Dekita__R_P_G::HP_Gain, Dekita__R_P_G::HP_Min, Dekita__R_P_G::HP_Max]
  241. @rand_par[1] = [Dekita__R_P_G::MP_Gain, Dekita__R_P_G::MP_Min, Dekita__R_P_G::MP_Max]
  242. @rand_par[2] = [Dekita__R_P_G::ATK_Gain, Dekita__R_P_G::ATK_Min, Dekita__R_P_G::ATK_Max]
  243. @rand_par[3] = [Dekita__R_P_G::DEF_Gain, Dekita__R_P_G::DEF_Min, Dekita__R_P_G::DEF_Max]
  244. @rand_par[4] = [Dekita__R_P_G::MAT_Gain, Dekita__R_P_G::MAT_Min, Dekita__R_P_G::MAT_Max]
  245. @rand_par[5] = [Dekita__R_P_G::MDF_Gain, Dekita__R_P_G::MDF_Min, Dekita__R_P_G::MDF_Max]
  246. @rand_par[6] = [Dekita__R_P_G::AGI_Gain, Dekita__R_P_G::AGI_Min, Dekita__R_P_G::AGI_Max]
  247. @rand_par[7] = [Dekita__R_P_G::LUK_Gain, Dekita__R_P_G::LUK_Min, Dekita__R_P_G::LUK_Max]
  248. self.note.split(/[\r\n]+/).each { |line|
  249. case line
  250. when Dekita__R_P_G::ACT_CLA_Note
  251. @rand_par[$1.to_i] = [$2.to_i, $3.to_i, $4.to_i]
  252. p "Reading : DPBz - RPG notes for #{name}, par_id #{$1.to_s}, gain #{$2.to_s}, min #{$3.to_s}, max #{$4.to_s}"
  253. when Dekita__R_P_G::No_Rand_Note
  254. @use_dpbz_rpg_feat = false
  255. p "Reading : DPBz - RPG notes No Rand Gains for #{name}"
  256. end
  257. } # self.note.split
  258. end
  259.  
  260. end # RPG::Class < RPG::BaseItem
  261.  
  262. #==============================================================================
  263. class RPG::Enemy < RPG::BaseItem
  264. #==============================================================================
  265.  
  266. def load_notetags_DPBz_Rand_PAR_ga1n
  267. self.note.split(/[\r\n]+/).each { |line|
  268. case line
  269. when Dekita__R_P_G::ENEMY___Note
  270. @params[$1.to_i] = dpbz_randy($2.to_i, $3.to_i)
  271. p "Reading : DPBz - RPG notes for #{name}, par_id #{$1.to_s}, min #{$3.to_s}, max #{$4.to_s}"
  272. end
  273. } # self.note.split
  274. end
  275.  
  276. end # RPG::Enemy < RPG::BaseItem
  277.  
  278. #==============================================================================
  279. class Game_Actor < Game_Battler
  280. #==============================================================================
  281.  
  282. alias _Rand_PAR_ga1n_setup setup
  283. def setup(actor_id)
  284. _Rand_PAR_ga1n_setup(actor_id)
  285. @rand_par = $data_classes[@class_id].rand_par
  286. @rand_par = actor.rand_par if actor.note =~ Dekita__R_P_G::ACT_CLA_Note
  287. @use_dpbz_rpg_feat = $data_classes[@class_id].use_dpbz_rpg_feat
  288. @use_dpbz_rpg_feat = actor.use_dpbz_rpg_feat if actor.note =~ Dekita__R_P_G::No_Rand_Note
  289. end
  290.  
  291. alias myrandalisnameforthisscriptlol param_base
  292. def param_base(param_id)
  293. return self.class.params[param_id, actor.initial_level] if @use_dpbz_rpg_feat
  294. return myrandalisnameforthisscriptlol(param_id)
  295. end
  296.  
  297. alias _DPBz_Rand_PAR_ga1n__level_up level_up
  298. def level_up
  299. _DPBz_Rand_PAR_ga1n__level_up
  300. _WHAT_THE_FUNK? if @use_dpbz_rpg_feat
  301. end
  302.  
  303. def _WHAT_THE_FUNK?
  304. add_param(0, @rand_par[0][0] + dpbz_randy(@rand_par[0][1], @rand_par[0][2]))
  305. add_param(1, @rand_par[1][0] + dpbz_randy(@rand_par[1][1], @rand_par[1][2]))
  306. add_param(2, @rand_par[2][0] + dpbz_randy(@rand_par[2][1], @rand_par[2][2]))
  307. add_param(3, @rand_par[3][0] + dpbz_randy(@rand_par[3][1], @rand_par[3][2]))
  308. add_param(4, @rand_par[4][0] + dpbz_randy(@rand_par[4][1], @rand_par[4][2]))
  309. add_param(5, @rand_par[5][0] + dpbz_randy(@rand_par[5][1], @rand_par[5][2]))
  310. add_param(6, @rand_par[6][0] + dpbz_randy(@rand_par[6][1], @rand_par[6][2]))
  311. add_param(7, @rand_par[7][0] + dpbz_randy(@rand_par[7][1], @rand_par[7][2]))
  312. end
  313.  
  314. def _CHANGE_THE_FUNK?(par_id, gain, min, max)
  315. @rand_par[par_id] = [gain, min, max]
  316. end
  317.  
  318. def stop_go_rand_gain(actor_id, boolean)
  319. @use_dpbz_rpg_feat = boolean
  320. end
  321.  
  322. end # Game_Actor
  323.  
  324. #==============================================================================
  325. class Game_Interpreter
  326. #==============================================================================
  327. def change_rpg(actor_id, par_id, gain, min, max)
  328. actor = $game_actors[actor_id]
  329. return if actor == nil
  330. actor._CHANGE_THE_FUNK?(par_id, gain, min, max)
  331. end
  332.  
  333. def no_rpg_gains(actor_id, boolean)
  334. actor = $game_actors[actor_id]
  335. return if actor == nil
  336. actor.stop_go_rand_gain(actor_id, boolean)
  337. end
  338.  
  339. end # Game_Interpreter
  340.  
  341. #===============================================================================#
  342. # - SCRIPT END - #
  343. #===============================================================================#
  344. # http://dekitarpg.wordpress.com/ #
  345. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement