Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP] Version 2.8! CTB by Charlie Lee (v2.8) - aka a FFX like Battle System

Status
Not open for further replies.
1)
Code:
  def draw_text_shadowed_2(x, y, width, height, text, align = 1)
  def draw_text_shadowed(x, y, width, height, text, align = 1)

not exactly needed just add a parameter telling how many shadows (or just use Yeyinde's font addons having a method to draw shadowed text isn't as good as adding a parameter to the Font class and adding to draw_text)


2)
Code:
class Color
  def copy
    return Color.new(red, green, blue, alpha)
  end
end

not needed you can just use <Object>.dup or <Object>.clone dup and clone return a copy of the given object and can be used by any object

3)
Code:
  def min(a,b)
    if a<b
      return a
    else
      return b
    end
  end

  def max(a,b)
    if a>b
      return a
    else
      return b
    end
  end

not even in a class this is not Object Oriented style (which everyone should take advantage of), also you could have done [a, b].min or [a, b].max

4)
Code:
    @reflect_state_id = 17
    @rigene_state_id = 18
    @expx2_state_id = 32
    @reflect_animation_id = 102

better left as constants as the user would not change these in game

5) Do not overwrite methods (ex. Window_Base#initialize) unless you really have to

6)
Code:
  #-----------------------------------------
  def draw_actor_battle_graphic(actor, x, y)
    bitmap = RPG::Cache.battler(actor.character_name, actor.character_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x, y, bitmap, src_rect)
  end
  #-----------------------------------------
  def draw_actor_battle_graphic_opacity(actor, x, y, opacity)
    bitmap = RPG::Cache.battler(actor.character_name, actor.character_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x, y, bitmap, src_rect, opacity)
  end

could have added an default for opacity ex

Code:
def draw_actor_battle_graphic(actor, x, y, opacity = 255)

7) most of your methods in Window_Base could be placed in one method in order to shorten code you have three different versions of each of them which is not good.

8) Window_Selectable_Plus class could be replaced my Seph's Window_Selectable addon (see MACL)

ex using his Window Selectable addon would be in the initialize method

Code:
class Window_Test < Window_Selectable
  def initialize
    super(100, 100, 100, 100)
    @oh = 64
  end
end


9)
Code:
    $fontface=["MS UI Gothic", "Arial"]
    $fontsize=18

these lines are found in the illegal version and use of it is discouraged as using it in your script will cause people with the legal version to get errors, use Fond.default_name and Font.default_size instead

10)

$battle_turns_debug=false

use of globals is looked down upon in the Ruby community, and also violates OO as it isn't an OO construct

11)
def refresh(bq_, active_battler_=nil)

well it is pretty unusual to see a refresh method requiring parameters to be sent to it, I don't agree with the way you set up this method maybe if they were both defaulted.

12) I can not understand your Window_BattleTurns class (that is a bad thing) your spacing is inconsistent and your variable naming is very poor

13) in script CTB by Charlie - some Windows your code is inconsisent you did not indent properly, you have drawing code in your initialize method (that is better left to the refresh method) and lines like this self.contents.font.name = $fontface

14)
Code:
      self.contents.font.name = "MS UI Gothic"      
      self.contents.font.size = 14
      self.contents.font.bold=false
      self.contents.draw_text(x,y,100,32,"Name:")
      self.contents.font.name = "Ballpark"
      self.contents.font.size = 18
      draw_actor_name(actor, x+100, y)
      
      y=y+24
      self.contents.font.name = "MS UI Gothic"      
      self.contents.font.size = 14
      self.contents.font.bold=false
      self.contents.draw_text(x,y,100,32,"Class:")
      #self.contents.font.name = "Ballpark"
      draw_actor_class(actor, x+100, y)
      
      y=y+24
      self.contents.font.name = "MS UI Gothic"      
      self.contents.font.size = 14
      self.contents.font.bold=false
      self.contents.draw_text(x,y,100,32,"Level:")
      #self.contents.font.name = "Ballpark"
      self.contents.draw_text(x+100,y,100,32,actor.level.to_s)
      #draw_actor_level(actor, x+100, y)
      
      y=y+16
      self.contents.font.name = "MS UI Gothic"      
      self.contents.font.size = 14
      self.contents.font.bold=false
      self.contents.draw_text(x,y,100,32,"Exp:")
      #self.contents.font.name = "Ballpark"
      self.contents.draw_text(x+100,y,100,32,actor.exp.to_s)
      #draw_actor_level(actor, x+100, y)
      
      y=y+16
      self.contents.font.name = "MS UI Gothic"      
      self.contents.font.size = 14
      self.contents.font.bold=false
      self.contents.draw_text(x,y,100,32,"Next:")
      #self.contents.font.name = "Ballpark"
      self.contents.draw_text(x+100,y,100,32,actor.next_rest_exp_s)
      #draw_actor_level(actor, x+100, y)
      
      y=y+24
      self.contents.font.name = "MS UI Gothic"      
      self.contents.font.size = 14
      self.contents.font.bold=false
      self.contents.draw_text(x,y,100,32,"Status:")
      draw_actor_state(actor, x + 100, y)

