Advertisement
Dekita

actor effz 1.1

Mar 8th, 2013
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.82 KB | None | 0 0
  1. =begin =========================================================================
  2. ┌───────────────┐ v 1.1
  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. o7/o2/2o13 - changed import method,
  60. 13/o2/2o13 - Started, Finished,
  61.  
  62. ================================================================================
  63. INSTRUCTIONS:
  64. ==============
  65. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  66. Place this script UNDER my "Effect Blocks" script.
  67.  
  68. =end #=========================================================================#
  69. module Actor_Effects
  70.  
  71. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. def self.trigger(block,actor_id,state_id,level,class_id,skill_id)
  73. return if block == nil ; effect = nil ; case block[0]# DONT DELETE
  74. # Note, arguements are only passed if they are available at the time of
  75. # being triggered.
  76. # state_id is only passed when a state is added/removed
  77. # skill_id is only passed when a skill is learned/forgot
  78. # all other args* are passed regardless(as they are variables/methods too).
  79. # you can simply make effect = nil to have no effect
  80. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  81. # This is where you adjust the effects that happen when states are added
  82. # and removed.
  83. #---------------------------------------------------------------------------
  84. when :state
  85. case block[1]
  86. when :add
  87. effect = [:variable, 1, :add, 1] if actor_id == 1 && state_id == 5
  88. effect = [:variable, 2, :add, 1] if actor_id == 2
  89. effect = [:variable, 3, :add, 1] if actor_id == 3
  90. effect = [:variable, 4, :add, 1] if actor_id == 4
  91. when :rem
  92. effect = [:variable, 5, :add, 1] if actor_id == 1
  93. effect = [:variable, 6, :add, 1] if actor_id == 2
  94. effect = [:variable, 7, :add, 1] if actor_id == 3
  95. effect = [:variable, 8, :add, 1] if actor_id == 4
  96. end
  97. #---------------------------------------------------------------------------
  98. # This is where you adjust the effects that happen when an actor dies
  99. #---------------------------------------------------------------------------
  100. when :die
  101. effect = [:variable, 9 , :add, 1] if actor_id == 1
  102. effect = [:variable, 10, :add, 1] if actor_id == 2
  103. effect = [:variable, 11, :add, 1] if actor_id == 3
  104. effect = [:variable, 12, :add, 1] if actor_id == 4
  105. #---------------------------------------------------------------------------
  106. # This is where you adjust the effects that happen when an actor is revived
  107. #---------------------------------------------------------------------------
  108. when :revive
  109. effect = [:variable, 13, :add, 1] if actor_id == 1
  110. effect = [:variable, 14, :add, 1] if actor_id == 2
  111. effect = [:variable, 15, :add, 1] if actor_id == 3
  112. effect = [:variable, 16, :add, 1] if actor_id == 4
  113. #---------------------------------------------------------------------------
  114. # This is where you adjust the effects that happen when an actor escapes
  115. #---------------------------------------------------------------------------
  116. when :escape
  117. effect = [:variable, 17, :add, 1] if actor_id == 1
  118. effect = [:variable, 18, :add, 1] if actor_id == 2
  119. effect = [:variable, 19, :add, 1] if actor_id == 3
  120. effect = [:variable, 20, :add, 1] if actor_id == 4
  121. #---------------------------------------------------------------------------
  122. # This is where you adjust the effects that happen when an actor levels
  123. # up and down .
  124. #---------------------------------------------------------------------------
  125. when :level
  126. case block[1]
  127. when :up
  128. effect = [:variable, 21, :add, 1] if actor_id == 1
  129. effect = [:variable, 22, :add, 1] if actor_id == 2
  130. effect = [:variable, 23, :add, 1] if actor_id == 3
  131. effect = [:variable, 24, :add, 1] if actor_id == 4
  132. when :down
  133. # by removing this code it will make effect = nil
  134. end
  135. #---------------------------------------------------------------------------
  136. # This is where you adjust the effects that happen when an actor learns
  137. # and forgets skills
  138. #---------------------------------------------------------------------------
  139. when :skill
  140. case block[1]
  141. when :learn
  142. effect = [:variable, 29, :add, 1] if actor_id == 1
  143. effect = [:variable, 30, :add, 1] if actor_id == 2
  144. effect = [:variable, 31, :add, 1] if actor_id == 3
  145. effect = [:variable, 32, :add, 1] if actor_id == 4
  146. when :forget
  147. effect = [:variable, 33, :add, 1] if actor_id == 1
  148. effect = [:variable, 34, :add, 1] if actor_id == 2
  149. effect = [:variable, 35, :add, 1] if actor_id == 3
  150. effect = [:variable, 36, :add, 1] if actor_id == 4
  151. end
  152. #---------------------------------------------------------------------------
  153. # This is where you adjust the effects that happen when an actor changes
  154. # to a new class
  155. #---------------------------------------------------------------------------
  156. when :change_class
  157. # by removing this code it will make effect = nil
  158. #---------------------------------------------------------------------------
  159. # If you want to make custom effects you can do so in the Effect Blocks
  160. # script, if you have sufficient coding knowladge..
  161. end #-----------------------------------------------------------------------
  162. #---------------------------------------------------------------------------
  163. # This is where the script triggers the effect you defined
  164. # (unless effect = nil), you can use this to your advantage if you want
  165. # to use advanced coding.
  166. #---------------------------------------------------------------------------
  167. Effect_Blocks.trigger(effect)
  168. end
  169.  
  170. #####################
  171. # CUSTOMISATION END #
  172. end # end module #####################
  173. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  174. # #
  175. # http://dekitarpg.wordpress.com/ #
  176. # #
  177. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  178. #===============================================================================#
  179. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  180. # YES?\.\. #
  181. # OMG, REALLY? \| #
  182. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  183. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  184. #===============================================================================#
  185.  
  186. $imported = {} if $imported.nil?
  187. $imported[:Effect_Blocks] = {} if $imported[:Effect_Blocks].nil?
  188. $imported[:Effect_Blocks]['Actor_Basics'] = true
  189.  
  190.  
  191. #==============================================================================
  192. class Game_Battler < Game_BattlerBase
  193. #==============================================================================
  194. #--------------------------------------------------------------------------
  195. # * Alias List
  196. #--------------------------------------------------------------------------
  197. alias :ans_eff_block_GB :add_new_state
  198. alias :rms_eff_block_GB :remove_state
  199. alias :die_eff_block_GB :die
  200. alias :rev_eff_block_GB :revive
  201. alias :esc_eff_block_GB :escape
  202. alias :addbuff_eff_block_GB :add_buff
  203. alias :add_dbuff_eff_block_GB :add_debuff
  204. #--------------------------------------------------------------------------
  205. # * Add New State
  206. #--------------------------------------------------------------------------
  207. def add_new_state(state_id)
  208. ans_eff_block_GB(state_id)
  209. ans_effect(state_id)
  210. end
  211. #--------------------------------------------------------------------------
  212. # * Remove State
  213. #--------------------------------------------------------------------------
  214. def remove_state(state_id)
  215. rms_eff_block_GB(state_id)
  216. rems_effect(state_id) if state?(state_id)
  217. end
  218. #--------------------------------------------------------------------------
  219. # * Knock Out
  220. #--------------------------------------------------------------------------
  221. def die
  222. die_eff_block_GB
  223. die_effect
  224. end
  225. #--------------------------------------------------------------------------
  226. # * Revive from Knock Out
  227. #--------------------------------------------------------------------------
  228. def revive
  229. rev_eff_block_GB
  230. revi_effect
  231. end
  232. #--------------------------------------------------------------------------
  233. # * Escape
  234. #--------------------------------------------------------------------------
  235. def escape
  236. esc_eff_block_GB
  237. escap_effect
  238. end
  239. #--------------------------------------------------------------------------
  240. # * New Methods created for use in child class, ie Game_Actor
  241. #--------------------------------------------------------------------------
  242. def ans_effect(state_id)
  243. end
  244. def rems_effect(state_id)
  245. end
  246. def die_effect
  247. end
  248. def revi_effect
  249. end
  250. def escap_effect
  251. end
  252.  
  253. end
  254.  
  255. #==============================================================================
  256. class Game_Actor < Game_Battler
  257. #==============================================================================
  258. #--------------------------------------------------------------------------
  259. # * Alias List
  260. #--------------------------------------------------------------------------
  261. alias :lvup_eff_block_GA :level_up
  262. alias :lvdown_eff_block_GA :level_down
  263. alias :lskill_eff_block_GA :learn_skill
  264. alias :fskil_eff_block_GA :forget_skill
  265. alias :cclas_eff_block_GA :change_class
  266. #--------------------------------------------------------------------------
  267. # * Level Up
  268. #--------------------------------------------------------------------------
  269. def level_up
  270. lvup_eff_block_GA
  271. lv_up_e_bllock
  272. end
  273. #--------------------------------------------------------------------------
  274. # * Level Down
  275. #--------------------------------------------------------------------------
  276. def level_down
  277. lvdown_eff_block_GA
  278. lv_down_e_bllock
  279. end
  280. #--------------------------------------------------------------------------
  281. # * Learn Skill
  282. #--------------------------------------------------------------------------
  283. def learn_skill(skill_id)
  284. lskill_eff_block_GA(skill_id)
  285. unless skill_learn?($data_skills[skill_id])
  286. learn_skilll_e_bllock(skill_id)
  287. end
  288. end
  289. #--------------------------------------------------------------------------
  290. # * Forget Skill
  291. #--------------------------------------------------------------------------
  292. def forget_skill(skill_id)
  293. fskil_eff_block_GA(skill_id)
  294. forget_skilll_e_bllock(skill_id)
  295. end
  296. #--------------------------------------------------------------------------
  297. # * Change Class
  298. # keep_exp: Keep EXP
  299. #--------------------------------------------------------------------------
  300. def change_class(class_id, keep_exp = false)
  301. cclas_eff_block_GA(class_id, keep_exp = false)
  302. change_class_e_bllock
  303. end
  304. #--------------------------------------------------------------------------
  305. # * Add New State Effect Block Trigger
  306. #--------------------------------------------------------------------------
  307. def ans_effect(state_id)
  308. eff = [:state, :add]
  309. Actor_Effects.trigger(eff, id, state_id, @level, @class_id, nil)
  310. end
  311. #--------------------------------------------------------------------------
  312. # * Remove State Effect Block Trigger
  313. #--------------------------------------------------------------------------
  314. def rems_effect(state_id)
  315. eff = [:state, :rem]
  316. Actor_Effects.trigger(eff, id, state_id, @level, @class_id, nil)
  317. end
  318. #--------------------------------------------------------------------------
  319. # * Knock Out Effect Block Trigger
  320. #--------------------------------------------------------------------------
  321. def die_effect
  322. eff = [:die]
  323. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  324. end
  325. #--------------------------------------------------------------------------
  326. # * Revive from Knock Out Effect Block Trigger
  327. #--------------------------------------------------------------------------
  328. def revi_effect
  329. eff = [:revive]
  330. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  331. end
  332. #--------------------------------------------------------------------------
  333. # * Escape Effect Block Trigger
  334. #--------------------------------------------------------------------------
  335. def escap_effect
  336. eff = [:escape]
  337. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  338. end
  339. #--------------------------------------------------------------------------
  340. # * Level Up Effect Block Trigger
  341. #--------------------------------------------------------------------------
  342. def lv_up_e_bllock
  343. eff = [:level, :up]
  344. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  345. end
  346. #--------------------------------------------------------------------------
  347. # * Level Down Effect Block Trigger
  348. #--------------------------------------------------------------------------
  349. def lv_down_e_bllock
  350. eff = [:level, :down]
  351. Actor_Effects.trigger(eff, id, nil, @level, @class_id, nil)
  352. end
  353. #--------------------------------------------------------------------------
  354. # * Learn Skill Effect Block Trigger
  355. #--------------------------------------------------------------------------
  356. def learn_skilll_e_bllock(skill_id)
  357. eff = [:skill, :learn]
  358. Actor_Effects.trigger(eff, id, nil, @level, @class_id, skill_id)
  359. end
  360. #--------------------------------------------------------------------------
  361. # * Learn Skill Effect Block Trigger
  362. #--------------------------------------------------------------------------
  363. def forget_skilll_e_bllock(skill_id)
  364. eff = [:skill, :forget]
  365. Actor_Effects.trigger(eff, id, nil, @level, @class_id, skill_id)
  366. end
  367. #--------------------------------------------------------------------------
  368. # * Change Class Effect Block Trigger
  369. #--------------------------------------------------------------------------
  370. def change_class_e_bllock
  371. eff = [:change_class]
  372. Actor_Effects.trigger(eff, id, nil, @level, @class_id, skill_id)
  373. end
  374.  
  375. end
  376.  
  377. #==============================================================================#
  378. # - SCRIPT END - #
  379. #==============================================================================#
  380. # http://dekitarpg.wordpress.com/ #
  381. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement