Advertisement
Dekita

Untitled

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