Code:
      self.contents.font.bold=false
      #self.contents.font.color=text_color(12)
      self.contents.draw_text(x,y,200,32,"Equipment:")
      self.contents.font.bold=true
      y=y+24
      
      self.contents.font.color=system_color
      self.contents.draw_text(x, y, 96, 32, $data_system.words.weapon)
      self.contents.font.color=normal_color
      draw_item_name($data_weapons[@actor.weapon_id], x+200, y)
      y+=18
      self.contents.font.color=system_color
      self.contents.draw_text(x, y, 96, 32, $data_system.words.armor1)
      self.contents.font.color=normal_color
      draw_item_name($data_armors[@actor.armor1_id], x+200, y)
      y+=18
      self.contents.font.color=system_color
      self.contents.draw_text(x, y, 96, 32, $data_system.words.armor2)
      self.contents.font.color=normal_color
      draw_item_name($data_armors[@actor.armor2_id], x+200, y)
      y+=18
      self.contents.font.color=system_color
      self.contents.draw_text(x, y, 96, 32, $data_system.words.armor3)
      self.contents.font.color=normal_color
      draw_item_name($data_armors[@actor.armor3_id], x+200, y)
      y+=18
      self.contents.font.color=system_color
      self.contents.draw_text(x, y, 96, 32, $data_system.words.armor4)
      self.contents.font.color=normal_color
      draw_item_name($data_armors[@actor.armor4_id], x+200, y)

this is not good at all, okay let me take the second code now this is a visual example of what you are doing now take two pens one red and one blue red is normal_color and blue is system color now take the second code piece by piece and perform each operation switching colors when needed.


15)
Window_Status_3, Window_Status_2, Window_Status_1

these are bad class names a class name should hint at its use _3 _2 _1 tells the person using/editing your script nothing


16)
Code:
    @hp_bar=RPG::Cache.picture("hp_bar")
    @sp_bar=RPG::Cache.picture("sp_bar")
    @bar_1=RPG::Cache.picture("bar_1")
    @bar_2=RPG::Cache.picture("bar_2")
    @bar_3=RPG::Cache.picture("bar_3")
    @bar_4=RPG::Cache.picture("bar_4")
    @bar_5=RPG::Cache.picture("bar_5")
    @bar_6=RPG::Cache.picture("bar_6")
    @bar_7=RPG::Cache.picture("bar_7")
    @bar_8=RPG::Cache.picture("bar_8")

an array would have been more useful since you can iterate through it and perform operations rather than typing out code to do this for each one as you have done later in that section

17) If you aren't using a method in a class (ex. dummy in Window_Status_3, Window_Status_2, and Window_Status_1) then delete it

18)
Code:
  attr_accessor :visible_memory
  def initialize(actor=nil)
    [...]
    visible_memory=false
  end

does nothing

19)
Code:
  def update
    ################################
    ######## initial resize ########
    ################################
    return
    if self.visible
      if self.y > 0
        self.y -=60
      end
    else
      self.y = 480
    end
    ################################
    super
  end

that code never executes between the return and the super


20)
Code:
    def is_technique()
      if self.element_set.include?($game_temp.techniques_elem_id)
        return true
      else
        return false
      end
    end

could have just been

Code:
    def is_technique
      return self.element_set.include?($game_temp.techniques_elem_id)
    end


I'm sorry I didn't even get to the CTB portion but I am restricting myself to the first 20 things I see wrong and since I did this top down your addons were read first.

But I will say this, from the looks of your code so far you don't seem to know anything about OO. your code is also inconsistent which will confuse people who even think about modifying your code examples of this is the following:

Code:
debug_string=""
if @active_battler==bq_[i]

if @animation_frame == 0
self.contents.font.color = normal_color

    if size>0
      dst_cw=size
      dst_ch=size
    else
      dst_cw = bitmap.width
      dst_ch = bitmap.height
    end

your code is also much bigger than it needs to be, as shown in 14) when you repeatedly switched the colors when you could have only switched it twice. Also after reading the first part of your code it seems as though you do not know about the built-in functions as you created a Color.copy method when it wasn't really necessary and the max and min methods which is a simple array operation, so with all of these things combined if someone were to want an edit of this script or modify it themselves they would have a harder time since they will have to figure out what you were thinking when you coded this and then figure out what to change to suit their needs.

so yeah I think you can do a lot better than what you have here now, but it is a good first try but your code needs refining.
 
Thank you Trickster for your review. This is exactly what I expected from you experts of Ruby/RGSS.

2) Good, I didn't know.
3) Actually it's not used. I use [a, b].min instead.
8) Does Seph's Window_Selectable give an option for the row_size?
9) Why would this cause errors?
13) What's the problem with self.contents.font.name = $fontface?
14) I can't understand... some .,; please?
18) Is it because it should be @visible_memory?
19) Yes I know, it's a feature that I temporarily disabled.

"But I will say this, from the looks of your code so far you don't seem to know anything about OO"

Indeed, this is NOT what I expected from you experts of Ruby/RGSS. I don't
believe that. I know all that good OO practice stuff :) Let me say something stupid: it works after all :D.
As I said, I started this project very long ago (when I had only japanese comments and no complete help file), and I continued to add features each time I put my hands on it after loooong stops. That's why there is inconsistency and much more code than needed, sometimes I added methods that allowed me not to rewrite too much code.
However the add-ons part is the worst, I know.
Thank you for spending your time on this, I appreciate.
 
I do. Nothing relevant about the gameplay, just more cleaned and commented code. I will update the links tonight (GMT +1 h).

P.S. a thread about your game?
 
Diedrupo;284921 said:
Didn't you read what Trickster wrote? $fontface is only in the illegal version of RMXP. This means that you are using the illegal version, which is not supported on this forum.

You can download the legal version here: http://www.enterbrain.co.jp/tkool/RPG_XP/eng/download.html

You can define $fontface (or $fontname, or $myfont or whatever) and then you can use it in your classes with or without the illegal version. So that doesn't mean anything. Thank you for your priceless comment.
 
charlie.lee;284929":3o9kghk7 said:
You can define $fontface (or $fontname, or $myfont or whatever) and then you can use it in your classes with or without the illegal version. So that doesn't mean anything. Thank you for your priceless comment.

You can, but the fact that you are using in your CBS clearly shows what version you are using.

Do you expect people who use the legal version to go and define $fontface and $fontsize in Main just so they can run your script? Or do you expect illegal version users to use your script instead?

Perhaps you should simply follow Trickster's advice and replace those two globals with Font.default_name and Font.default_size instead.
 
Diedrupo;284932 said:
You can, but the fact that you are using in your CBS clearly shows what version you are using.

Do you expect people who use the legal version to go and define $fontface and $fontsize in Main just so they can run your script? Or do you expect illegal version users to use your script instead?

You haven't read the code, uh? The definition of these globals is already included in the project (because I don't have it in my original classes, does this suggest anything to you?). There's no need to define anything, just import the scripts. And what I expect is that people draw advantage from my project and my ideas and give some comments and/or critiques.
 
charlie.lee;284944":2xxere81 said:
You haven't read the code, uh? The definition of these globals is already included in the project (because I don't have it in my original classes, does this suggest anything to you?). There's no need to define anything, just import the scripts. And what I expect is that people draw advantage for my project and my ideas and give some comments and/or critiques.

I don't want to make a bigger deal out of this than necessary so this is my last post on this.

What are the odds that you magically came up with the global name $fontface, which just happens to match a global variable used only in the illegal or japanese versions of RMXP?

In either case, you questioned why you had to change anything regarding that global variable and I was merely informing you of why. If you don't want the stigma associated with $fontface, replace it with the recommended alternative.
 
Diedrupo;284953 said:
I don't want to make a bigger deal out of this than necessary so this is my last post on this.

What are the odds that you magically came up with the global name $fontface, which just happens to match a global variable used only in the illegal or japanese versions of RMXP?

In either case, you questioned why you had to change anything regarding that global variable and I was merely informing you of why. If you don't want the stigma associated with $fontface, replace it with the recommended alternative.

I simply found it in some scripts on the Internet in the early days of my project, some years ago, now I keep it for not to change too much code I have already written. However I think I will switch to the other form soon.
And you misunderstood, I was questioning if there was any technical issue for that line besides the "illegallity tag" O_o problem.

Why people are so anxious to wear the RMXP-Saviour's costume and repeat that song "...the illegal version is not supported here..." "...you can download the legal version...". We all know.
 
i think there's a glitch in your demo, when using arts "consuming inferno" 3 or 4 times, some of the enemies disappear, but not dead, just invisible.... then they will attack normally, then disappear again.......
 
kamiya_;285235 said:
i think there's a glitch in your demo, when using arts "consuming inferno" 3 or 4 times, some of the enemies disappear, but not dead, just invisible.... then they will attack normally, then disappear again.......

Yes, I know. It's because the enemies' spritesets are incomplete and there's no lowHP pose. I'm sorry, I will fix that in the next release. However it's not a bug, nothing to worry about.
 
I love you...

Seriously, FFX is one of my most favorite classic JRPGs of all time. Now we just need Overdrives, which can probably be made with the Limit Break Script...

Downloading right now.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top