Advertisement
Dekita

Actor Control

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