Advertisement
Dekita

Actor F'z

Feb 19th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.72 KB | None | 0 0
  1. =begin =========================================================================
  2. ┌───────────────┐ v 1.0
  3. │ Actor Effects™│
  4. │ By Dekita │
  5. └───────────────┘
  6. ================================================================================
  7. Script Information:
  8. ====================
  9. This script allows you to trigger various things at times that are usually
  10. outwith a developers control, you can trigger various effects such as ...
  11. control game switches,
  12. control game variables,
  13. trigger common events,
  14. change party gold,
  15. and whatever else you can code with minimal effort.
  16.  
  17. examples of why you may want to do this...
  18.  
  19. an actor dies and increases a certain variable...
  20. an actor escapes but it costs 50 gold...
  21. an actor learns a skill and it triggers a common event, if skill is id X...
  22. an actor reaches level 25 so you want to reward them with extra gold...
  23. an actor changes class and it controls a custom effect you coded..
  24. - this effect could be *almost* any other script call from other scripts
  25. - Note ~ *almost*
  26. - Note 2 ~ some script calls would not be wise to use with this script
  27. ~ use common sense..
  28.  
  29. BiG NOTE :
  30. ALL of the default settings control variables.
  31. you would probably want to change this, i only done it this way to show
  32. how the effects should be set up.
  33. Consult my effect blocks script for the default effects and block codes
  34.  
  35. BIGGER NOTE :
  36. This script requires my Effect Blocks Script !!
  37.  
  38. ================================================================================
  39. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  40. ================================================================================
  41. 1. You MUST give credit to "Dekita" !!
  42. 2. You are NOT allowed to repost this script.(or modified versions)
  43. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  44. 4. You are NOT allowed to use this script for Commercial games.
  45. 5. ENJOY!
  46.  
  47. "FINE PRINT"
  48. By using this script you hereby agree to the above terms and conditions,
  49. if any violation of the above terms occurs "legal action" may be taken.
  50. Not understanding the above terms and conditions does NOT mean that
  51. they do not apply to you.
  52. If you wish to discuss the terms and conditions in further detail you can
  53. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  54.  
  55. ================================================================================
  56. History:
  57. =========
  58. D /M /Y
  59. 13/o2/2o13 - Started, Finished,
  60.  
  61. ================================================================================
  62. INSTRUCTIONS:
  63. ==============
  64. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  65. Place this script UNDER my "Effect Blocks" script.
  66.  
  67. =end #=========================================================================#
  68. module Actor_Effects
  69.  
  70. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  71. def self.trigger(block,actor_id,state_id,level,class_id,skill_id)
  72. return if block == nil ; effect = nil ; case block[0]# DONT DELETE
  73. # Note, arguements are only passed if they are available at the time of
  74. # being triggered.
  75. # state_id is only passed when a state is added/removed
  76. # skill_id is only passed when a skill is learned/forgot
  77. # all other args* are passed regardless(as they are variables/methods too).
  78. # you can simply make effect = nil to have no effect
  79. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  80. # This is where you adjust the effects that happen when states are added
  81. # and removed.
  82. #---------------------------------------------------------------------------
  83. when :state
  84. case block[1]
  85. when :add
  86. effect = [:variable, 1, :add, 1] if actor_id == 1 && state_id == 5
  87. effect = [:variable, 2, :add, 1] if actor_id == 2
  88. effect = [:variable, 3, :add, 1] if actor_id == 3
  89. effect = [:variable, 4, :add, 1] if actor_id == 4
  90. when :rem
  91. effect = [:variable, 5, :add, 1] if actor_id == 1
  92. effect = [:variable, 6, :add, 1] if actor_id == 2
  93. effect = [:variable, 7, :add, 1] if actor_id == 3
  94. effect = [:variable, 8, :add, 1] if actor_id == 4
  95. end
  96. #---------------------------------------------------------------------------
  97. # This is where you adjust the effects that happen when an actor dies
  98. #---------------------------------------------------------------------------
  99. when :die
  100. effect = [:variable, 9 , :add, 1] if actor_id == 1
  101. effect = [:variable, 10, :add, 1] if actor_id == 2
  102. effect = [:variable, 11, :add, 1] if actor_id == 3
  103. effect = [:variable, 12, :add, 1] if actor_id == 4
  104. #---------------------------------------------------------------------------
  105. # This is where you adjust the effects that happen when an actor is revived
  106. #---------------------------------------------------------------------------
  107. when :revive
  108. effect = [:variable, 13, :add, 1] if actor_id == 1
  109. effect = [:variable, 14, :add, 1] if actor_id == 2
  110. effect = [:variable, 15, :add, 1] if actor_id == 3
  111. effect = [:variable, 16, :add, 1] if actor_id == 4
  112. #---------------------------------------------------------------------------
  113. # This is where you adjust the effects that happen when an actor escapes
  114. #---------------------------------------------------------------------------
  115. when :escape
  116. effect = [:variable, 17, :add, 1] if actor_id == 1
  117. effect = [:variable, 18, :add, 1] if actor_id == 2
  118. effect = [:variable, 19, :add, 1] if actor_id == 3
  119. effect = [:variable, 20, :add, 1] if actor_id == 4
  120. #---------------------------------------------------------------------------
  121. # This is where you adjust the effects that happen when an actor levels
  122. # up and down .
  123. #---------------------------------------------------------------------------
  124. when :level
  125. case block[1]
  126. when :up
  127. effect = [:variable, 21, :add, 1] if actor_id == 1
  128. effect = [:variable, 22, :add, 1] if actor_id == 2
  129. effect = [:variable, 23, :add, 1] if actor_id == 3
  130. effect = [:variable, 24, :add, 1] if actor_id == 4
  131. when :down
  132. # by removing this code it will make effect = nil
  133. end
  134. #---------------------------------------------------------------------------
  135. # This is where you adjust the effects that happen when an actor learns
  136. # and forgets skills
  137. #---------------------------------------------------------------------------
  138. when :skill
  139. case block[1]
  140. when :learn
  141. effect = [:variable, 29, :add, 1] if actor_id == 1
  142. effect = [:variable, 30, :add, 1] if actor_id == 2
  143. effect = [:variable, 31, :add, 1] if actor_id == 3
  144. effect = [:variable, 32, :add, 1] if actor_id == 4
  145. when :forget
  146. effect = [:variable, 33, :add, 1] if actor_id == 1
  147. effect = [:variable, 34, :add, 1] if actor_id == 2
  148. effect = [:variable, 35, :add, 1] if actor_id == 3
  149. effect = [:variable, 36, :add, 1] if actor_id == 4
  150. end
  151. #---------------------------------------------------------------------------
  152. # This is where you adjust the effects that happen when an actor changes
  153. # to a new class
  154. #---------------------------------------------------------------------------
  155. when :change_class
  156. # by removing this code it will make effect = nil
  157. #---------------------------------------------------------------------------
  158. # If you want to make custom effects you can do so in the Effect Blocks
  159. # script, if you have sufficient coding knowladge..
  160. end #-----------------------------------------------------------------------
  161. #---------------------------------------------------------------------------
  162. # This is where the script triggers the effect you defined
  163. # (unless effect = nil), you can use this to your advantage if you want
  164. # to use advanced coding.
  165. #---------------------------------------------------------------------------
  166. Effect_Blocks.trigger(effect)
  167. end
  168.  
  169. #####################
  170. # CUSTOMISATION END #
  171. end # end module #####################
  172. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  173. # #
  174. # http://dekitarpg.wordpress.com/ #
  175. # #
  176. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  177. #===============================================================================#
  178. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  179. # YES?\.\. #
  180. # OMG, REALLY? \| #
  181. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  182. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  183. #===============================================================================#
  184.  
  185. $imported = {} if $imported.nil?
  186. $imported[:Effect_Blocks['Actor_Basics']] = true
  187.  
  188. #==============================================================================
  189. class Game_Battler < Game_BattlerBase
  190. #==============================================================================
  191. #--------------------------------------------------------------------------
  192. # * Alias List
  193. #--------------------------------------------------------------------------
  194. alias :ans_eff_block_GB :add_new_state
  195. alias :rms_eff_block_GB :remove_state
  196. alias :die_eff_block_GB :die
  197. alias :rev_eff_block_GB :revive
  198. alias :esc_eff_block_GB :escape
  199. alias :addbuff_eff_block_GB :add_buff
  200. alias :add_dbuff_eff_block_GB :add_debuff
  201. #--------------------------------------------------------------------------
  202. # * Add New State
  203. #--------------------------------------------------------------------------
  204. def add_new_state(state_id)
  205. ans_eff_block_GB(state_id)
  206. ans_effect(state_id)
  207. end
  208. #--------------------------------------------------------------------------
  209. # * Remove State
  210. #--------------------------------------------------------------------------
  211. def remove_state(state_id)
  212. rms_eff_block_GB(state_id)
  213. rems_effect(state_id) if state?(state_id)
  214. end
  215. #--------------------------------------------------------------------------
  216. # * Knock Out
  217. #--------------------------------------------------------------------------
  218. def die
  219. die_eff_block_GB
  220. die_effect
  221. end
  222. #--------------------------------------------------------------------------
  223. # * Revive from Knock Out
  224. #--------------------------------------------------------------------------
  225. def revive
  226. rev_eff_block_GB
  227. revi_effect
  228. end
  229. #--------------------------------------------------------------------------
  230. # * Escape
  231. #--------------------------------------------------------------------------
  232. def escape
  233. esc_eff_block_GB
  234. escap_effect
  235. end
  236. #--------------------------------------------------------------------------
  237. # * New Methods created for use in child class, ie Game_Actor
  238. #--------------------------------------------------------------------------
  239. def ans_effect(state_id)
  240. end
  241. def rems_effect(state_id)
  242. end
  243. def die_effect
  244. end
  245. def revi_effect
  246. end
  247. def escap_effect
  248. end
  249.  
  250. end
  251.  
  252. #==============================================================================
  253. class Game_Actor < Game_Battler
  254. #==============================================================================
  255. #--------------------------------------------------------------------------
  256. # * Alias List
  257. #--------------------------------------------------------------------------
  258. alias :lvup_eff_block_GA :level_up
  259. alias :lvdown_eff_block_GA :level_down
  260. alias :lskill_eff_block_GA :learn_skill
  261. alias :fskil_eff_block_GA :forget_skill
  262. alias :cclas_eff_block_GA :change_class
  263. #--------------------------------------------------------------------------
  264. # * Level Up
  265. #--------------------------------------------------------------------------
  266. def level_up
  267. lvup_eff_block_GA
  268. lv_up_e_bllock
  269. end
  270. #--------------------------------------------------------------------------
  271. # * Level Down
  272. #--------------------------------------------------------------------------
  273. def level_down
  274. lvdown_eff_block_GA
  275. lv_down_e_bllock
  276. end
  277. #--------------------------------------------------------------------------
  278. # * Learn Skill
  279. #--------------------------------------------------------------------------
  280. def learn_skill(skill_id)
  281. lskill_eff_block_GA(skill_id)
  282. unless skill_learn?($data_skills[skill_id])
  283. learn_skilll_e_bllock(skill_id)
  284. end
  285. end
  286. #--------------------------------------------------------------------------
  287. # * Forget Skill
  288. #--------------------------------------------------------------------------
  289. def forget_skill(skill_id)
  290. fskil_eff_block_GA(skill_id)
  291. forget_skilll_e_bllock(skill_id)
  292. end
  293. #--------------------------------------------------------------------------
  294. # * Change Class
  295. # keep_exp: Keep EXP
  296. #--------------------------------------------------------------------------
  297. def change_class(class_id, keep_exp = false)
  298. cclas_eff_block_GA(class_id, keep_exp = false)
  299. change_class_e_bllock
  300. end
  301. #--------------------------------------------------------------------------
  302. # * Add New State Effect Block Trigger
  303. #--------------------------------------------------------------------------
  304. def ans_effect(state_id)
  305. eff = [:state, :add]
  306. Actor_Effects.trigger(eff, id, state_id, @level, @class_id, nil)
  307. end
  308. #--------------------------------------------------------------------------
  309. # * Remove State Effect Block Trigger
  310. #--------------------------------------------------------------------------
  311. def rems_effect(state_id)
  312. eff = [:state, :rem]
  313. Actor_Effects.trigger(eff, id, state_id, @level, @class_id, nil)
  314. end
  315. #--------------------------------------------------------------------------
  316. # * Knock Out Effect Block Trigger
  317. #--------------------------------------------------------------------------
  318. def die_effect
  319. eff = [:die]
  320. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  321. end
  322. #--------------------------------------------------------------------------
  323. # * Revive from Knock Out Effect Block Trigger
  324. #--------------------------------------------------------------------------
  325. def revi_effect
  326. eff = [:revive]
  327. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  328. end
  329. #--------------------------------------------------------------------------
  330. # * Escape Effect Block Trigger
  331. #--------------------------------------------------------------------------
  332. def escap_effect
  333. eff = [:escape]
  334. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  335. end
  336. #--------------------------------------------------------------------------
  337. # * Level Up Effect Block Trigger
  338. #--------------------------------------------------------------------------
  339. def lv_up_e_bllock
  340. eff = [:level, :up]
  341. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  342. end
  343. #--------------------------------------------------------------------------
  344. # * Level Down Effect Block Trigger
  345. #--------------------------------------------------------------------------
  346. def lv_down_e_bllock
  347. eff = [:level, :down]
  348. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  349. end
  350. #--------------------------------------------------------------------------
  351. # * Learn Skill Effect Block Trigger
  352. #--------------------------------------------------------------------------
  353. def learn_skilll_e_bllock(skill_id)
  354. eff = [:skill, :learn]
  355. Actor_Effects.trigger(eff, id, nil, @level, @class_id, skill_id)
  356. end
  357. #--------------------------------------------------------------------------
  358. # * Learn Skill Effect Block Trigger
  359. #--------------------------------------------------------------------------
  360. def forget_skilll_e_bllock(skill_id)
  361. eff = [:skill, :forget]
  362. Actor_Effects.trigger(eff, id, nil, @level, @class_id, skill_id)
  363. end
  364. #--------------------------------------------------------------------------
  365. # * Change Class Effect Block Trigger
  366. #--------------------------------------------------------------------------
  367. def change_class_e_bllock
  368. eff = [:change_class]
  369. Actor_Effects.trigger(eff, id, nil, @level, @class_id, skill_id)
  370. end
  371.  
  372. end
  373.  
  374. #==============================================================================#
  375. # - SCRIPT END - #
  376. #==============================================================================#
  377. # http://dekitarpg.wordpress.com/ #
  378. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement