Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Albhed Translator
- by Fomar0153
- Version 1.1
- ----------------------
- Notes
- ----------------------
- Adds an Albhed style language to your game.
- ----------------------
- Instructions
- ----------------------
- Follow the instructions in the Albhed module
- turn your chosen switch on to have people speak
- Albhed.
- ----------------------
- Change Log
- ----------------------
- 1.0 -> 1.1 Added the ability to not translate sections
- of a message. Use { and } to keep part of the message untranslated.
- Added the ability to have the translated text appear in another
- colour.
- ----------------------
- Known bugs
- ----------------------
- None
- =end
- module Albhed
- # Id of the switch to translate the text to Albhed
- ALBHED_SWITCH = 5
- ALBHED_COLOR = 14 # Colore per le lettere Albhed
- ALBHED_TRANSLATED_COLOR = 0 # Colore per le lettere TRADOTTE
- ALBHED_CHARS = {}
- # ALBHED_CHARS['letter'] = ['replacementletter', itemid to translate]
- ALBHED_CHARS['a'] = ['y', 33]
- ALBHED_CHARS['b'] = ['p', 34]
- ALBHED_CHARS['c'] = ['l', 35]
- ALBHED_CHARS['d'] = ['t', 36]
- ALBHED_CHARS['e'] = ['a', 37]
- ALBHED_CHARS['f'] = ['v', 38]
- ALBHED_CHARS['g'] = ['k', 39]
- ALBHED_CHARS['h'] = ['r', 40]
- ALBHED_CHARS['i'] = ['e', 41]
- ALBHED_CHARS['j'] = ['z', 42]
- ALBHED_CHARS['k'] = ['g', 43]
- ALBHED_CHARS['l'] = ['m', 44]
- ALBHED_CHARS['m'] = ['s', 45]
- ALBHED_CHARS['n'] = ['h', 46]
- ALBHED_CHARS['o'] = ['u', 47]
- ALBHED_CHARS['p'] = ['b', 48]
- ALBHED_CHARS['q'] = ['x', 49]
- ALBHED_CHARS['r'] = ['n', 50]
- ALBHED_CHARS['s'] = ['c', 51]
- ALBHED_CHARS['t'] = ['d', 52]
- ALBHED_CHARS['u'] = ['i', 53]
- ALBHED_CHARS['v'] = ['j', 54]
- ALBHED_CHARS['w'] = ['f', 55]
- ALBHED_CHARS['x'] = ['q', 56]
- ALBHED_CHARS['y'] = ['o', 57]
- ALBHED_CHARS['z'] = ['w', 58]
- def self.translate(c)
- return c, false if ALBHED_CHARS[c.downcase].nil?
- return c, true if $game_party.has_item?($data_items[ALBHED_CHARS[c.downcase][1]])
- return ALBHED_CHARS[c.downcase][0].downcase, false if c.downcase!.nil?
- return ALBHED_CHARS[c.downcase][0].upcase, false
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 通常文字の処理
- #--------------------------------------------------------------------------
- alias albhed_process_normal_character process_normal_character
- def process_normal_character(c, pos)
- if @trans.nil?
- @trans = true
- end
- return albhed_process_normal_character(c, pos) unless $game_switches[Albhed::ALBHED_SWITCH]
- if c == "{"
- @trans = false
- return
- end
- if c == "}"
- @trans = true
- return
- end
- c, translated = Albhed.translate(c) if @trans
- if translated
- change_color(text_color(Albhed::ALBHED_TRANSLATED_COLOR)) if @trans
- else
- change_color(text_color(Albhed::ALBHED_COLOR)) if @trans
- end
- text_width = text_size(c).width
- draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
- change_color(normal_color)
- pos[:x] += text_width
- end
- end
Add Comment
Please, Sign In to add comment