Recent posts

Pages1 2 3 ... 10
1
RPG Maker Scripts / Re: Question for XP - Experien...
Last post by Heretic86 - May 25, 2022, 01:17:25 pm
Quote from: Blizzard on May 25, 2022, 04:10:24 amThe formula I came up with for my script isn't 100% accurate, but I could never figure out why. It might be possible that it just comes down to some mathematical accuracy/rounding issues or something like that. But I think you can still rely on the formula being 99%+ accurate.

Good enough for me!
2
RPG Maker Scripts / Re: Question for XP - Experien...
Last post by Blizzard - May 25, 2022, 04:10:24 am
The formula I came up with for my script isn't 100% accurate, but I could never figure out why. It might be possible that it just comes down to some mathematical accuracy/rounding issues or something like that. But I think you can still rely on the formula being 99%+ accurate.
3
RPG Maker Scripts / Re: Question for XP - Experien...
Last post by Heretic86 - May 25, 2022, 02:26:15 am
Thanks KK20, I actually fully missed the reply in that thread!



Ok, Exp Curve is done.

Taking a whack at making the Parameters curve tho, not much luck.  Values dont look to be set anywhere in Engine Code, so has to be calculated in the Editor.  Anyone else happen to know what the formula is for calculating curves like this?

4
RPG Maker Scripts / Re: Question for XP - Experien...
Last post by KK20 - May 22, 2022, 10:39:21 pm
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-xp-in-javascript-php-and-mysql-wip.147465/post-1275706

Don't know about the stat parameters.

EDIT: Didn't confirm if this is accurate to the editor's, but could reference Blizz's script
https://forum.chaos-project.com/index.php/topic,5563.0.html
5
RPG Maker Scripts / Question for XP - Experience I...
Last post by Heretic86 - May 22, 2022, 09:45:36 pm
Hopefully a quick question...

Using HTML5 Canvas to generate Experience Inflation and Parameter Curves...

What are the formulas for calculating the Exp Inflation and Parameter Curves?

Pretty much BOTH things that happen in THESE windows...




6
Script Requests / Re: [RMXP] Need help with edit...
Last post by Ninjason - May 09, 2022, 02:09:37 pm
Outstanding!
All is set and works as envisioned - again, thank you very much :)
You have made a stranger on the internet and his small playerbase very happy all the best to you and this forum :D
7
Script Requests / Re: [RMXP] Need help with edit...
Last post by KK20 - May 09, 2022, 12:53:02 am
The draw_text function takes in an optional parameter at the end that changes the alignment. Look up Bitmap in the Help File:
Quotedraw_text(x, y, width, height, str[, align])
draw_text(rect, str[, align])
Draws a string str in the bitmap box (x, y, width, height) or rect (Rect).

If the text length exceeds the box's width, the text width will automatically be reduced by up to 60 percent.

Horizontal text is left-aligned by default; set align to 1 to center the text and to 2 to right-align it. Vertical text is always centered.

As this process is time-consuming, redrawing the text with every frame is not recommended.
The draw_letter_grade is currently set to right-align
  def draw_letter_grade(x, y, value, type)
    orig_color = self.contents.font.color
    grade = letter_grade_for(value, type)
    self.contents.draw_text(x, y, 36, 32, grade, 2) #<======== 2 is right-align
    self.contents.font.color = orig_color
  end
So the solution would be to remove that 2, thereby making it left-aligned. Then adjust the x and y coordinates as needed.
8
Script Requests / Re: [RMXP] Need help with edit...
Last post by Ninjason - May 08, 2022, 04:36:24 am
KK20, thank you again, this is magnificent!

I have just completed configuring each scale and introduced several sub-ranks (E-, E+, C-, C+...)

I have just one last question and I think it's a small one, but too complicated for me and searching the web has so far produced no answer.
I feel a bit awkward to ask this, as I do not want to seem picky or ungrateful - I am SO happy with this, I cannot even articulate it  :D
My question is: "Is there a way for me to align the grades shown in the eqip screen to their left instead of their center?"


 (I'm kind of surprised, I thought the answer would be some easy snippet like "text.align = left" or something of that sort and being mentioned on a multitude of "how-to-ruby scripting"-websites...)

The problem is, now that I have introduced strings of different lengths 'C' vs. 'C +' their right-alignment produces a jumpy look &feel.
The stat values to their left seem to be right-aligned also, but this looks quite neatly. I want to align the ranks on their left, so the letters are always ordered in a straight line downwards with an occasional + or - to their right
I have tried working with additional spaces within the strings like  'C +' vs. 'C  ' but ' ', '-' and '+' all have different widths when displayed onscreen (different to the apparent lengths of their strings in the script), so it just does not work properly.


9
Script Requests / Re: [RMXP] Need help with edit...
Last post by KK20 - May 07, 2022, 08:48:03 pm
Here's the updated class
class Window_EquipLeft < Window_Base
  X_SHIFT = 0
 
  def letter_grade_for(value, type)
    grade = case type
    # 0 - ATK
    # 1 - PDEF
    # 2 - MDEF
    # 3 - DEX
    # 4 - INT
    # 5 - STR
    # 6 - AGI
    # 7 - EVA
    when 3, 4, 5
      case value
      when 0..25 then :F
      when 26..50 then :E
      when 51..100 then :D
      when 101..200 then :C
      when 201..400 then :B
      when 401..750 then :A
      else :S
      end
    when 1, 2
      case value
      when 0..50 then :F
      when 51..100 then :E
      when 101..200 then :D
      when 201..400 then :C
      when 401..600 then :B
      when 601..750 then :A
      else :S
      end
    when 0
      # you know what to do
    when 6
      # you know what to do
    end
   
    case grade
    when :F
      self.contents.font.color.set(255, 13, 13)
    when :E
      self.contents.font.color.set(255, 78, 17)
    when :D
      self.contents.font.color.set(255, 142, 21)
    when :C
      self.contents.font.color.set(250, 183, 51)
    when :B
      self.contents.font.color.set(172, 179, 52)
    when :A
      self.contents.font.color.set(105, 179, 76)
    else
      self.contents.font.color.set(53, 214, 237)
    end
    "(#{grade})"
  end
 
  def draw_letter_grade(x, y, value, type)
    orig_color = self.contents.font.color
    grade = letter_grade_for(value, type)
    self.contents.draw_text(x, y, 36, 32, grade, 2)
    self.contents.font.color = orig_color
  end
 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(224, 64, 415, 232)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # * Draw Parameter
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     type  : parameter type (0-6)
  #--------------------------------------------------------------------------
  def draw_actor_parameter(actor, x, y, type)
    case type
    when 0
      parameter_name = $data_system.words.atk
      parameter_value = actor.atk
    when 1
      parameter_name = $data_system.words.pdef
      parameter_value = actor.pdef
    when 2
      parameter_name = $data_system.words.mdef
      parameter_value = actor.mdef
    when 3
      parameter_name = $data_system.words.dex
      parameter_value = actor.dex
    when 4
      parameter_name = $data_system.words.int
      parameter_value = actor.int
    when 5
      parameter_name = $data_system.words.str
      parameter_value = actor.str
    when 6
      parameter_name = $data_system.words.agi
      parameter_value = actor.agi
    when 7
      parameter_name = "Evasion"
      parameter_value = actor.eva
    end
    self.contents.font.size = 16
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, 32, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 80 + X_SHIFT, y, 36, 32, parameter_value.to_s, 2)
    draw_letter_grade(x + 100 + X_SHIFT, y, parameter_value, type)
  end
  #--------------------------------------------------------------------------
  # * Draw Actor Face Graphic
  #--------------------------------------------------------------------------
  def draw_actor_face_graphic(actor, x, y)
    #bitmap = RPG::Cache.picture(actor.id.to_s)
    bitmap = RPG::Cache.battler(actor.battler_name, 0)
    x -= bitmap.width / 2 - 30
    self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------   
  def refresh
    self.contents.clear
    draw_actor_face_graphic(@actor, x + 50, y - 40)
    self.contents.font.size = 18
    draw_actor_level(@actor, 4, -3)
    for i in 0..7
      draw_actor_parameter(@actor, 4, i * 22 + 19, i)
    end
    [[@new_atk, @actor.atk], [@new_pdef, @actor.pdef], [@new_mdef, @actor.mdef],
     [@new_dex, @actor.dex], [@new_int, @actor.int], [@new_str, @actor.str],
     [@new_agi, @actor.agi], [@new_eva, @actor.eva]].each_with_index { |stat, i|
      if stat[0] != nil
        y = i * 22 + 19
        self.contents.font.color = normal_color
        self.contents.draw_text(140 + X_SHIFT, y, 40, 32, '->', 1)
       
        if stat[0] > stat[1]
          self.contents.font.color = Color.new(128, 255, 128)
        elsif (stat[0] < stat[1])
          self.contents.font.color = Color.new(255, 128, 128)
        end
       
        self.contents.draw_text(160 + X_SHIFT, y, 36, 32, stat[0].to_s, 2)
        draw_letter_grade(180 + X_SHIFT, y, stat[0], i)
      end
     }
  end
  #--------------------------------------------------------------------------
  # * Set parameters after changing equipment
  #     new_atk  : attack power after changing equipment
  #     new_pdef : physical defense after changing equipment
  #     new_mdef : magic defense after changing equipment
  #--------------------------------------------------------------------------
  def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
                         new_agi, new_int, new_eva)
    if @new_atk != new_atk || @new_pdef != new_pdef || @new_mdef != new_mdef ||
        @new_str != new_str || @new_dex != new_dex || @new_agi != new_agi ||
        @new_int != new_int || @new_eva != new_eva
      @new_atk = new_atk
      @new_pdef = new_pdef
      @new_mdef = new_mdef
      @new_str = new_str
      @new_dex = new_dex
      @new_agi = new_agi
      @new_int = new_int
      @new_eva = new_eva
      refresh
    end
  end
end
I'll let you finish configuring the case-statements.
10
Script Requests / Re: [RMXP] Need help with edit...
Last post by Ninjason - May 07, 2022, 04:04:55 am
First of all: KK20, thank you very much, this is an awesome addition!

I actually had three follow-up questions, but I was so inspired by how happy I am with your addition, that (almost by accident) I finally successfully hid the EVASION stat, which I have tried for years, since it is a stat I do not use in my game  :haha:
Also, when showing the new stats during equip selection, I managed to reduce all stats who do not change in font size to highlight what's important right now, since there are a lot of colours now on the screen.



I felt empowered and this, I credit to you :)

My last question then is the following:
Currently, there is only a single section to define a scale which all stats use, but since my stats follow different scalings ingame, I would need more and each referring to a single stat (maybe grouping STR/DEX/INT and MDEF/PDEF would work, but AGI and ATK would definitely need a seperate one)

Can I multiply the section def letter_grade_for(value) which you created somehow and make it refer to a specific stat each time?
So far I haven't gotten it to work, I tried chaning "value" to equate a specific stat (like value = actor.atk just to try if it would work) but that nets me is an error message when opening the equip screen, saying

"NameERROR occured. undefined local variable or method 'actor' for #<Window_EquipLeft:0xe9ffc70>"

I tried moving the sections around a bit, but I'm guessing I'm just on a completely wrong track here.


Pages1 2 3 ... 10