[RMVX ACE] [RMVX] VOCAB ENEMYRECOVERY TEXT PROBLEM

Posts

Pages: first 12 next last
I'm a frequent poster here. Hey look. A wall poster. LOL

I'm making a game in RPG Maker VX Ace from a comic I was doing back in high school. Though I am running into a strange problem maybe someone could help me out.

Normally everytime an enemy casts HP or MP recovery in battle, it would say something like "Slime recovers 50 HP!" Though that isn't the problem. The problem is that in battle, my game would say "Slime recovers HP 50!" The vocab is reversed(?) or something. Under the "#Results for Actions on Enemies", under "EnemyRecovery" it equals "%s recovers %s %s!" Though not sure why it's confusing two terms here.

It's a small weird detail and I can't fix it. Help?
Marrend
Guardian of the Description Thread
21806
This might be a weird error in relation to how the text is formatted with the `sprintf` function. Here's what Ace's help-file says about the `%s` character:

Character strings are output.

If the argument is not a String object, the to_s method causes the object turned into a character string to be treated as an argument.

Now for some possibly relevant code from Game_ActionResult
class Game_ActionResult
  #--------------------------------------------------------------------------
  # * Get Text for HP Damage
  #--------------------------------------------------------------------------
  def hp_damage_text
    if @hp_drain > 0
      fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
      sprintf(fmt, @battler.name, Vocab::hp, @hp_drain)
    elsif @hp_damage > 0
      fmt = @battler.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage
      sprintf(fmt, @battler.name, @hp_damage)
    elsif @hp_damage < 0
      fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
      sprintf(fmt, @battler.name, Vocab::hp, -hp_damage)
    else
      fmt = @battler.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
      sprintf(fmt, @battler.name)
    end
  end
end

So, in the case of recovery, the variable `@hp_damage` is probably less than 0. So, the `fmt` variable is Vocab::ActorRecovery or Vocab::EnemyRecovery. So far, so good. However, now that I'm zoomed in, I'm kinda noticing...

sprintf(fmt, @battler.name, Vocab::hp, -hp_damage)

...this line. Which could indicate to me that switching the positions of `Vocab::hp` and `-hp_damage` (shouldn't it be `(@hp_damage * -1).to_s`?) might produce the "correct" results? Other lines in that very function seem to follow the format of printing the term first, then the amount of damage/healing/drain, so, I would put any edits into a separate script-section just for the sake of caution.
I tried that but it spit out an error message. :/
Marrend
Guardian of the Description Thread
21806
What, precisely, did the error message say? When I try either just flipping the function...

sprintf(fmt, @battler.name, -hp_damage, Vocab::hp)


...this way, or...

sprintf(fmt, @battler.name, (@hp_damage*-1).to_s, Vocab::hp)


...going this way, no error messages were thrown at me.
Hmm, I didn't do that. I guess I typed that funny.

I've also been searching the NET for other scripts to make my game more interesting, and one thing that I'd kinda like is something that says "It's super effective" or "It wasn't very effective" in the battle log. I got a Sound on Critical Hit Sound thing that works pretty good. I'm also kind of interested in a script or something, that would change the character's description after an event or something in the story would happen, ie, in this story I was writing, the main character is pulled into the world of Infinite by Guardian Fairies, so in the character description, it might say "Though Deckard is a bit confused, he is on his way to become a part of the Vaccinator Army...". Is that a thing that is possible with VX Ace? Ace is like a goldmine!! It's pretty good.
Marrend
Guardian of the Description Thread
21806
The function to get the description text...

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Get Description
  #--------------------------------------------------------------------------
  def description
    actor.description
  end

  #--------------------------------------------------------------------------
  # * Get Actor Object
  #--------------------------------------------------------------------------
  def actor
    $data_actors[@actor_id]
  end
end

...refers to the `$data_actors` array.

*Edit: Which, itself, is loaded directly from the database when you start a new game.

module DataManager
  #--------------------------------------------------------------------------
  # * Load Normal Database
  #--------------------------------------------------------------------------
  def self.load_normal_database
    $data_actors        = load_data("Data/Actors.rvdata2")
    $data_classes       = load_data("Data/Classes.rvdata2")
    $data_skills        = load_data("Data/Skills.rvdata2")
    $data_items         = load_data("Data/Items.rvdata2")
    $data_weapons       = load_data("Data/Weapons.rvdata2")
    $data_armors        = load_data("Data/Armors.rvdata2")
    $data_enemies       = load_data("Data/Enemies.rvdata2")
    $data_troops        = load_data("Data/Troops.rvdata2")
    $data_states        = load_data("Data/States.rvdata2")
    $data_animations    = load_data("Data/Animations.rvdata2")
    $data_tilesets      = load_data("Data/Tilesets.rvdata2")
    $data_common_events = load_data("Data/CommonEvents.rvdata2")
    $data_system        = load_data("Data/System.rvdata2")
    $data_mapinfos      = load_data("Data/MapInfos.rvdata2")
  end
end

While it is technically possible to alter the variable...

$data_actors[3].description = [["First line of description"],["Second line of description?"]]

...such changes aren't stored by the default save system. I faced a very similar issue in this game in regards to Unites. My terribad answer was to insert the `$data_actors` object into the save-file contents. So, something like...

module DataManager
  #--------------------------------------------------------------------------
  # * Create Save Contents
  #--------------------------------------------------------------------------
  def self.make_save_contents
    contents = {}
    contents[:system]        = $game_system
    contents[:timer]         = $game_timer
    contents[:message]       = $game_message
    contents[:switches]      = $game_switches
    contents[:variables]     = $game_variables
    contents[:self_switches] = $game_self_switches
    contents[:actors]        = $game_actors
    contents[:party]         = $game_party
    contents[:troop]         = $game_troop
    contents[:map]           = $game_map
    contents[:player]        = $game_player
    contents[:dataactors]    = $data_actors
    contents
  end

  #--------------------------------------------------------------------------
  # * Extract Save Contents
  #--------------------------------------------------------------------------
  def self.extract_save_contents(contents)
    $game_system        = contents[:system]
    $game_timer         = contents[:timer]
    $game_message       = contents[:message]
    $game_switches      = contents[:switches]
    $game_variables     = contents[:variables]
    $game_self_switches = contents[:self_switches]
    $game_actors        = contents[:actors]
    $game_party         = contents[:party]
    $game_troop         = contents[:troop]
    $game_map           = contents[:map]
    $game_player        = contents[:player]
    $data_actors        = contents[:dataactors]
  end
end

...this.
Marrend
Guardian of the Description Thread
21806
Sorry if I can't be of any additional help. I can only go off of personal experience here.

*Edit: Though, I do kinda wonder if there isn't an alternate script out there that can more easily modify this value? Like, I'm thinking about when I used Casper Gaming's encyclopedia script. The script had methods to alter the text of entries mid-game to some degree, but, my guess is that the data it held was ultimately attached to the `$game_party` variable in order for changes to be saved without messing too much with `DataManager`.
Ruby is completely unknown to me, I can do HTML, Ruby seems like Syntax and code. Well, it's something, better than nothing. I was looking around online for stuff too. I guess for that, I'd have to make an event that references the script. Complex pup problems!
Marrend
Guardian of the Description Thread
21806
I've given this a bit more thought, and there might be a way around `$data_actors`, and allow the `description` variable to be alterable through `$game_actors`.

class Game_Actor < Game_Battler
  attr_accessor :description
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias gameactorsetup setup
  def setup(actor_id)
    gameactorsetup(actor_id)
    @description = actor.description
  end
end

So, the theory is that the `setup` function is called when the `$game_actors` object is made, and that the initial value would be whatever is in the DB. However, after a bit of testing, I can confirm that...

$game_actors[1].description = "First line of description.\nSecond line of description?"

...this is both workable and savable without modifying how the game saves data. Rasuna has learned something today.

*Edit: The data in the DB isn't changing either, so, it should be possible to revert back to the original with...

$game_actors[1].description = $game_actors[1].actor.description

...this?

*Edit2: Yep! Confirmed!
So, would I have to place this in an event? The script call? :o
Life goals confirmed LOL
Well I guess one question is, could an actor have multiple descriptions? I guess I would 'have to' write all of them in separate texts
I was also kind of curious what I could do with visuals like, is it possible to make different windows colored. Or have a gradient over the battle log messages? I mucked around a little bit with the gradient.new and gradient_fill_box but it spit out error messages :/ Then I could make the $ box blue or whatever. HMMMM.
Marrend
Guardian of the Description Thread
21806
`Window_Gold` is a child of `Window_Base`. As such, the window background color is an instance of the `Tone` class, so, it won't take standard RGB values. Saying that, you could write a `update_tone` function definition within the context of `Window_Gold` that would set the tone to be something other than what's set by the system.

I'll look this up in more detail when I have time.
Marrend
Guardian of the Description Thread
21806
Okay, here's a snippet from Acromage Ace concerning how it pulls off it's coloration of resource windows.

class Window_Resources < Window_Base
  # Change window tone based on card type.
  def update_tone
    if @type
      case @type
      when 0
        # Window is keeping track of Quarry/Bricks.
        self.tone.set(68, 0, -34)
      when 1
        # Window is keeping track of Magic/Gems.
        self.tone.set(-34, 0, 68)
      when 2
        # Window is keeping track of Dungeon/Beasts.
        self.tone.set(0, 68, -34)
      end
    end
  end
end

Applying that to `Window_Gold` might look something like...

class Window_Gold < Window_Base
  # Change window tone.
  def update_tone
    self.tone.set(0, 0, 128)
  end
end

...this, or whatever value you want, keeping in mind that it's a `Tone` object, not a `Color` object. As for having the battle log having a gradient, you might attempt changing the opacity of the window first. Which is defined...

class Window_BattleLog < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, window_height)
    self.z = 200
    self.opacity = 0 # <-right here
    @lines = []
    @num_wait = 0
    create_back_bitmap
    create_back_sprite
    refresh
  end
