[RMVX ACE] RANDOMIZED BATTLE VOCAB?

Posts

Pages: 1
Hey there! I'd like to change the battle messages housed in Script Editor > Vocab to pull from a list of possible messages to display at random, instead of displaying the same message every time.

Currently, whenever you miss an enemy, it displays the message "Missed! (Enemy name) took no damage!" due to this bit of code:

EnemyNoHit = "Missed! %s took no damage!"

What I'm looking for is something more like this:

EnemyNoHit = ("Message A!", or "Message B!", or "Message C!")

I'm just not sure how to write it out properly. Hopefully you guys'll know what I mean, but feel free to ask for clarification. Thanks for reading!
Marrend
Guardian of the Description Thread
21806
So, the only place I can see where Vocab::EnemyNoHit is even called is...


class Window_BattleLog < Window_Selectable
  def display_miss(target, item)
    if !item || item.physical?
      fmt = target.actor? ? Vocab::ActorNoHit : Vocab::EnemyNoHit
      Sound.play_miss
    else
      fmt = Vocab::ActionFailure
    end
    add_text(sprintf(fmt, target.name))
    wait
  end
end

...right there. So, if Vocab::EnemyNoHits is going to be an array, it might look something like...

class Window_BattleLog < Window_Selectable
  def display_miss(target, item)
    if !item || item.physical?
      index = rand(Vocab::EnemyNoHit.size - 1)
      fmt = target.actor? ? Vocab::ActorNoHit : Vocab::EnemyNoHit[index]
      Sound.play_miss
    else
      fmt = Vocab::ActionFailure
    end
    add_text(sprintf(fmt, target.name))
    wait
  end
end

...that? I can't say I'm 100% sure. However, I highly recommend making any changes you make into a new code-page under "Main", rather than altering the code itself.

*Edit: The edit to Vocab might look something like...

module Vocab
  EnemyNoHit = ["Message A!", "Message B!", "Message C!"]
end

...that. At least as a test to see if it randomizes. You can alter the text to something more appropriate after tests confirm that it's doing what you want it to do.
Pages: 1