Dekita

Untitled

Apr 21st, 2014
558
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Badges (achievements)
  5. # -- Author : Dekita
  6. # -- Version : 1.2
  7. # -- Level : Easy / Normal
  8. # -- Requires : $D13x Core v2.7+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Badges]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 21/o4/2o14 - Bugfixx, (another typo)
  21. # 19/o4/2o14 - Bugfixx, (typo caused error with restricted skills items etc..)
  22. # 17/o4/2o14 - Finished,
  23. # 15/o4/2o14 - Started
  24. #
  25. #===============================================================================
  26. # ☆ Introduction
  27. #-------------------------------------------------------------------------------
  28. # This script was inspired by Pokemons 'Badges' system. Cause I could, I made
  29. # a script to recreate it (this script) and when I had done that, I made it a
  30. # MUCH more powerful feature...
  31. #
  32. # Obviously, the standard pokemon badge system is a widely known feature;
  33. # however, for those that do not know this system - a badge is basically an
  34. # achievement that is gained throughout the course of gameplay.
  35. #
  36. # Badges are not only for showing off, they can also be used to control various
  37. # aspects of your game... Dramatically...
  38. #
  39. # In pokemon, you would not be able to use certain HM's (items) if you did not
  40. # have [x] badge. Therefore, I have included the ability to restrict item usage
  41. # when certain badges have not yet been obtained.
  42. # You can also restrict skills being used and weapons/armor from being equipped.
  43. # This restriction is automatic and you must gain the badge before it is lifted.
  44. #
  45. # Obviously, being able to use an item/skill/weapon or armor after gaining a
  46. # badge is great, but what if you want a badge to toggle a switch, modify a
  47. # variable, give gold / items / weapons / armor or maybe even run a custom
  48. # script call... Well... It can!
  49. #
  50. # Another feature within the pokemon badge system, in earlier generations, was
  51. # that your pokemons stats would increase if you owned [x] badge.
  52. # This could be done by doing a simple script call to increase each
  53. # party members stats; maybe something along the lines of
  54. # "$game_party.members.each {|m| m.add_param(id) }"
  55. # - Alternatively, you can have stats increase and learn skills for all members.
  56. # eg. badge 1 gives 50mhp, when badge one has been earned, all party members will
  57. # always gain 50mhp. Regardless of when they joined the party.
  58. #
  59. # Use simple script calls to gain badges and unlock the rewards.
  60. # But wait, what if you dont want to use script calls to gain badges? Well...
  61. # You dont have to...
  62. # Depending on the badge's settings, you can enable it to track a certain
  63. # object (such as a variable/switch/your own code) and once the 'gain badge'
  64. # condition has been met the achievment will automatically unlock.
  65. #
  66. # Couple this with some of my other scripts - such as Actor Effect Blocks/
  67. # Gold Tracker/ Items Tracker and you can enable badges to unlock when the player
  68. # has performed certain actions throught gameplay, such as; winning fights,
  69. # fleeing battle, dying, leveling, after party has earned / spent [x] amount of
  70. # gold or even when party has used [x] amount of [x] item.
  71. #
  72. # Arent I a clever fucker ^_^
  73. #
  74. #===============================================================================
  75. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  76. #===============================================================================
  77. # 1. You MUST give credit to "Dekita" !!
  78. # 2. You are NOT allowed to repost this script.(or modified versions)
  79. # 3. You are NOT allowed to convert this script.
  80. # 4. You are NOT allowed to use this script for Commercial games.
  81. # 5. ENJOY!
  82. #
  83. # "FINE PRINT"
  84. # By using this script you hereby agree to the above terms and conditions,
  85. # if any violation of the above terms occurs "legal action" may be taken.
  86. # Not understanding the above terms and conditions does NOT mean that
  87. # they do not apply to you.
  88. # If you wish to discuss the terms and conditions in further detail you can
  89. # contact me at http://dekitarpg.wordpress.com/
  90. #
  91. #===============================================================================
  92. # ☆ Instructions
  93. #-------------------------------------------------------------------------------
  94. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  95. #
  96. #===============================================================================
  97. # ☆ Script Calls
  98. #-------------------------------------------------------------------------------
  99. # SceneManager.call(Scene_Achievement)
  100. # Use to call the scene.
  101. #
  102. #-------------------------------------------------------------------------------
  103. # $game_player.gain_achii(Badge_ID)
  104. # Unlocks Badge ID.
  105. #
  106. #-------------------------------------------------------------------------------
  107. # $game_player.achiiz.progress
  108. # Returns a value equal to the amount of badges player has unlocked.
  109. #
  110. #-------------------------------------------------------------------------------
  111. # $game_player.achiiz.completed
  112. # Returns true / false depending on whether all badges have been unlocked.
  113. #
  114. #-------------------------------------------------------------------------------
  115. # -- NOTICE --
  116. # I recommend to only use the following script calls if you REALLY know what
  117. # you are doing, otherwise you could cause errors.
  118. #
  119. #-------------------------------------------------------------------------------
  120. # $game_player.achiiz.last_gained
  121. # Returns the last gained badge object.
  122. #
  123. #-------------------------------------------------------------------------------
  124. # $game_player.achiiz.item_restrictions
  125. # Returns an array containing restricted item id's
  126. #
  127. #-------------------------------------------------------------------------------
  128. # $game_player.achiiz.skill_restrictions
  129. # Returns an array containing restricted skill id's
  130. #
  131. #-------------------------------------------------------------------------------
  132. # $game_player.achiiz.weapon_restrictions
  133. # Returns an array containing restricted weapon id's
  134. #
  135. #-------------------------------------------------------------------------------
  136. # $game_player.achiiz.armor_restrictions
  137. # Returns an array containing restricted armor id's
  138. #
  139. #-------------------------------------------------------------------------------
  140. # $game_player.achiiz.unlock(id)
  141. # $game_player.achiiz.lock(id)
  142. # unlocks/lock an achievement accordingly.
  143. # Safer to use gain_achii script calls outwith of other scripts - ie on the map.
  144. #
  145. #===============================================================================
  146. # ☆ Notetags ( default )
  147. #-------------------------------------------------------------------------------
  148. # N/A
  149. #
  150. #===============================================================================
  151. # ☆ HELP
  152. #-------------------------------------------------------------------------------
  153. # N/A
  154. #
  155. #===============================================================================
  156. module Achievement ; Badge=[] # << DO NOT DELETE !!
  157. #===============================================================================
  158. #-----------------------------------------------------------------------------
  159. # Basic Vocab
  160. #-----------------------------------------------------------------------------
  161. Vocab={
  162. :comA => 'View Badges',
  163. :comB => 'Exit Scene',
  164. :prog => 'Progress:',
  165. :last => 'Last gained:',
  166. } # << Vocab
  167. #-----------------------------------------------------------------------------
  168. # Show on menu
  169. #-----------------------------------------------------------------------------
  170. Menu_Access = true
  171. #-----------------------------------------------------------------------------
  172. # (not seen in achievement screen)
  173. # = ['Name' , icon, hue, Text Color::Color]
  174. #-----------------------------------------------------------------------------
  175. Vocanicon = ["Badges", 0, 0, Text_Color::White]
  176. #-----------------------------------------------------------------------------
  177. # Sets last gained information. See F1 -> Index -> Time for more information.
  178. #-----------------------------------------------------------------------------
  179. def self.gained_on
  180. hour = Time.now.strftime("%I")
  181. minu = Time.now.strftime("%M")
  182. ampm = Time.now.strftime("%p")
  183. date = Time.now.strftime("%d")
  184. mont = Time.now.strftime("%B")
  185. year = Time.now.strftime("%Y")
  186. return "#{hour}:#{minu}#{ampm} on #{date} #{mont} #{year}"
  187. end
  188. #-----------------------------------------------------------------------------
  189. # Badge[ id ] = { #<- Begins Badge[ id ] Hash
  190. # :name => "The name of the badge",
  191. # :icon => icon index,
  192. # :ihue => icon hue,
  193. # :text => "Text shown in help window. \n gets a new line",
  194. # :mods => [ Array of effects triggered when badge unlocks ],
  195. # # Consult My $D13x Core script for info on effect blocks.
  196. # :cond => [ Array of conditions before badge can be gained ],
  197. # :rest => [ Array of restrictions caused when badge is not owned ],
  198. # } #-< Ends Badge[ id ] Hash
  199. #-----------------------------------------------------------------------------
  200. # ★ Possible :mods ;
  201. # [:common, id],
  202. # [:switch, id, true], <| Switches are pointless to use as you can
  203. # [:switch, id, false], <| use script calls to check if a badge has
  204. # [:switch, id, :alternate], <| been earned or not. But the option is there...
  205. # [:variable, id, :set, value],
  206. # [:variable, id, :add, value],
  207. # [:variable, id, :sub, value],
  208. # [:variable, id, :div, value],
  209. # [:variable, id, :mul, value],
  210. # [:variable, id, :mod, value],
  211. # [:gold, :gain, value],
  212. # [:gold, :lose, value],
  213. # [:item, id, amount, include equip(bool)],
  214. # [:weapon, id, amount, include equip(bool)],
  215. # [:armor, id, amount, include equip(bool)],
  216. # [:script, "code to evaluate"],
  217. #-----------------------------------------------------------------------------
  218. # ★ Possible :cond ;
  219. # [:variable, id, value],
  220. # [:switch, id],
  221. # [:script, "code to evaluate"],
  222. #-----------------------------------------------------------------------------
  223. # ★ Possible :rest ;
  224. # [:skill, id],
  225. # [:items, id],
  226. # [:weap, id],
  227. # [:armr, id],
  228. #-----------------------------------------------------------------------------
  229. # ★ Possible :stat ;
  230. # [:param , id, value],
  231. # [:x_param , id, value],
  232. # [:s_param , id, value],
  233. # [:atk_ele , id, value],
  234. # [:def_ele , id, value],
  235. # [:spds_stat , id, value]
  236. # [:atk_lvl , value],
  237. # [:def_lvl , value],
  238. # [:max_tp , value],
  239. # [:skill, id],
  240. #-----------------------------------------------------------------------------
  241. Badge[0] = {
  242. :name => 'Boulder',
  243. :icon => 864,
  244. :ihue => 0,
  245. :text => "Gained from Brock of Pewter City."+
  246. "\nEffects: Stat[atk] && HM[flash].",
  247. :mods => [
  248. [:gold, :gain, 100]
  249. ],#<< :mods
  250. :cond => [],
  251. :rest => [],
  252. :stat => [
  253. [:param , 0, 10],
  254. [:param , 1, 10],
  255. [:atk_lvl , 1],
  256. ],# <- :stat
  257. } # << Badge[0]
  258. #-----------------------------------------------------------------------------
  259. Badge[1] = {
  260. :name => 'Cascade',
  261. :icon => 865,
  262. :ihue => 0,
  263. :text => "Gained from Misty of Cerulean City."+
  264. "\nEffects: Stat[N/A] && HM[cut].",
  265. :mods => [
  266. [:gold, :gain, 100]
  267. ],#<< :mods
  268. :cond => [],
  269. :rest => [],
  270. :stat => [
  271. [:param , 2, 10],
  272. [:param , 3, 10],
  273. [:def_lvl , 1],
  274. ],# <- :stat
  275. } # << Badge[1]
  276. #-----------------------------------------------------------------------------
  277. Badge[2] = {
  278. :name => 'Thunder',
  279. :icon => 866,
  280. :ihue => 0,
  281. :text => "Gained from Lt. Surge of Vermilion City."+
  282. "\nEffects: Stat[speed] && HM[fly].",
  283. :mods => [
  284. [:gold, :gain, 100]
  285. ],#<< :mods
  286. :cond => [],
  287. :rest => [],
  288. :stat => [],
  289. } # << Badge[2]
  290. #-----------------------------------------------------------------------------
  291. Badge[3] = {
  292. :name => 'Rainbow',
  293. :icon => 867,
  294. :ihue => 0,
  295. :text => "Gained from Erika of Celadon City."+
  296. "\nEffects: Stat[N/A] && HM[stength].",
  297. :mods => [
  298. [:gold, :gain, 100]
  299. ],#<< :mods
  300. :cond => [],
  301. :rest => [],
  302. :stat => [],
  303. } # << Badge[3]
  304. #-----------------------------------------------------------------------------
  305. Badge[4] = {
  306. :name => 'Soul',
  307. :icon => 868,
  308. :ihue => 0,
  309. :text => "Gained from Koga of Fuchsia City."+
  310. "\nEffects: Stat[def] && HM[surf].",
  311. :mods => [
  312. [:gold, :gain, 100]
  313. ],#<< :mods
  314. :cond => [],
  315. :rest => [],
  316. :stat => [],
  317. } # << Badge[4]
  318. #-----------------------------------------------------------------------------
  319. Badge[5] = {
  320. :name => 'Marsh',
  321. :icon => 869,
  322. :ihue => 0,
  323. :text => "Gained from Sabrina of Saffron City."+
  324. "\nEffects: Stat[N/A] && HM[rock smash].",
  325. :mods => [
  326. [:gold, :gain, 100]
  327. ],#<< :mods
  328. :cond => [],
  329. :rest => [],
  330. :stat => [],
  331. } # << Badge[5]
  332. #-----------------------------------------------------------------------------
  333. Badge[6] = {
  334. :name => 'Volcano',
  335. :icon => 870,
  336. :ihue => 0,
  337. :text => "Gained from Blane of Cinnabar Island."+
  338. "\nEffects: Stat[sp atk & sp def] && HM[waterfall].",
  339. :mods => [
  340. [:gold, :gain, 100]
  341. ],#<< :mods
  342. :cond => [],
  343. :rest => [],
  344. :stat => [],
  345. } # << Badge[6]
  346. #-----------------------------------------------------------------------------
  347. Badge[7] = {
  348. :name => 'Earth',
  349. :icon => 871,
  350. :ihue => 0,
  351. :text => "Gained from Giovanni of Viridian City."+
  352. "\nEffects: Stat[N/A] && HM[rock climb].",
  353. :mods => [
  354. [:gold, :gain, 100]
  355. ],#<< :mods
  356. :cond => [],
  357. :rest => [],
  358. :stat => [],
  359. } # << Badge[7]
  360. #-----------------------------------------------------------------------------
  361.  
  362. #-----------------------------------------------------------------------------
  363. # << Add more Badge[ id ] here. Follow the format from above.
  364. #-----------------------------------------------------------------------------
  365.  
  366. #####################
  367. # CUSTOMISATION END #
  368. end #####################
  369. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  370. # #
  371. # http://dekitarpg.wordpress.com/ #
  372. # #
  373. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  374. #===============================================================================#
  375. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  376. # YES?\.\. #
  377. # OMG, REALLY? \| #
  378. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  379. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  380. #===============================================================================#
  381. class Achii_BADGE
  382. #===============================================================================
  383. #-----------------------------------------------------------------------------
  384. #
  385. #-----------------------------------------------------------------------------
  386. include Achievement
  387. #-----------------------------------------------------------------------------
  388. #
  389. #-----------------------------------------------------------------------------
  390. attr_accessor :id
  391. attr_accessor :name
  392. attr_accessor :icon
  393. attr_accessor :ihue
  394. attr_accessor :text
  395. attr_accessor :mods
  396. attr_accessor :cond
  397. attr_accessor :rest
  398. attr_accessor :stats
  399. attr_accessor :locked
  400. attr_accessor :date_gained
  401. #-----------------------------------------------------------------------------
  402. #
  403. #-----------------------------------------------------------------------------
  404. def initialize(index)
  405. init_main index
  406. init_addi
  407. end
  408. #-----------------------------------------------------------------------------
  409. #
  410. #-----------------------------------------------------------------------------
  411. def init_main(i)
  412. @id = i
  413. @name = Badge[i][:name]
  414. @icon = Badge[i][:icon]
  415. @ihue = Badge[i][:ihue]
  416. @text = Badge[i][:text]
  417. @mods = Badge[i][:mods]
  418. @cond = Badge[i][:cond]
  419. @rest = Badge[i][:rest]
  420. @stats = Badge[i][:stat]
  421. end
  422. #-----------------------------------------------------------------------------
  423. #
  424. #-----------------------------------------------------------------------------
  425. def init_addi
  426. @locked = true
  427. @date_gained = ""
  428. end
  429. #-----------------------------------------------------------------------------
  430. #
  431. #-----------------------------------------------------------------------------
  432. def do_unlock
  433. @locked = false
  434. end
  435. #-----------------------------------------------------------------------------
  436. #
  437. #-----------------------------------------------------------------------------
  438. def do_lock
  439. @locked = true
  440. end
  441. #-----------------------------------------------------------------------------
  442. #
  443. #-----------------------------------------------------------------------------
  444. def do_unlock_mods
  445. @mods.each do |block|
  446. Effect_Blocks.trigger(block)
  447. end
  448. @date_gained = Achievement.gained_on
  449. end
  450. end
  451. #===============================================================================
  452. class Achiiz
  453. #===============================================================================
  454. #-----------------------------------------------------------------------------
  455. #
  456. #-----------------------------------------------------------------------------
  457. include Achievement
  458. #-----------------------------------------------------------------------------
  459. #
  460. #-----------------------------------------------------------------------------
  461. attr_accessor :badges
  462. attr_accessor :unlocked
  463. attr_accessor :last_gained
  464. attr_accessor :sndlast_gained
  465. attr_accessor :skill_rest
  466. attr_accessor :items_rest
  467. attr_accessor :weap_rest
  468. attr_accessor :armr_rest
  469. attr_accessor :param
  470. attr_accessor :xparam
  471. attr_accessor :sparam
  472. attr_accessor :atk_ele
  473. attr_accessor :def_ele
  474. attr_accessor :atl_dfl
  475. attr_accessor :spds_stats
  476. attr_accessor :max_tp
  477. attr_accessor :skills
  478. #-----------------------------------------------------------------------------
  479. #
  480. #-----------------------------------------------------------------------------
  481. def initialize
  482. @badges = []
  483. @unlocked = [false] * Badge.size
  484. @last_gained = nil
  485. @sndlast_gained = nil
  486. Badge.size.times { |id| @badges << Achii_BADGE.new(id) }
  487. reset_rest
  488. reset_statz
  489. end
  490. #-----------------------------------------------------------------------------
  491. #
  492. #-----------------------------------------------------------------------------
  493. def reset_rest
  494. @skill_rest = []
  495. @items_rest = []
  496. @weap_rest = []
  497. @armr_rest = []
  498. @badges.each do |b|
  499. next unless b.locked
  500. b.rest.each do |r|
  501. next unless r
  502. case r[0]
  503. when :skill then @skill_rest << r[1]
  504. when :items then @items_rest << r[1]
  505. when :weap then @weap_rest << r[1]
  506. when :armr then @armr_rest << r[1]
  507. end
  508. end
  509. end
  510. end
  511. #-----------------------------------------------------------------------------
  512. #
  513. #-----------------------------------------------------------------------------
  514. def reset_statz
  515. @param = [0] * 8
  516. @xparam = [0] * 10
  517. @sparam = [0] * 10
  518. @atk_ele = [0] * $data_system.elements.size
  519. @def_ele = [0] * $data_system.elements.size
  520. @atl_dfl = [0] * 2
  521. @spds_stats = [0] * 8
  522. @spds_stats = [0] * SPDS::Commands.size if $D13x[:ISPDS]
  523. @max_tp = 0
  524. @skills = []
  525. calc_stat_mods
  526. end
  527. #-----------------------------------------------------------------------------
  528. #
  529. #-----------------------------------------------------------------------------
  530. def calc_stat_mods
  531. @badges.each do |b|
  532. next if b.locked
  533. b.stats.each do |s|
  534. next unless s
  535. case s[0]
  536. when :param then @param [s[1]] += s[2] if $D13x[:Stats_Control]
  537. when :x_param then @xparam [s[1]] += s[2] if $D13x[:Stats_Control]
  538. when :s_param then @sparam [s[1]] += s[2] if $D13x[:Stats_Control]
  539. when :atk_ele then @atk_ele[s[1]] += s[2] if $D13x[:Elems_Control]
  540. when :def_ele then @def_ele[s[1]] += s[2] if $D13x[:Elems_Control]
  541. when :atk_lvl then @atl_dfl[0] += s[1] if $D13x[:Atk_Def_Lvs]
  542. when :def_lvl then @atl_dfl[1] += s[1] if $D13x[:Atk_Def_Lvs]
  543. when :spds_stat then @spds_stats[s[1]] += s[2] if $D13x[:ISPDS]
  544. when :max_tp then @max_tp += s[1] if $D13x[:TP_Control]
  545. when :skill then @skills << s[1]
  546. end
  547. end
  548. end
  549. end
  550. #-----------------------------------------------------------------------------
  551. #
  552. #-----------------------------------------------------------------------------
  553. def unlock(id)
  554. @badges[id].do_unlock
  555. @badges[id].do_unlock_mods unless @unlocked[id]
  556. @unlocked[id] = true
  557. @sndlast_gained = @last_gained
  558. @last_gained = @badges[id]
  559. reset_rest
  560. reset_statz
  561. end
  562. #-----------------------------------------------------------------------------
  563. #
  564. #-----------------------------------------------------------------------------
  565. def lock(id)
  566. @badges[id].do_unlock
  567. end
  568. #-----------------------------------------------------------------------------
  569. #
  570. #-----------------------------------------------------------------------------
  571. def has_badge?(id)
  572. @badges[id].locked
  573. end
  574. #-----------------------------------------------------------------------------
  575. #
  576. #-----------------------------------------------------------------------------
  577. def progress
  578. unlocked = 0
  579. @unlocked.each { |i| unlocked += 1 if i}
  580. unlocked
  581. end
  582. #-----------------------------------------------------------------------------
  583. #
  584. #-----------------------------------------------------------------------------
  585. def completed
  586. @unlocked.all?
  587. end
  588. #-----------------------------------------------------------------------------
  589. #
  590. #-----------------------------------------------------------------------------
  591. def check_auto_unlock
  592. return if completed
  593. @badges.each do |b|
  594. next unless b.locked
  595. b.cond.each do |c|
  596. next unless c
  597. case c[0]
  598. when :variable then next unless $game_variables[c[1]] >= c[2]
  599. when :switch then next unless $game_switches[c[1]]
  600. when :script then next unless (eval(c[1]) rescue caul_fail(b.id,c[1]))
  601. end
  602. unlock(b.id)
  603. end
  604. end
  605. end
  606. #-----------------------------------------------------------------------------
  607. #
  608. #-----------------------------------------------------------------------------
  609. def caul_fail(id,code)
  610. line_1 = "The achievement activation script code failed for badge[#{id}]."
  611. line_2 = "\nCode in question is;\n"
  612. msgbox(line_1+line_2+code)
  613. return false
  614. end
  615. #-----------------------------------------------------------------------------
  616. #
  617. #-----------------------------------------------------------------------------
  618. def skill_restrictions
  619. @skill_rest
  620. end
  621. #-----------------------------------------------------------------------------
  622. #
  623. #-----------------------------------------------------------------------------
  624. def item_restrictions
  625. @items_rest
  626. end
  627. #-----------------------------------------------------------------------------
  628. #
  629. #-----------------------------------------------------------------------------
  630. def weapon_restrictions
  631. @weap_rest
  632. end
  633. #-----------------------------------------------------------------------------
  634. #
  635. #-----------------------------------------------------------------------------
  636. def armor_restrictions
  637. @armr_rest
  638. end
  639. end
  640. #===============================================================================
  641. module Badge_Stat_Mods
  642. #===============================================================================
  643. #-----------------------------------------------------------------------------
  644. #
  645. #-----------------------------------------------------------------------------
  646. def parp_badge_stat(id)
  647. $game_player.achiiz.param[id]
  648. end
  649. #-----------------------------------------------------------------------------
  650. #
  651. #-----------------------------------------------------------------------------
  652. def xpar_badge_stat(id)
  653. $game_player.achiiz.xparam[id]
  654. end
  655. #-----------------------------------------------------------------------------
  656. #
  657. #-----------------------------------------------------------------------------
  658. def spar_badge_stat(id)
  659. $game_player.achiiz.sparam[id]
  660. end
  661. #-----------------------------------------------------------------------------
  662. #
  663. #-----------------------------------------------------------------------------
  664. def def_ele_badge_stat(id)
  665. $game_player.achiiz.def_ele[id]
  666. end
  667. #-----------------------------------------------------------------------------
  668. #
  669. #-----------------------------------------------------------------------------
  670. def atk_ele_badge_stat(id)
  671. $game_player.achiiz.atk_ele[id]
  672. end
  673. #-----------------------------------------------------------------------------
  674. #
  675. #-----------------------------------------------------------------------------
  676. def atl_dfl_badge_stat(id)
  677. $game_player.achiiz.atl_dfl[id]
  678. end
  679. #-----------------------------------------------------------------------------
  680. #
  681. #-----------------------------------------------------------------------------
  682. def spds_badge_stat(id)
  683. $game_player.achiiz.spds_stats[id]
  684. end
  685. #-----------------------------------------------------------------------------
  686. #
  687. #-----------------------------------------------------------------------------
  688. def max_tp_badge_stat
  689. $game_player.achiiz.max_tp
  690. end
  691. #-----------------------------------------------------------------------------
  692. #
  693. #-----------------------------------------------------------------------------
  694. def badge_skills
  695. $game_player.achiiz.skills.sort.collect{|id| $data_skills[id]}
  696. end
  697. end
  698. #===============================================================================
  699. class Game_Actor < Game_Battler
  700. #===============================================================================
  701. #-----------------------------------------------------------------------------
  702. #
  703. #-----------------------------------------------------------------------------
  704. include Badge_Stat_Mods
  705. #-----------------------------------------------------------------------------
  706. #
  707. #-----------------------------------------------------------------------------
  708. alias :parp_badge :param_plus
  709. alias :xpar_badge :xparam_plus if $D13x[:Stats_Control]
  710. alias :spar_badge :sparam_plus if $D13x[:Stats_Control]
  711. alias :atke_badge :atk_ele_plus if $D13x[:Elems_Control]
  712. alias :defe_badge :def_ele_plus if $D13x[:Elems_Control]
  713. alias :atdf_badge :atl_dfl_plus if $D13x[:Atk_Def_Lvs]
  714. alias :spds_badge :spds_plus if $D13x[:ISPDS]
  715. alias :max_tp_badge :max_tp_plus if $D13x[:TP_Control]
  716. alias :skillbadge :skills
  717. #-----------------------------------------------------------------------------
  718. # Get Added Value of Parameter
  719. #-----------------------------------------------------------------------------
  720. def param_plus(param_id)
  721. parp_badge(param_id) + parp_badge_stat(param_id)
  722. end
  723. if $D13x[:Stats_Control]
  724. #---------------------------------------------------------------------------
  725. # Get Added Value of x-Parameter
  726. #---------------------------------------------------------------------------
  727. def xparam_plus(xparam_id)
  728. xpar_badge(xparam_id) + xpar_badge_stat(xparam_id)
  729. end
  730. #---------------------------------------------------------------------------
  731. # Get Added Value of s-Parameter
  732. #---------------------------------------------------------------------------
  733. def sparam_plus(sparam_id)
  734. spar_badge(sparam_id) + spar_badge_stat(sparam_id)
  735. end
  736. end # if $D13x[:Stats_Control]
  737. if $D13x[:Elems_Control]
  738. #---------------------------------------------------------------------------
  739. # Get Added Value of def-Element
  740. #---------------------------------------------------------------------------
  741. def def_ele_plus(element_id)
  742. defe_badge(element_id) + def_ele_badge_stat(element_id)
  743. end
  744. #---------------------------------------------------------------------------
  745. # Get Added Value of atk-Element
  746. #---------------------------------------------------------------------------
  747. def atk_ele_plus(element_id)
  748. atke_badge(element_id) + atk_ele_badge_stat(element_id)
  749. end
  750. end # if $D13x[:Elems_Control]
  751. if $D13x[:Atk_Def_Lvs]
  752. #---------------------------------------------------------------------------
  753. # Atk Lv | Def Lv ++
  754. #---------------------------------------------------------------------------
  755. def atl_dfl_plus(id)
  756. atdf_badge(id) + atl_dfl_badge_stat(id)
  757. end
  758. end # if $D13x[:Atk_Def_Lvs]
  759. if $D13x[:ISPDS]
  760. #---------------------------------------------------------------------------
  761. # Get SPDS Stats Plus
  762. #---------------------------------------------------------------------------
  763. def spds_plus(id)
  764. spds_badge(id) + spds_badge_stat(id)
  765. end
  766. end # if $D13x[:ISPDS]
  767. if $D13x[:TP_Control]
  768. #---------------------------------------------------------------------------
  769. # Atk Lv | Def Lv ++
  770. #---------------------------------------------------------------------------
  771. def max_tp_plus
  772. max_tp_badge + max_tp_badge_stat
  773. end
  774. end # if $D13x[:TP_Control]
  775. #-----------------------------------------------------------------------------
  776. #
  777. #-----------------------------------------------------------------------------
  778. def skills
  779. skillbadge + badge_skills
  780. end
  781. end
  782. #===============================================================================
  783. class Game_Player < Game_Character
  784. #===============================================================================
  785. #-----------------------------------------------------------------------------
  786. #
  787. #-----------------------------------------------------------------------------
  788. alias :init_achiiz :initialize
  789. alias :refr_achiiz :refresh
  790. #-----------------------------------------------------------------------------
  791. #
  792. #-----------------------------------------------------------------------------
  793. def initialize
  794. init_achiiz
  795. reset_achiiz
  796. end
  797. #-----------------------------------------------------------------------------
  798. #
  799. #-----------------------------------------------------------------------------
  800. def refresh
  801. refr_achiiz
  802. refresh_auto_unlock_badge
  803. end
  804. #-----------------------------------------------------------------------------
  805. #
  806. #-----------------------------------------------------------------------------
  807. def achiiz
  808. @achievements ||= Achiiz.new
  809. end
  810. #-----------------------------------------------------------------------------
  811. #
  812. #-----------------------------------------------------------------------------
  813. def reset_achiiz
  814. @achievements = nil
  815. @achievements = Achiiz.new
  816. end
  817. #-----------------------------------------------------------------------------
  818. #
  819. #-----------------------------------------------------------------------------
  820. def gain_achii(id)
  821. return unless @achievements
  822. @achievements.unlock id
  823. end
  824. #-----------------------------------------------------------------------------
  825. #
  826. #-----------------------------------------------------------------------------
  827. def achii_prog
  828. return 0 unless @achievements
  829. return @achievements.progress
  830. end
  831. #-----------------------------------------------------------------------------
  832. #
  833. #-----------------------------------------------------------------------------
  834. def refresh_auto_unlock_badge
  835. return unless @achievements
  836. @achievements.check_auto_unlock
  837. end
  838. end
  839. #===============================================================================
  840. class Window_ItemList < Window_Selectable
  841. #===============================================================================
  842. #-----------------------------------------------------------------------------
  843. #
  844. #-----------------------------------------------------------------------------
  845. alias :achii_enable? :enable?
  846. #-----------------------------------------------------------------------------
  847. #
  848. #-----------------------------------------------------------------------------
  849. def enable?(item)
  850. achii_enable?(item) && achi_enabled(item)
  851. end
  852. #-----------------------------------------------------------------------------
  853. #
  854. #-----------------------------------------------------------------------------
  855. def achi_enabled(item)
  856. return false unless item
  857. !$game_player.achiiz.item_restrictions.include?(item.id)
  858. end
  859. end
  860. #===============================================================================
  861. class Window_SkillList < Window_Selectable
  862. #===============================================================================
  863. #-----------------------------------------------------------------------------
  864. #
  865. #-----------------------------------------------------------------------------
  866. alias :achii_enable? :enable?
  867. #-----------------------------------------------------------------------------
  868. #
  869. #-----------------------------------------------------------------------------
  870. def enable?(item)
  871. achii_enable?(item) && achi_enabled(item)
  872. end
  873. #-----------------------------------------------------------------------------
  874. #
  875. #-----------------------------------------------------------------------------
  876. def achi_enabled(item)
  877. return false unless item
  878. !$game_player.achiiz.skill_restrictions.include?(item.id)
  879. end
  880. end
  881. #==============================================================================
  882. class Window_EquipItem < Window_ItemList
  883. #==============================================================================
  884. #-----------------------------------------------------------------------------
  885. #
  886. #-----------------------------------------------------------------------------
  887. def enable?(item)
  888. return false unless item
  889. return achi_enabled_weap(item) if item.is_a?(RPG::Weapon)
  890. return achi_enabled_armr(item) if item.is_a?(RPG::Armor)
  891. return true
  892. end
  893. #-----------------------------------------------------------------------------
  894. #
  895. #-----------------------------------------------------------------------------
  896. def achi_enabled_weap(item)
  897. return false unless item
  898. !$game_player.achiiz.weapon_restrictions.include?(item.id)
  899. end
  900. #-----------------------------------------------------------------------------
  901. #
  902. #-----------------------------------------------------------------------------
  903. def achi_enabled_armr(item)
  904. return false unless item
  905. !$game_player.achiiz.armor_restrictions.include?(item.id)
  906. end
  907. end
  908. #===============================================================================
  909. class Window_AchiiCommand < Window_Command
  910. #===============================================================================
  911. #-----------------------------------------------------------------------------
  912. #
  913. #-----------------------------------------------------------------------------
  914. def initialize
  915. super(0,0)
  916. end
  917. #-----------------------------------------------------------------------------
  918. #
  919. #-----------------------------------------------------------------------------
  920. def window_width
  921. return Graphics.width/4
  922. end
  923. #-----------------------------------------------------------------------------
  924. #
  925. #-----------------------------------------------------------------------------
  926. def alignment
  927. return 0
  928. end
  929. #-----------------------------------------------------------------------------
  930. #
  931. #-----------------------------------------------------------------------------
  932. def make_command_list
  933. add_command(Achievement::Vocab[:comA], :badges)
  934. add_command(Achievement::Vocab[:comB], :exit)
  935. end
  936. end
  937. #===============================================================================
  938. class Window_StatusAchii < Window_Selectable
  939. #===============================================================================
  940. #-----------------------------------------------------------------------------
  941. # Initialization
  942. #-----------------------------------------------------------------------------
  943. def initialize(y)
  944. super(0, y, Graphics.width/2, 104)
  945. refresh
  946. end
  947. #-----------------------------------------------------------------------------
  948. # Line Height
  949. #-----------------------------------------------------------------------------
  950. def line_height
  951. return 22
  952. end
  953. #-----------------------------------------------------------------------------
  954. # Window Padding
  955. #-----------------------------------------------------------------------------
  956. def standard_padding
  957. return 8
  958. end
  959. #-----------------------------------------------------------------------------
  960. # Do Refresh
  961. #-----------------------------------------------------------------------------
  962. def refresh
  963. contents.clear
  964. refresh_fonts
  965. draw_badge_prog
  966.  
  967. draw_last_achii
  968. end
  969. #-----------------------------------------------------------------------------
  970. #
  971. #-----------------------------------------------------------------------------
  972. def draw_badge_prog
  973. x = 0
  974. y = 0
  975. w = self.width-24
  976. h = line_height
  977. draw_text(x,y,w,h,Achievement::Vocab[:prog])
  978. valu = "#{$game_player.achii_prog} / #{$game_player.achiiz.badges.size}"
  979. draw_text(x,y,w-4,h,valu,2)
  980. end
  981.  
  982. #-----------------------------------------------------------------------------
  983. #
  984. #-----------------------------------------------------------------------------
  985. def draw_last_achii
  986. x = 0
  987. y = line_height
  988. w = self.width-24
  989. h = line_height
  990. draw_text(x,y,w,h,Achievement::Vocab[:last])
  991. canc = $game_player.achiiz.last_gained
  992. return unless canc
  993. draw_last_badge(canc)
  994. draw_last_gain_date(canc)
  995. canc = $game_player.achiiz.sndlast_gained
  996. return unless canc
  997. draw_2last_badge(canc)
  998. draw_2last_gain_date(canc)
  999. end
  1000. #-----------------------------------------------------------------------------
  1001. #
  1002. #-----------------------------------------------------------------------------
  1003. def draw_last_badge(badg)
  1004. x = 0
  1005. y = line_height*2
  1006. w = self.width-24
  1007. h = line_height
  1008. draw_de_icon(badg.icon,x,y,badg.ihue,!badg.locked)
  1009. draw_text(x+24,y,w,h,badg.name)
  1010. end
  1011. #-----------------------------------------------------------------------------
  1012. #
  1013. #-----------------------------------------------------------------------------
  1014. def draw_last_gain_date(badg)
  1015. x = 0
  1016. y = line_height*2
  1017. w = self.width-24
  1018. h = line_height
  1019. draw_text(x,y,w-4,h,badg.date_gained,2)
  1020. end
  1021. #-----------------------------------------------------------------------------
  1022. #
  1023. #-----------------------------------------------------------------------------
  1024. def draw_2last_badge(badg)
  1025. x = 0
  1026. y = line_height*3
  1027. w = self.width-24
  1028. h = line_height
  1029. draw_de_icon(badg.icon,x,y,badg.ihue,!badg.locked)
  1030. draw_text(x+24,y,w,h,badg.name)
  1031. end
  1032. #-----------------------------------------------------------------------------
  1033. #
  1034. #-----------------------------------------------------------------------------
  1035. def draw_2last_gain_date(badg)
  1036. x = 0
  1037. y = line_height*3
  1038. w = self.width-24
  1039. h = line_height
  1040. draw_text(x,y,w-4,h,badg.date_gained,2)
  1041. end
  1042. #-----------------------------------------------------------------------------
  1043. #
  1044. #-----------------------------------------------------------------------------
  1045. def module_data
  1046. Achievement::Vocanicon
  1047. end
  1048. end
  1049. #===============================================================================
  1050. class Badge_Status < Dekita_Core_Status
  1051. #===============================================================================
  1052. #-----------------------------------------------------------------------------
  1053. #
  1054. #-----------------------------------------------------------------------------
  1055. def standard_padding
  1056. return 4
  1057. end
  1058. #-----------------------------------------------------------------------------
  1059. # Refresh
  1060. #-----------------------------------------------------------------------------
  1061. def refresh
  1062. contents.clear
  1063. refresh_fonts
  1064. draw_status_inf
  1065. end
  1066. #-----------------------------------------------------------------------------
  1067. # Get Setup Info
  1068. #-----------------------------------------------------------------------------
  1069. def setup_info
  1070. return Array.new unless @actor
  1071. return @actor.stats # @actor.mods
  1072. end
  1073. #-----------------------------------------------------------------------------
  1074. # Draw Status Page Info
  1075. #-----------------------------------------------------------------------------
  1076. def draw_status_inf
  1077. x = 0 ; y = 0
  1078. data = setup_info
  1079. for i in data
  1080. case i[0]
  1081. # [:header, "TEXT", Text_Color, icon_id, icon_hue, alignment],
  1082. when :param then y = draw_parameters(x,y,i[1],i[2])
  1083. when :x_param then y = draw_xparameters(x,y,i[1],i[2])
  1084. when :s_param then y = draw_sparameters(x,y,i[1],i[2])
  1085. when :atk_ele then y = draw_atk_eles(x,y,i[1],i[2])
  1086. when :def_ele then y = draw_def_eles(x,y,i[1],i[2])
  1087. when :atk_lvl then y = draw_atk_level(x,y,i[1])
  1088. when :def_lvl then y = draw_def_level(x,y,i[1])
  1089. when :tp_info then y = draw_tp_info(x,y,i[1])
  1090. when :spds_stat then y = draw_spds_info(x,y,i[1],i[2])
  1091. end
  1092. end
  1093. end
  1094. #-----------------------------------------------------------------------------
  1095. # Draw Parameters
  1096. #-----------------------------------------------------------------------------
  1097. def draw_parameters(x,y,i,v)
  1098. data = Vocanicon.param(i)
  1099. text = data[0]
  1100. colo = data[1]
  1101. icon = data[2]
  1102. ihue = data[3]
  1103. valu = sprintf("%s",v)
  1104. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1105. return y
  1106. end
  1107. #-----------------------------------------------------------------------------
  1108. # Draw x Parameters
  1109. #-----------------------------------------------------------------------------
  1110. def draw_xparameters(x,y,i,v)
  1111. data = Vocanicon.xparam(i)
  1112. text = data[0]
  1113. colo = data[1]
  1114. icon = data[2]
  1115. ihue = data[3]
  1116. valu = sprintf("%1.2f%%",v*100)
  1117. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1118. return y
  1119. end
  1120. #-----------------------------------------------------------------------------
  1121. # Draw sParameters
  1122. #-----------------------------------------------------------------------------
  1123. def draw_sparameters(x,y,i,v)
  1124. data = Vocanicon.sparam(i)
  1125. text = data[0]
  1126. colo = data[1]
  1127. icon = data[2]
  1128. ihue = data[3]
  1129. valu = sprintf("%1.2f%%",v*100)
  1130. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1131. return y
  1132. end
  1133. #-----------------------------------------------------------------------------
  1134. # Draw Attack Elements
  1135. #-----------------------------------------------------------------------------
  1136. def draw_atk_eles(x,y,i,v)
  1137. return y unless $D13x[:Elems_Control]
  1138. data = Vocanicon.atk_element(i)
  1139. text = data[0]
  1140. colo = data[1]
  1141. icon = data[2]
  1142. ihue = data[3]
  1143. valu = sprintf("%1.2f%%",v*100)
  1144. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1145. return y
  1146. end
  1147. #-----------------------------------------------------------------------------
  1148. # Draw Defence Elements
  1149. #-----------------------------------------------------------------------------
  1150. def draw_def_eles(x,y,i,v)
  1151. return y unless $D13x[:Elems_Control]
  1152. data = Vocanicon.def_element(i)
  1153. text = data[0]
  1154. colo = data[1]
  1155. icon = data[2]
  1156. ihue = data[3]
  1157. valu = sprintf("%1.2f%%",v*100)
  1158. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1159. return y
  1160. end
  1161. #-----------------------------------------------------------------------------
  1162. # Draw Attack Level
  1163. #-----------------------------------------------------------------------------
  1164. def draw_atk_level(x,y,v)
  1165. return y unless $D13x[:Atk_Def_Lvs]
  1166. data = Vocanicon::Atk_Level
  1167. text = data[0]
  1168. colo = data[1]
  1169. icon = data[2]
  1170. ihue = data[3]
  1171. valu = sprintf("%s",v.to_i)
  1172. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1173. return y
  1174. end
  1175. #-----------------------------------------------------------------------------
  1176. # Draw Defence Level
  1177. #-----------------------------------------------------------------------------
  1178. def draw_def_level(x,y,v)
  1179. return y unless $D13x[:Atk_Def_Lvs]
  1180. data = Vocanicon::Def_Level
  1181. text = data[0]
  1182. colo = data[1]
  1183. icon = data[2]
  1184. ihue = data[3]
  1185. valu = sprintf("%s",v.to_i)
  1186. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1187. return y
  1188. end
  1189. #-----------------------------------------------------------------------------
  1190. # Draw TP Info
  1191. #-----------------------------------------------------------------------------
  1192. def draw_tp_info(x,y,v)
  1193. return y unless $D13x[:TP_Control]
  1194. data = Vocanicon::TP
  1195. text = data[0]
  1196. colo = data[1]
  1197. icon = data[2]
  1198. ihue = data[3]
  1199. valu = sprintf("%s",v.to_i)
  1200. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1201. return y
  1202. end
  1203. #-----------------------------------------------------------------------------
  1204. # Draw TP Info
  1205. #-----------------------------------------------------------------------------
  1206. def draw_spds_info(x,y,i,v)
  1207. return y unless $D13x[:ISPDS]
  1208. data = Vocanicon.spds_stat($game_party.leader,i)
  1209. text = data[0]
  1210. colo = data[1]
  1211. icon = data[2]
  1212. ihue = data[3]
  1213. valu = sprintf("%s",v.to_i)
  1214. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1215. return y
  1216. end
  1217. end
  1218. #===============================================================================
  1219. class Window_Achievement < Window_Command
  1220. #===============================================================================
  1221. #-----------------------------------------------------------------------------
  1222. #
  1223. #-----------------------------------------------------------------------------
  1224. def initialize(y)
  1225. super(0,y)
  1226. deactivate
  1227. unselect
  1228. refresh
  1229. end
  1230. #-----------------------------------------------------------------------------
  1231. #
  1232. #-----------------------------------------------------------------------------
  1233. def window_width
  1234. return Graphics.width
  1235. end
  1236. #-----------------------------------------------------------------------------
  1237. #
  1238. #-----------------------------------------------------------------------------
  1239. def col_max
  1240. return 4
  1241. end
  1242. #-----------------------------------------------------------------------------
  1243. #
  1244. #-----------------------------------------------------------------------------
  1245. def spacing
  1246. return 0
  1247. end
  1248. #-----------------------------------------------------------------------------
  1249. #
  1250. #-----------------------------------------------------------------------------
  1251. def make_command_list
  1252. $game_player.achiiz.badges.each do |i|
  1253. add_command(i.name, :badge, !i.locked, i)
  1254. end
  1255. end
  1256. #-----------------------------------------------------------------------------
  1257. #
  1258. #-----------------------------------------------------------------------------
  1259. def visible_line_number
  1260. return 9
  1261. end
  1262. #-----------------------------------------------------------------------------
  1263. #
  1264. #-----------------------------------------------------------------------------
  1265. def draw_item(index)
  1266. change_color(normal_color, command_enabled?(index))
  1267. data = @list[index][:ext]
  1268. rect = item_rect_for_text(index)
  1269. x = rect.x-1
  1270. y = rect.y+1
  1271. w = rect.width+2
  1272. h = rect.height-2
  1273. contents.fill_rect(x,y,w,h,General::Box_Color)
  1274. draw_de_icon(data.icon,x,y,0,!data.locked)
  1275. draw_text(x+24,y,w,h,command_name(index))
  1276. end
  1277. #-----------------------------------------------------------------------------
  1278. #
  1279. #-----------------------------------------------------------------------------
  1280. def draw_badges
  1281. $game_player.achiiz.badges.each do |i|
  1282. add_command(i.name, :badge, true, i)
  1283. end
  1284. end
  1285. #-----------------------------------------------------------------------------
  1286. #
  1287. #-----------------------------------------------------------------------------
  1288. def help_info
  1289. @list[index][:ext].text
  1290. end
  1291. #-----------------------------------------------------------------------------
  1292. #
  1293. #-----------------------------------------------------------------------------
  1294. def badge
  1295. @list[@index][:ext] || nil
  1296. end
  1297. end
  1298. #===============================================================================
  1299. class Scene_Achievement < Scene_MenuBase
  1300. #===============================================================================
  1301. #-----------------------------------------------------------------------------
  1302. #
  1303. #-----------------------------------------------------------------------------
  1304. def start
  1305. super
  1306. start_shit
  1307. end
  1308. #-----------------------------------------------------------------------------
  1309. #
  1310. #-----------------------------------------------------------------------------
  1311. def start_shit
  1312. create_command_window
  1313. create_help_window
  1314. create_status_window
  1315. create_achii_window
  1316. create_badge_window
  1317. end
  1318. #-----------------------------------------------------------------------------
  1319. #
  1320. #-----------------------------------------------------------------------------
  1321. def create_command_window
  1322. @command_window = Window_AchiiCommand.new
  1323. @command_window.set_handler(:cancel, method(:return_scene))
  1324. @command_window.set_handler(:exit, method(:return_scene))
  1325. @command_window.set_handler(:badges, method(:check_badges))
  1326. @command_window.viewport = @viewport
  1327. end
  1328. #-----------------------------------------------------------------------------
  1329. # Create Halp Window
  1330. #-----------------------------------------------------------------------------
  1331. def create_help_window
  1332. @help_window = Deki_Help.new
  1333. @help_window.viewport = @viewport
  1334. @help_window.x = Graphics.width / 4
  1335. end
  1336. #-----------------------------------------------------------------------------
  1337. #
  1338. #-----------------------------------------------------------------------------
  1339. def create_status_window
  1340. @status_window = Window_StatusAchii.new(@help_window.height)
  1341. @status_window.viewport = @viewport
  1342. end
  1343. #-----------------------------------------------------------------------------
  1344. #
  1345. #-----------------------------------------------------------------------------
  1346. def create_achii_window
  1347. y = @status_window.y+@status_window.height
  1348. @achii_window = Window_Achievement.new(y)
  1349. @achii_window.set_handler(:cancel,method(:return_to_com))
  1350. @achii_window.viewport = @viewport
  1351. end
  1352. #-----------------------------------------------------------------------------
  1353. #
  1354. #-----------------------------------------------------------------------------
  1355. def create_badge_window
  1356. x = Graphics.width/2
  1357. y = @status_window.y
  1358. w = Graphics.width/2
  1359. h = @status_window.height
  1360. b = @achii_window.badge
  1361. @badge_window = Badge_Status.new(x,y,w,h,b)
  1362. @badge_window.viewport = @viewport
  1363. end
  1364. #-----------------------------------------------------------------------------
  1365. #
  1366. #-----------------------------------------------------------------------------
  1367. def on_actor_change
  1368. end
  1369. #-----------------------------------------------------------------------------
  1370. #
  1371. #-----------------------------------------------------------------------------
  1372. def update
  1373. super
  1374. update_help
  1375. end
  1376. #-----------------------------------------------------------------------------
  1377. #
  1378. #-----------------------------------------------------------------------------
  1379. def update_help
  1380. @help_window.set_text(@achii_window.help_info)
  1381. @badge_window.actor = @achii_window.badge
  1382. end
  1383. #-----------------------------------------------------------------------------
  1384. #
  1385. #-----------------------------------------------------------------------------
  1386. def check_badges
  1387. @command_window.unselect
  1388. @achii_window.activate
  1389. @achii_window.select(0)
  1390. end
  1391. #-----------------------------------------------------------------------------
  1392. #
  1393. #-----------------------------------------------------------------------------
  1394. def return_to_com
  1395. @achii_window.unselect
  1396. @command_window.activate
  1397. @command_window.select(0)
  1398. end
  1399. end
  1400. if Achievement::Menu_Access
  1401. #===============================================================================
  1402. class Window_MenuCommand < Window_Command
  1403. #===============================================================================
  1404. #-----------------------------------------------------------------------------
  1405. #
  1406. #-----------------------------------------------------------------------------
  1407. alias :aoc_scene_badge :add_original_commands
  1408. #-----------------------------------------------------------------------------
  1409. #
  1410. #-----------------------------------------------------------------------------
  1411. def add_original_commands
  1412. aoc_scene_badge
  1413. add_badge_command
  1414. end
  1415. #-----------------------------------------------------------------------------
  1416. #
  1417. #-----------------------------------------------------------------------------
  1418. def add_badge_command
  1419. add_command(Achievement::Vocanicon[0],:badges)
  1420. end
  1421. end
  1422. #===============================================================================
  1423. class Scene_Menu < Scene_MenuBase
  1424. #===============================================================================
  1425. #-----------------------------------------------------------------------------
  1426. #
  1427. #-----------------------------------------------------------------------------
  1428. alias :ccw_scene_badge :create_command_window
  1429. #-----------------------------------------------------------------------------
  1430. #
  1431. #-----------------------------------------------------------------------------
  1432. def create_command_window
  1433. ccw_scene_badge
  1434. @command_window.set_handler(:badges, method(:open_badge_scene))
  1435. end
  1436. #-----------------------------------------------------------------------------
  1437. #
  1438. #-----------------------------------------------------------------------------
  1439. def open_badge_scene
  1440. SceneManager.call(Scene_Achievement)
  1441. end
  1442. end
  1443. end# if Game_Storage::Menu_Access[0]
  1444. #==============================================================================#
  1445. # http://dekitarpg.wordpress.com/ #
  1446. #==============================================================================#
  1447. end # if true # << Make true to use this script, false to disable.
RAW Paste Data