end

...in the initialize function.

For the battle log that was something different. That's just the "transparency" of the window. There's a line where there was a section (0, 0, 0) to do that. I think that was lower in the battlelog. I'll have to try the tone method to see what that does.

it seemed to make it brighter? but no color variation :/
I dunno what's going on with this one script, but I have the Yanfly Custom Victory script above the Junk Font Fix and the Arrow Fix scripts, but it's still spitting out weird blocks. Not sure why it's doing that??? I'm very confused.
Marrend
Guardian of the Description Thread
21806
"Spitting out weird blocks" definitely sound like it could be a font issue. Though, I'm guessing the junk font fix is supposed to fix that? Like, I'm partially assuming that the "weird blocks" you're talking about is actually..

class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Draw Right Arrow
  #--------------------------------------------------------------------------
  def draw_right_arrow(x, y)
    change_color(system_color)
    draw_text(x, y, 22, line_height, "→", 1)
  end
end


...the game attempting to draw the "→" character in a font where that character is printed as a box instead of a right arrow.
It's weird because it's Georgia (the font). Like why it do that. I don't know why it's doing that. No idea. And I have both of those scripts running. 0__________0 It's haunted lol

edit:
And I was looking online for a script, to flip the whole main menu the other way so everything is aligned to the left where the allies would be the left, and the selection window would be to the right. Is there one that does that? I couldn't really find anything. Sorry if I'm just ramming you with questions, this tends to happen through my posts a lot.
Marrend
Guardian of the Description Thread
21806
Through my work in UGE, that the decimal value of 26 (0x1A hexadecimal) can print the "→" character. Note that the " " character has a value of 32 (0x20 hexadecimal) and the "a" character has a value of 97 (0x61 hexadecimal).

That aside, I took a look at some character maps. In the Courier New character map, the "→" character appears at 0x2192. It does not appear on the character map of Georgia at all, going directly from 0x215E ("⅞") to 0x2202 ("∂"). VL Gothic (ie: the default font of RPG Maker VX Ace) isn't installed on my system, but, those values and characters in Georgia matched up with Courier New's character map.

Though, it would be nice to know exactly how the "trash font fix" is supposed to work. In regards to Ace, I'm only really familiar with Yanfly's messaging system, TsukiHime's resource checker, and Casper Gaming's encyclopedia.
Pages: first 12 next last