Advertisement
Spoofus

Spoof CBS

Jul 15th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.32 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # CBS Layout by Spoofus
  3. #
  4. # Version: 1.0b
  5. # Date 3/1/08
  6. #
  7. # Compatibility:
  8. #
  9. # May not be compatible with SDK's not tested though.
  10. # your old savegames. Can cause incompatibilty issues with following scripts
  11. # and/or systems:
  12. # - exotic CBS-es
  13. # Features:
  14. # Enemy and Ally Health bars
  15. # CBS Facesets
  16. # Nifty nice layout
  17. #
  18. # Instructions:
  19. # For a charecters faceset you must write their faces in the picture folder
  20. # but with _Face at the end of the actors name, remember to put the two health
  21. # bar scripts in this into your project as well
  22. #
  23. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  24. # Credits and thanks:
  25. # Nortos
  26. #Yin
  27. # and of course me
  28. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  29. #
  30. # If you find any bugs, please report them here:
  31. # http://www.chaosproject.co.nr
  32. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  33. #==============================================================================
  34. # ** class Window_Base
  35. #------------------------------------------------------------------------------
  36. # Face functions, the charecters face is just their name than _face e.g Arshes_Face
  37. #==============================================================================
  38. class Window_Base < Window
  39. def face
  40. face = RPG::Cache.picture("")
  41. end
  42.  
  43. def draw_face(actor,x,y)
  44. face = RPG::Cache.picture(actor.character_name + "_face") rescue face
  45. fw = face.width
  46. fh = face.height
  47. src_rect = Rect.new(0, 0, fw, fh)
  48. self.contents.blt(x , y - fh, face, src_rect)
  49. end
  50. end
  51. #==============================================================================
  52. # ** Window_BattleStatus
  53. #------------------------------------------------------------------------------
  54. # This window displays the status of all party members on the battle screen.
  55. #==============================================================================
  56.  
  57. class Window_BattleStatus < Window_Base
  58. #--------------------------------------------------------------------------
  59. # * Object Initialization
  60. #--------------------------------------------------------------------------
  61. def initialize
  62. super(450, 270, 190, 210)
  63. self.contents = Bitmap.new(width - 32, height - 32)
  64. self.contents.font.size = 14
  65. self.back_opacity = $game_system.window_opacity #**
  66. self.contents.font.bold = true
  67. self.contents.font.name = "Tahoma"
  68. @level_up_flags = [false, false, false, false]
  69. refresh
  70. end
  71. #--------------------------------------------------------------------------
  72. # * Dispose
  73. #--------------------------------------------------------------------------
  74. def dispose
  75. super
  76. end
  77. #--------------------------------------------------------------------------
  78. # * Set Level Up Flag
  79. # actor_index : actor index
  80. #--------------------------------------------------------------------------
  81. def level_up(actor_index)
  82. @level_up_flags[actor_index] = true
  83. end
  84. #--------------------------------------------------------------------------
  85. # * Refresh
  86. #--------------------------------------------------------------------------
  87. def refresh
  88. self.contents.clear
  89. @item_max = $game_party.actors.size
  90. for i in 0...$game_party.actors.size
  91. actor = $game_party.actors[i]
  92. actor_y = i * 82 + 0
  93. draw_actor_name(actor, 72, actor_y + 4)
  94. draw_actor_hp(actor, 45, actor_y + 20, 100)
  95. draw_actor_sp(actor, 61, actor_y + 45, 100)
  96. draw_face(actor, 37, actor_y + 27)
  97. if @level_up_flags[i]
  98. self.contents.font.color = normal_color
  99. self.contents.draw_text(0, actor_y + 60, 120, 32, "Lvl.Up!")
  100. else
  101. draw_actor_state(actor, 20, actor_y + 4)
  102. end
  103. end
  104. end
  105. end
  106. #==============================================================================
  107. # ** Game_Actor
  108. #------------------------------------------------------------------------------
  109. # This class determines the x and y coordinates of each of the battlers
  110. # to change them yourself should be easy enough
  111. #==============================================================================
  112. class Game_Actor
  113. def screen_x
  114. x_positions = [485, 485, 485, 485]
  115. if self.index != nil
  116. return x_positions[self.index]
  117. else
  118. return 0
  119. end
  120. end
  121. # #--------------------------------------------------------------------------
  122. def screen_y
  123. y_positions = [362, 445, 445, 445]
  124. if self.index != nil
  125. return y_positions[self.index]
  126. else
  127. return 0
  128. end
  129. end
  130. end
  131.  
  132. #==============================================================================
  133. # ** Scene_Battle
  134. #------------------------------------------------------------------------------
  135. # This class is all the kinks I had to change to the battle scene
  136. # I edited the windows mainly a bit
  137. #==============================================================================
  138.  
  139. class Scene_Battle
  140. def main
  141. # Initialize each kind of temporary battle data
  142. $game_temp.in_battle = true
  143. $game_temp.battle_turn = 0
  144. $game_temp.battle_event_flags.clear
  145. $game_temp.battle_abort = false
  146. $game_temp.battle_main_phase = false
  147. $game_temp.battleback_name = $game_map.battleback_name
  148. $game_temp.forcing_battler = nil
  149. # Initialize battle event interpreter
  150. $game_system.battle_interpreter.setup(nil, 0)
  151. # Prepare troop
  152. @troop_id = $game_temp.battle_troop_id
  153. $game_troop.setup(@troop_id)
  154. # Make actor command window
  155. s1 = $data_system.words.attack
  156. s2 = $data_system.words.skill
  157. s3 = $data_system.words.guard
  158. s4 = $data_system.words.item
  159. @actor_command_window = Window_Command.new(140, [s1, s2, s3, s4])
  160. @actor_command_window.x = 310
  161. @actor_command_window.y = 320
  162. @actor_command_window.active = false
  163. @actor_command_window.visible = true
  164. @actor_command_window.index = -1
  165. # Make other windows
  166. @party_command_window = Window_PartyCommand.new
  167. @help_window = Window_Help.new
  168. @help_window.back_opacity = $game_system.window_opacity #**
  169. @party_command_window.back_opacity = $game_system.window_opacity #**
  170. @help_window.visible = false
  171. @status_window = Window_BattleStatus.new
  172. @message_window = Window_Message.new
  173. # Make sprite set
  174. @spriteset = Spriteset_Battle.new
  175. # Initialize wait count
  176. @wait_count = 0
  177. # Execute transition
  178. if $data_system.battle_transition == ""
  179. Graphics.transition(20)
  180. else
  181. Graphics.transition(40, "Graphics/Transitions/" +
  182. $data_system.battle_transition)
  183. end
  184. # Start pre-battle phase
  185. start_phase1
  186. # Main loop
  187. loop do
  188. # Update game screen
  189. Graphics.update
  190. # Update input information
  191. Input.update
  192. # Frame update
  193. update
  194. # Abort loop if screen is changed
  195. if $scene != self
  196. break
  197. end
  198. end
  199. # Refresh map
  200. $game_map.refresh
  201. # Prepare for transition
  202. Graphics.freeze
  203. # Dispose of windows
  204. @actor_command_window.dispose
  205. @party_command_window.dispose
  206. @help_window.dispose
  207. @status_window.dispose
  208. @message_window.dispose
  209. if @skill_window != nil
  210. @skill_window.dispose
  211. end
  212. if @item_window != nil
  213. @item_window.dispose
  214. end
  215. if @result_window != nil
  216. @result_window.dispose
  217. end
  218. # Dispose of sprite set
  219. @spriteset.dispose
  220. # If switching to title screen
  221. if $scene.is_a?(Scene_Title)
  222. # Fade out screen
  223. Graphics.transition
  224. Graphics.freeze
  225. end
  226. # If switching from battle test to any screen other than game over screen
  227. if $BTEST and not $scene.is_a?(Scene_Gameover)
  228. $scene = nil
  229. end
  230. end
  231.  
  232. #--------------------------------------------------------------------------
  233. # * Frame Update (actor command phase : skill selection)
  234. #--------------------------------------------------------------------------
  235. def update_phase3_skill_select
  236. # Make skill window visible
  237. @actor_command_window.index = 0
  238. @actor_command_window.visible = true
  239. @skill_window.visible = true
  240. @skill_window.z = 255
  241. # Update skill window
  242. @skill_window.update
  243. # If B button was pressed
  244. if Input.trigger?(Input::B)
  245. # Play cancel SE
  246. $game_system.se_play($data_system.cancel_se)
  247. # End skill selection
  248. end_skill_select
  249. return
  250. end
  251. # If C button was pressed
  252. if Input.trigger?(Input::C)
  253. # Get currently selected data on the skill window
  254. @skill = @skill_window.skill
  255. # If it can't be used
  256. if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
  257. # Play buzzer SE
  258. $game_system.se_play($data_system.buzzer_se)
  259. return
  260. end
  261. # Play decision SE
  262. $game_system.se_play($data_system.decision_se)
  263. # Set action
  264. @active_battler.current_action.skill_id = @skill.id
  265. # Make skill window invisible
  266. @skill_window.visible = false
  267. # If effect scope is single enemy
  268. if @skill.scope == 1
  269. # Start enemy selection
  270. start_enemy_select
  271. # If effect scope is single ally
  272. elsif @skill.scope == 3 or @skill.scope == 5
  273. # Start actor selection
  274. start_actor_select
  275. # If effect scope is not single
  276. else
  277. # End skill selection
  278. end_skill_select
  279. # Go to command input for next actor
  280. phase3_next_actor
  281. end
  282. return
  283. end
  284. end
  285. #--------------------------------------------------------------------------
  286. # * Frame Update (actor command phase : item selection)
  287. #--------------------------------------------------------------------------
  288. def update_phase3_item_select
  289. # Make item window visible
  290. @actor_command_window.index = 0
  291. @actor_command_window.visible = true
  292. @item_window.visible = true
  293. @item_window.z = 255
  294. # Update item window
  295. @item_window.update
  296. # If B button was pressed
  297. if Input.trigger?(Input::B)
  298. # Play cancel SE
  299. $game_system.se_play($data_system.cancel_se)
  300. # End item selection
  301. end_item_select
  302. return
  303. end
  304. # If C button was pressed
  305. if Input.trigger?(Input::C)
  306. # Get currently selected data on the item window
  307. @item = @item_window.item
  308. # If it can't be used
  309. unless $game_party.item_can_use?(@item.id)
  310. # Play buzzer SE
  311. $game_system.se_play($data_system.buzzer_se)
  312. return
  313. end
  314. # Play decision SE
  315. $game_system.se_play($data_system.decision_se)
  316. # Set action
  317. @active_battler.current_action.item_id = @item.id
  318. # Make item window invisible
  319. @item_window.visible = false
  320. # If effect scope is single enemy
  321. if @item.scope == 1
  322. # Start enemy selection
  323. start_enemy_select
  324. # If effect scope is single ally
  325. elsif @item.scope == 3 or @item.scope == 5
  326. # Start actor selection
  327. start_actor_select
  328. # If effect scope is not single
  329. else
  330. # End item selection
  331. end_item_select
  332. # Go to command input for next actor
  333. phase3_next_actor
  334. end
  335. return
  336. end
  337. end
  338.  
  339. def start_phase2
  340. # Shift to phase 2
  341. @phase = 2
  342. # Set actor to non-selecting
  343. @actor_index = -1
  344. @active_battler = nil
  345. # Enable party command window
  346. @party_command_window.active = true
  347. @party_command_window.visible = true
  348. @party_command_window.index = 0
  349. # Disable actor command window
  350. @actor_command_window.active = false
  351. @actor_command_window.visible = true
  352. @actor_command_window.index = -1
  353. # Clear main phase flag
  354. $game_temp.battle_main_phase = false
  355. # Clear all party member actions
  356. $game_party.clear_actions
  357. # If impossible to input command
  358. unless $game_party.inputable?
  359. # Start main phase
  360. start_phase4
  361. end
  362. end
  363.  
  364. def update_phase3_basic_command
  365. # If B button was pressed
  366. if Input.trigger?(Input::B)
  367. # Play cancel SE
  368. $game_system.se_play($data_system.cancel_se)
  369. @actor_command_window.index = 0
  370. # Go to command input for previous actor
  371. phase3_prior_actor
  372. return
  373. end
  374. # If C button was pressed
  375. if Input.trigger?(Input::C)
  376. # Branch by actor command window cursor position
  377. case @actor_command_window.index
  378. when 0 # attack
  379. # Play decision SE
  380. $game_system.se_play($data_system.decision_se)
  381. # Set action
  382. @active_battler.current_action.kind = 0
  383. @active_battler.current_action.basic = 0
  384. # Start enemy selection
  385. start_enemy_select
  386. when 1 # skill
  387. # Play decision SE
  388. $game_system.se_play($data_system.decision_se)
  389. # Set action
  390. @active_battler.current_action.kind = 1
  391. # Start skill selection
  392. start_skill_select
  393. when 2 # guard
  394. # Play decision SE
  395. $game_system.se_play($data_system.decision_se)
  396. # Set action
  397. @active_battler.current_action.kind = 0
  398. @active_battler.current_action.basic = 1
  399. # Go to command input for next actor
  400. phase3_next_actor
  401. when 3 # item
  402. # Play decision SE
  403. $game_system.se_play($data_system.decision_se)
  404. # Set action
  405. @active_battler.current_action.kind = 2
  406. # Start item selection
  407. start_item_select
  408. end
  409. return
  410. end
  411. end
  412.  
  413. def phase3_setup_command_window
  414. # Disable party command window
  415. @party_command_window.active = false
  416. @party_command_window.visible = true
  417. #@party_command_window.opacity = 160
  418. @party_command_window.index = -2
  419. # Enable actor command window
  420. @actor_command_window.active = true
  421. @actor_command_window.visible = true
  422. # Set actor command window position
  423. # Set index to 0
  424. @actor_command_window.index = 0
  425. end
  426. end
  427.  
  428. #==============================================================================
  429. # ** Window_Command
  430. #------------------------------------------------------------------------------
  431. # This window deals with general command choices.
  432. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement