Oh, Variable 5! (Moby's Text SE & Yanfly's Victory Aftermath!)

Discussion in 'RGSSx Script Support' started by RetroSoldier, Jul 17, 2013.

  1. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    Hello all! I'm RetroSoldier the Unheard Of!

    I'm making a small-ish RPG for my friends to enjoy (and for the pleasure of game-making.) 

    Anyway, onto the problem we go!

    The Setup:

    I am currently using a few scripts, two of which are Moby's Text SE v1.0 for sounds with mah text (specifically the version that allows you to assign up to 7 "voice" values with Variable 5) and Yanfly's Victory Aftermath v1.03.

    For reference:

    *Link to Moby's Text SE v1.0 → http://forums.rpgmakerweb.com/index.php?/topic/3463-mss-text-se/ (The exact script I'm using is the custom add-on posted by Bird Eater.)

    *Link to Yanfly's Victory Aftermath v1.03 → http://yanflychannel.wordpress.com/rmvxa/battle-scripts/victory-aftermath/

    The Problem:

    To change "voices" with Moby's script, I must set Variable 5 between 1-7 before each message. However, during the Actor's text in Yanfly's Victory Aftermath, there is no way to change their "voices" before their text!

    I've spent the better part of two hours tinkering (with my shamefully limited programming knowledge) to have Yanfly's script "recognize" the actor it's pulling quotes from and auto-assign the proper value in Variable 5...to no success. 

    Out of desperation, I then spent more time trying to add various notes in the Actor's note sections attached to the after-battle quotes that are referenced by Yanfly's script. I was hoping that I could somehow assign the correct Variable 5 value before each message like I do in a normal text event. I failed here as well.

    My Questions:

    - IS there a way to set Variable values before the Actor's after-battle quotes in the Actor's note section? (My gut's telling me no...)

    - Does anyone have the skillset AND willingness to make an adjustment to Yanfly's script so I COULD assign the correct Variable 5 value for the after-battle dialogue...somehow?

    - Does anyone have an ingenious third, fourth or fifth solution?

    I am sorry to ask, but I have hit a brick wall, and might have to scrap the idea of having multiple "voices"...which makes me all sorts of the sad. :(  

    ~ RetroSoldier

    EDIT: Totally meant Moby, not Mog. Just been looking at a lot of Mog scripts lately, so I got confused. Oops! 
     
     
    Last edited by a moderator: Jul 17, 2013
    #1
  2. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    I'm not sure at the moment how to solve your problem (and am currently on a deadline, so I won't have the time for over a week), but the text SE is not by Mog (Short for Moghunter). The post and script clearly say moby, not mog. Make sure you fix that in your credits!
     
    #2
    RetroSoldier likes this.
  3. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    ARGH! I totally blew it! It even says Moby in my script page! Edited my post to reflect the true creator. (If an admin could change the title and tag to reflect that, I'd be full of grates!)

    Thanks for the correction, and double thanks for the interest in the problem. I'll be trying to fix it here and there as well, and if I come up with a solution (see: a snowball's chance in HELL) I'll be sure to post it here. Until then, I have plenty of other things that I could work on in the game, so no rush! :)
     
    #3
  4. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    You can change the title by pressing the edit button on the original post, and going to the full editor.
     
    Last edited by a moderator: Jul 17, 2013
    #4
  5. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    Ah, there we go. Thanks again!
     
    #5
  6. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I don't have time to write or test something for you, but at a quick glance the key should be in the method self.set_victory_text.

    There you get te actor giving the message at the bottom and how Yanfly uses the actor data to set the face, name and text.

    At the beginning of that method you need a case-structure to identify the actor and then set any game variables to the numbers you want depending on the actor.
     
    #6
    RetroSoldier likes this.
  7. Celianna

    Celianna Tileset artist Global Mod

    Messages:
    10,514
    Likes Received:
    5,509
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    I've moved this thread to script support. Please be sure to post your threads in the correct forum next time. Thank you.
     
    #7
  8. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    I see that now. I'll have to think about this, but I think I now have a snowball's chance in Florida. ;)

    Of course, I'm still hoping that someone else that's more knowledgeable with scripting will tackle this eventually. I'm just not sure I want to invest even more large pools of time to this one feature, instead of working on others. Then again, I love me some clicky-clack language...

    (And sorry about the wrong forum thing, I was unsure where to put it. I'll be much more careful in the future.)

    EDIT: Well, I got variable 5 to somehow turn itself off during after-battle dialogue, but I can't seem to change the value of the variable itself. So I know I'm affecting variable 5, just not in the way I want to. I guess I'll reverse engineer these scripts some more later.
     
    Last edited by a moderator: Jul 17, 2013
    #8
  9. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    Here, it's completely untested, but if Yanfly's selected Actor's id is 1, 2, 3, 4, 5, 6, or 7, it will set variable 5 to the id. May entirely break everything, may not, who knows?

    module BattleManager if $imported["YEA-VictoryAftermath"] == true class << self alias zale_YEA_victory_text_fy68ej9012 set_victor_text end def self.set_victory_test(actor, type) case actor.id when 1..7 $game_variables[5] = actor.id end zale_YEA_victory_text_fy68ej9012(actor, type) end endendJust put this in a new script below Yanfly's scripts.
     
    Last edited by a moderator: Jul 17, 2013
    #9
  10. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    Thanks for giving it a shot! A few notes...

    - The game wouldn't boot initially because it didn't recognize "set_victor_text". After changing it to "set_victory_text" it would boot.

    - I would get to the aftermath screen, but the previously activated "voice" (voice 6) didn't change to voice 1 as it should have, it stayed the same.

    - I tried playing around with your script (changing player ids, some phrasings of things) and couldn't get any change to variable 5. 

    While I would welcome any form of variable 5 editing for the after-battle quotes, I think I should explain my idea a bit more.

    I saw that you were trying to get actors 1-7 to have "voices" 1-7. That could work, but I was aiming for something a little different with this game.

    I have the 7 "voices" set up as different archetypes (system voice, average male voice, deep female voice, demonic voice, etc.) and was hoping to somehow "tie" an archetype to a specific actor for this aftermath screen.

    Example: Actor 1,3,4 would have "voice" 2 and Actor 2 would have "voice" 3.

    That's why I was playing around with the notes feature in the actor page. Trying to get the script to read an integer I would put in the notes section right after <win quotes>, <level quotes> and <drop quotes>. Seeing how Yanfly's script chooses quotes randomly from these three sections, I thought it best to somehow have it check the desired "voice" for the random quote before it pulled up the actual quote. I hope that makes sense. 

    That's enough tinkering with scripts for me today. I have learned A LOT in these past 24 hours. Need to give my brain a rest, haha. (I know I probably should be working on other things for the RPG, but I keep coming back to this for some reason!) 
     
    Last edited by a moderator: Jul 17, 2013
    #10
  11. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    Ehh, I wrote it really quickly. I've made an enormous amount of typos today.

    After the battle, have you tried checking if variable 5 changed later, maybe after the voice script checked it?

    Would they always have the same voice, no matter what occasion? If so I could add that really quickly...

    class Game_Actor < Game_Character attr_accessor :voice alias zale_actor_init_587vgnmdi3 initialize def initialize(id) case id when 1..3 @voice = 2 when 4 @voice = 6 when 5...8 @voice = 1 else @voice = 7 end zale_actor_init_587vgnmdi3(id) endendHere, try there. With that, each actor should have an accessor for voice, so you can use $game_party.leader.voice (the voice id for the party leader), or something like that. Again, untested, may or may not cause yourself a terrible fate. To set up each actor, I just made a case statement. 1..3 means 1, 2, and 3, 4 means 4, 5...8 means 5, 6, and 7. If you didn't catch on, a range (numbers with dots in the middle) with 2 dots is inclusive, it'll go from the lower up to and including the higher. ranges with three dots will go from the lower until the higher, but not including. Set your actors up however you want.

    Putting it in the notetag would require you to rewrite part of Yanfly's script, though it may work.
     
    #11
    RetroSoldier likes this.
  12. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I remember another discussion where the ID-part of actor.id didn't work (that was in damage formulas if I remember correctly) - it seems that in some areas of the game scripts or under some conditions, that variable is not accessible or not set.

    Do your actors have fixed names? if yes, then try the code with case actor.name and when "name", perhaps that will work.

    and just FYI:

    Noteboxes are NOT programming areas, they are used by some scripters as a convenient data transfer area. If the scripter doesn't check for a specific entry, then that entry gets ignored. Which means that you cannot add anything there that is not checked by a script, and that's why you need to change the scripts before any input placed there can have an effect on the game.
     
    #12
  13. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    Yes, sir. Sadly, no change to variable 5, whatsoever...vanilla script or when I was tweaking it.

    Yes. I'll give you the lo-down of the actors and their appropriate voice values.

    001:Eric | 2

    002:Ryoma | 3

    003:Ernest | 2

    004:Terence | 2

    005:Isabelle | 4

    006:Alice | 4

    007:Noah | 3

    Unfortunately, I don't know what that means. Rather, I don't know where in the script, or which script, I could specify the actor.

    This is currently what I have...

    And the game won't boot due to there being a "superclass mismatch for class Game_Actor". Sounds like it's having trouble associating this particular Game_Actor class with what you want it to be doing in the script...? I mean, if it's "mismatching" doesn't that mean it already exists and I have to use a different class name?

    So, then I tried Andar's suggestion of replacing the class with "actor.name" and specifying the names. My script then looked like this...

    But the game still wouldn't boot. Instead, I just got a new error message. 

    The more I think about it, the more I think this is the way to go. I don't speak the language (Ruby), but the logic behind the process seems sound. 

    Andar does confirm what I suspected, that you can't use the noteboxes as a programming area proper. This is primarily why when I tinker, it's with Yanfly's script, so it can check for a specific entry. (In this case the appropriate value of variable 5).  

    From what I can gather, I think the relevant lines of Yanfly's Victory Aftermath script are going to be these:

    Lines 210-225 seem to be establishing *how* to read what's in the notebox section. (I don't think it's specifying the Actor's notebox here though...)

    Lines 270-294 seem to be the script checking the appropriate place to find said noteboxes.

    And lines 300-359 look like it's setting up the different quotes as variables to randomize them, then showing what to display (the text between parenthesis in the notebox).

    .  

    Maybe it's possible to tell the script to check the notebox section for a new number under a new section (ex: <voice></voice>), but instead of just displaying it as text, it makes variable 5 that value...?

    As a side note, I left a comment on Yanfly's Victory Aftermath wordpress in hopes that he'll take notice. Probably not...but, hey, you never know. ;)  

    http://yanflychannel.wordpress.com/rmvxa/battle-scripts/victory-aftermath/#comment-14122
     
    Last edited by a moderator: Jul 18, 2013
    #13
  14. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    That's because I didn't ask you to replace the class name, but ONLY the id in the line case id with case actor.name, and later the when statements with a check for strings instead of numbers.

    please change it back to class Game_Actor, and also add the string symbols into the when lines.

    It has to be when 'Eric' instead of when Eric
     
    #14
  15. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    My bad, I read "case" as "class" for whatever reason. 

    And I really don't know what the string symbol is, and barring that, I wouldn't even know where to add it it in the when lines. I'm sorry if my knowledge is lacking in this area, but I am new to scripting.

    So, the best I could do was this...

     

     
    Which, got rid of the errors and the game would run. However, it still didn't affect any change with the voices. 

    - Does 'voice' need to be 'game_variables[5]' or something? It seems weird that the script would know what 'voice' means.
    - Should 'id' by def initialize also be changed to 'name', because I changed the case to 'actor.name'?

    EDIT:
    Nearly forgot! How could I change this script to reflect that I want the 'else' to be 'leave the value alone' as opposed to forcing it to 7? I feel like that could be a problem for anything else that isn't an Actor (signs, messages, NPCs, etc.).
     
     
    Last edited by a moderator: Jul 18, 2013
    #15
  16. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    1) You can try changing @voice to $game_variables[5] - that is one part where I can't say how the scripts work, so you better use the variable for transfer.

    Creating a new variable wouldn't cause an error - this is not a compiler (which could check wether a variable is unused or not) but an interpreter (which simply works its way along code without checking for integrity).

    2) I'm not sure because that depends on the context of those scripts.

    When checking for the syntax I saw that the snippets above are mixing different approaches, and my solution was intended for the sequence before set_victory_text, but some of the other options above create a new value for the actor data.

    That are two entirely different approaches, and it might be that we've mixed up the solutions...

    Can you please post the entire current version of the script (spoiler and code tags please), so that we can check the current status wether it's mixed up or not?

    Sorry - there might have been one misunderstanding too many above (like case/class), and we better check for that before mixing everything up even more.
     
    #16
  17. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    Okay, this is what I have currently.

    Keep in mind, the game does function under these settings, but no variable is changed.

    EDIT: I have to make multiple posts, as I can't fit all three scripts in one, sorry.


    Zalerinian Custom Script



    class Game_actor < Game_Character attr_accessor :game_variables[5]

     

     alias zale_actor_init_587vgnmdi3 initialize

     def initialize(name)

       case actor.name

         when 'Eric'

           @game_variables = 2

         when 'Ryoma'

           @game_variables = 3

         when 'Ernest'

           @game_variables = 2

         when 'Terence'

           @game_variables = 2

         when 'Isabelle'

           @game_variables = 4

         when 'Alice'

           @game_variables = 4

         when 'Noah'

           @game_variables = 3

         else

           @game_variables = 7

       end

       zale_actor_init_587vgnmdi3(name)

     end

    end
     

    Moby's Script:



    ################################################################################# Made by mobychan, slightly edited by Bird Eater.

    # Give mobychan the cookies.

    # http://forums.rpgmakerweb.com/index.php?/topic/3463-mss-text-se/

    #

    #

    # INSTRUCTIONS:

    # Place above 'Main' in the scripts section but below 'Materials'.

    # Change things in module TSE to your liking to vary the sound, pitch and volume

    # of the SE played. These correspond with the value VARIABLE 5 has. Make sure

    # variable 5 has a value between 1 and 7. HAVE FUN.

    #

    # So if variable 5 is equal to 5,

    # SE5 will be played

    # Pitch5 will be used

    # With a volume of Volume5

    ################################################################################

    module TSE

    # The name of the file that will be played, must be placed in Audio/SE

    # CHANGE THESE TO ALTHER THE SOUND PLAYED DURING THE MESSAGE

    SE1 = "Cursor1"

    SE2 = "Cursor2"

    SE3 = "Cursor2"

    SE4 = "Cursor2"

    SE5 = "Cursor2"

    SE6 = "Item3"

    SE7 = "Stare"

    # The pitch range of the file being played, change them however you like

    # [start_pitch, end_pitch]

    # start and end pitch can be the same to have a static pitch

    # CHANGE THESE TO ALTER THE DIFFERENT PITCHES!

    Pitch1 = [140, 140]

    Pitch2 = [90, 97]

    Pitch3 = [70, 77]

    Pitch4 = [141, 149]

    Pitch5 = [105, 112]

    Pitch6 = [60, 60]

    Pitch7 = [55, 61]

    # The volume of the file being played

    Volume1 = 80

    Volume2 = 80

    Volume3 = 80

    Volume4 = 80

    Volume5 = 80

    Volume6 = 65

    Volume7 = 95

    # The interval at which the sound is being played, every x characters

    Interval = 5

    end

    #==============================================================================

    # ** Sound

    #==============================================================================

    module Sound

    # System Sound Effect

    def self.play_text_se

    #puts $game_variables[5]

    if $game_variables[5] == 1

    file = "Audio/SE/" + TSE::SE1

    pitch = rand(TSE::pitch1[1] - TSE::pitch1[0]) + TSE::pitch1[0]

    Audio.se_play(file, TSE::Volume1, pitch)

    elsif $game_variables[5] == 2

    file = "Audio/SE/" + TSE::SE2

    pitch = rand(TSE::pitch2[1] - TSE::pitch2[0]) + TSE::pitch2[0]

    Audio.se_play(file, TSE::Volume2, pitch)

    elsif $game_variables[5] == 3

    file = "Audio/SE/" + TSE::SE3

    pitch = rand(TSE::pitch3[1] - TSE::pitch3[0]) + TSE::pitch3[0]

    Audio.se_play(file, TSE::Volume3, pitch)

    elsif $game_variables[5] == 4

    file = "Audio/SE/" + TSE::SE4

    pitch = rand(TSE::pitch4[1] - TSE::pitch4[0]) + TSE::pitch4[0]

    Audio.se_play(file, TSE::Volume4, pitch)

    elsif $game_variables[5] == 5

    file = "Audio/SE/" + TSE::SE5

    pitch = rand(TSE::pitch5[1] - TSE::pitch5[0]) + TSE::pitch5[0]

    Audio.se_play(file, TSE::Volume5, pitch)

    elsif $game_variables[5] == 6

    file = "Audio/SE/" + TSE::SE6

    pitch = rand(TSE::pitch6[1] - TSE::pitch6[0]) + TSE::pitch6[0]

    Audio.se_play(file, TSE::Volume6, pitch)

    elsif $game_variables[5] == 7

    file = "Audio/SE/" + TSE::SE7

    pitch = rand(TSE::pitch7[1] - TSE::pitch7[0]) + TSE::pitch7[0]

    Audio.se_play(file, TSE::Volume7, pitch)

    else

    #puts "Your variable number 9 isn't 1-7, change it!"

    end

    end

    end

    #==============================================================================

    # ** Window_Message

    #==============================================================================

    class Window_Message < Window_Base

    #--------------------------------------------------------------------------

    # * Object Initialization

    #--------------------------------------------------------------------------

    alias tse_init initialize unless $@

    def initialize

    tse_init

    @character = 0

    end

    #--------------------------------------------------------------------------

    # * Normal Character Processing

    #--------------------------------------------------------------------------

    alias tse_process_normal_character process_normal_character unless $@

    def process_normal_character(c, pos)

    tse_process_normal_character(c, pos)

    Sound.play_text_se if @character % TSE::Interval == 0 && !@line_show_fast

    #p @character if @character % TSE::Interval == 0 && !@line_show_fast

    @character += 1

    end

    alias tse_process_new_page process_new_page unless $@

    #--------------------------------------------------------------------------

    # * New Page Character Processing

    #--------------------------------------------------------------------------

    def process_new_page(text, pos)

    tse_process_new_page(text, pos)

    @character = 0

    end

    end
     
    Last edited by a moderator: Jul 18, 2013
    #17
  18. RetroSoldier

    RetroSoldier Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    English
    Yanfly's Script

    #==============================================================================



    # ▼ Yanfly Engine Ace - Victory Aftermath v1.03

    # -- Last Updated: 2012.01.07

    # -- Level: Easy, Normal, Hard

    # -- Requires: n/a



    #==============================================================================

     

    $imported = {} if $imported.nil?

    $imported["YEA-VictoryAftermath"] = true

     

    #==============================================================================

    # ▼ Updates

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # 2012.01.07 - Compatibility Update: JP Manager

    # 2012.01.01 - Bug Fixed: Quote tags were mislabeled.

    # 2011.12.26 - Compatibility Update: Command Autobattle

    # 2011.12.16 - Started Script and Finished.



    #==============================================================================

    # ▼ Introduction

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # At the end of each battle, RPG Maker VX Ace by default shows text saying that

    # the party has gained so-and-so EXP while this person leveled up and your

    # party happened to find these drops. This script changes that text into

    # something more visual for your players to see. Active battle members will be

    # seen gaining EXP, any kind of level up changes, and a list of the items

    # obtained through drops.



    #==============================================================================

    # ▼ Instructions

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # To install this script, open up your script editor and copy/paste this script

    # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.



    # -----------------------------------------------------------------------------

    # Actor Notetags - These notetags go in the actors notebox in the database.

    # -----------------------------------------------------------------------------

    # <win quotes>

    #  string

    #  string

    # </win quotes>

    # Sets the win quote for the actor. The strings are continuous and can use

    # text codes. Use \n for a line break. Type in what you want the actor to say

    # for the particular win quote. Use [New Quote] in between the two tags to

    # start up a new quote.



    # <level quotes>

    #  string

    #  string

    # </level quotes>

    # Sets the level up quote for the actor. The strings are continuous and can use

    # text codes. Use \n for a line break. Type in what you want the actor to say

    # for the particular win quote. Use [New Quote] in between the two tags to

    # start up a new quote.



    # <drops quotes>

    #  string

    #  string

    # </drops quotes>

    # Sets the drops quote for the actor. The strings are continuous and can use

    # text codes. Use \n for a line break. Type in what you want the actor to say

    # for the particular win quote. Use [New Quote] in between the two tags to

    # start up a new quote.



    # -----------------------------------------------------------------------------

    # Class Notetags - These notetags go in the class notebox in the database.

    # -----------------------------------------------------------------------------

    # <win quotes>

    #  string

    #  string

    # </win quotes>

    # Sets the win quote for the class. The strings are continuous and can use

    # text codes. Use \n for a line break. Type in what you want the actor to say

    # for the particular win quote. Use [New Quote] in between the two tags to

    # start up a new quote.



    # <level quotes>

    #  string

    #  string

    # </level quotes>

    # Sets the level up quote for the class. The strings are continuous and can use

    # text codes. Use \n for a line break. Type in what you want the actor to say

    # for the particular win quote. Use [New Quote] in between the two tags to

    # start up a new quote.



    # <drops quotes>

    #  string

    #  string

    # </drops quotes>

    # Sets the drops quote for the class. The strings are continuous and can use

    # text codes. Use \n for a line break. Type in what you want the actor to say

    # for the particular win quote. Use [New Quote] in between the two tags to

    # start up a new quote.



    #==============================================================================

    # ▼ Compatibility

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that

    # it will run with RPG Maker VX without adjusting.



    #==============================================================================

     

    module YEA

      module VICTORY_AFTERMATH

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - General Settings -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # These are various settings that are used throughout the Victory Aftermath

        # portion of a battle. Adjust them as you see fit.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        VICTORY_BGM  = RPG::BGM.new("Field1", 100, 110)    # Victory BGM

        VICTORY_TICK = RPG::SE.new("Decision1", 80, 150)  # EXP ticking SFX

        LEVEL_SOUND  = RPG::SE.new("Up4", 75, 150)         # Level Up SFX

        SKILLS_TEXT  = "New Skills"                        # New skills text title.

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Important Settings -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # These are some important settings so please set them up properly. This

        # section includes a switch that allows you to skip the victory aftermath

        # phase (for those back to back battles and making them seamless) and it

        # also allows you to declare a common event to run after each battle. If

        # you do not wish to use either of these features, set them to 0. The

        # common event will run regardless of win or escape.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        SKIP_AFTERMATH_SWITCH  = 0  # If switch on, skip aftermath. 0 to disable.

        SKIP_MUSIC_SWITCH      = 0  # If switch on, skip music. 0 to disable.

        AFTERMATH_COMMON_EVENT = 0  # Runs common event after battle. 0 to disable.

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Top Text Settings -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Here, you can adjust the various text that appears in the window that

        # appears at the top of the screen.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        TOP_TEAM         = "%s's team"           # Team name used.

        TOP_VICTORY_TEXT = "%s is victorious!"   # Text used to display victory.

        TOP_LEVEL_UP     = "%s has leveled up!"  # Text used to display level up.

        TOP_SPOILS       = "Finds!"     # Text used for spoils.

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - EXP Gauge Settings -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Adjust how the EXP Gauge appears for the Victory Aftermath here. This

        # includes the text display, the font size, the colour of the gauges, and

        # more. Adjust it all here.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        VICTORY_EXP  = "+%sEXP"      # Text used to display EXP.

        EXP_PERCENT  = "%1.2f%%"     # The way EXP percentage will be displayed.

        LEVELUP_TEXT = "Level Up!"   # Text to replace percentage when leveled.

        MAX_LVL_TEXT = "Level MAX!"   # Text to replace percentage when max level.

        FONTSIZE_EXP = 20            # Font size used for EXP.

        EXP_TICKS    = 15            # Ticks to full EXP

        EXP_GAUGE1   = 12            # "Window" skin text colour for gauge.

        EXP_GAUGE2   = 4             # "Window" skin text colour for gauge.

        LEVEL_GAUGE1 = 13            # "Window" skin text colour for leveling.

        LEVEL_GAUGE2 = 5             # "Window" skin text colour for leveling.

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Victory Messages -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # In the Victory Aftermath, actors can say unique things. This is the pool

        # of quotes used for actors without any custom victory quotes. Note that

        # actors with custom quotes will take priority over classes with custom

        # quotes, which will take priority over these default quotes. Use \n for

        # a line break in the quotes.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        HEADER_TEXT = "\e>\eC[6]%s\eC[0]\e<\n"  # Always at start of messages.

        FOOTER_TEXT = ""                        # Always at end of messages.

        

        # Win Quotes are what the actors say when a battle is won.

        VICTORY_QUOTES ={

        # :type   => Quotes

          #------------------------------------------------------------------------

          :win    => [ # Occurs as initial victory quote.

                       '"We won! What an exciting fight!"',

                       '"I didn\'t even break a sweat."',

                       '"That wasn\'t so tough."',

                       '"Let\'s fight something harder!"',

                     ],# Do not remove this.

          #------------------------------------------------------------------------

          :level  => [ # Occurs as initial victory quote.

                       '"Yes! Level up!"',

                       '"I\'ve gotten stronger!"',

                       '"Try to keep up with me!"',

                       '"I\'ve grown again!"',

                     ],# Do not remove this.

          #------------------------------------------------------------------------

          :drops  => [ # Occurs as initial victory quote.

                       '"I\'ll be taking these."',

                       '"To the victor goes the spoils."',

                       '"The enemies dropped something!"',

                       '"Hey, what\'s this?"',

                     ],# Do not remove this.

          #------------------------------------------------------------------------

        } # Do not remove this.

        

      end # VICTORY_AFTERMATH

    end # YEA

     

    #==============================================================================

    # ▼ Editting anything past this point may potentially result in causing

    # computer damage, incontinence, explosion of user's head, coma, death, and/or

    # halitosis so edit at your own risk.

    #==============================================================================

     

    module YEA

      module REGEXP

      module BASEITEM

        

        NEW_QUOTE = /\[(?:NEW_QUOTE|new quote)\]/i

        

        WIN_QUOTE_ON    = /<(?:WIN_QUOTES|win quote|win quotes)>/i

        WIN_QUOTE_OFF   = /<\/(?:WIN_QUOTES|win quote|win quotes)>/i

        LEVEL_QUOTE_ON  = /<(?:LEVEL_QUOTES|level quote|level quotes)>/i

        LEVEL_QUOTE_OFF = /<\/(?:LEVEL_QUOTES|level quote|level quotes)>/i

        DROPS_QUOTE_ON  = /<(?:DROPS_QUOTES|drops quote|drops quotes)>/i

        DROPS_QUOTE_OFF = /<\/(?:DROPS_QUOTES|drops quote|drops quotes)>/i

        

      end # BASEITEM

      end # REGEXP

    end # YEA

     

    #==============================================================================

    # ■ Switch

    #==============================================================================

     

    module Switch

      

      #--------------------------------------------------------------------------

      # self.skip_aftermath

      #--------------------------------------------------------------------------

      def self.skip_aftermath

        return false if YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH <= 0

        return $game_switches[YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH]

      end

      

      #--------------------------------------------------------------------------

      # self.skip_aftermath_music

      #--------------------------------------------------------------------------

      def self.skip_aftermath_music

        return false if YEA::VICTORY_AFTERMATH::SKIP_MUSIC_SWITCH <=0

        return $game_switches[YEA::VICTORY_AFTERMATH::SKIP_MUSIC_SWITCH]

      end

        

    end # Switch

     

    #==============================================================================

    # ■ Numeric

    #==============================================================================

     

    class Numeric

      

      #--------------------------------------------------------------------------

      # new method: group_digits

      #--------------------------------------------------------------------------

      unless $imported["YEA-CoreEngine"]

      def group; return self.to_s; end

      end # $imported["YEA-CoreEngine"]

        

    end # Numeric

     

    #==============================================================================

    # ■ DataManager

    #==============================================================================

     

    module DataManager

      

      #--------------------------------------------------------------------------

      # alias method: load_database

      #--------------------------------------------------------------------------

      class <<self; alias load_database_va load_database; end

      def self.load_database

        load_database_va

        load_notetags_va

      end

      

      #--------------------------------------------------------------------------

      # new method: load_notetags_va

      #--------------------------------------------------------------------------

      def self.load_notetags_va

        groups = [$data_actors, $data_classes]

        for group in groups

          for obj in group

            next if obj.nil?

            obj.load_notetags_va

          end

        end

      end

      

    end # DataManager

     

    #==============================================================================

    # ■ RPG::BaseItem

    #==============================================================================

     

    class RPG::BaseItem

      

      #--------------------------------------------------------------------------

      # public instance variables

      #--------------------------------------------------------------------------

      attr_accessor :win_quotes

      attr_accessor :level_quotes

      attr_accessor :drops_quotes

      

      #--------------------------------------------------------------------------

      # common cache: load_notetags_va

      #--------------------------------------------------------------------------

      def load_notetags_va

        @win_quotes = [""]

        @level_quotes = [""]

        @drops_quotes = [""]

        @victory_quote_type = nil

        #---

        self.note.split(/[\r\n]+/).each { |line|

          case line

          #---

          when YEA::REGEXP::BASEITEM::WIN_QUOTE_ON

            @victory_quote_type = :win_quote

          when YEA::REGEXP::BASEITEM::WIN_QUOTE_OFF

            @victory_quote_type = nil

          when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_ON

            @victory_quote_type = :level_quote

          when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_OFF

            @victory_quote_type = nil

          when YEA::REGEXP::BASEITEM::DROPS_QUOTE_ON

            @victory_quote_type = :drops_quote

          when YEA::REGEXP::BASEITEM::DROPS_QUOTE_OFF

            @victory_quote_type = nil

          #---

          when YEA::REGEXP::BASEITEM::NEW_QUOTE

            case @victory_quote_type

            when nil; next

            when :win_quote;   @win_quotes.push("")

            when :level_quote; @level_quotes.push("")

            when :drops_quote; @drops_quotes.push("")

            end

          #---

          else

            case @victory_quote_type

            when nil; next

            when :win_quote;   @win_quotes[@win_quotes.size-1] += line.to_s.gsub(/\\[Nn]/, "\n")

            when :level_quote; @level_quotes[@level_quotes.size-1] += line.to_s.gsub(/\\[Nn]/, "\n")

            when :drops_quote; @drops_quotes[@drops_quotes.size-1] += line.to_s.gsub(/\\[Nn]/, "\n")

            end

          end

        } # self.note.split

        #---

        return unless self.is_a?(RPG::Class)

        quotes = YEA::VICTORY_AFTERMATH::VICTORY_QUOTES

        @win_quotes = quotes[:win].clone if @win_quotes == [""]

        @level_quotes = quotes[:level].clone if @level_quotes == [""]

        @drops_quotes = quotes[:drops].clone if @drops_quotes == [""]

      end

      

    end # RPG::BaseItem

     

    #==============================================================================

    # ■ BattleManager

    #==============================================================================

     

    module BattleManager

      

      #--------------------------------------------------------------------------

      # overwrite method: self.process_victory

      #--------------------------------------------------------------------------

      def self.process_victory

        if $imported["YEA-CommandAutobattle"]

          SceneManager.scene.close_disable_autobattle_window

        end

        return skip_aftermath if Switch.skip_aftermath

        play_battle_end_me

        gain_jp if $imported["YEA-JPManager"]

        display_exp

        gain_exp

        gain_gold

        gain_drop_items

        close_windows

        SceneManager.return

        replay_bgm_and_bgs

        battle_end(0)

        return true

      end

      

      #--------------------------------------------------------------------------

      # new method: self.skip_aftermath

      #--------------------------------------------------------------------------

      def self.skip_aftermath

        $game_party.all_members.each do |actor|

          actor.gain_exp($game_troop.exp_total)

        end

        $game_party.gain_gold($game_troop.gold_total)

        $game_troop.make_drop_items.each do |item|

          $game_party.gain_item(item, 1)

        end

        close_windows

        SceneManager.return

        replay_bgm_and_bgs

        battle_end(0)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: self.play_battle_end_me

      #--------------------------------------------------------------------------

      def self.play_battle_end_me

        return if Switch.skip_aftermath_music

        $game_system.battle_end_me.play

        YEA::VICTORY_AFTERMATH::VICTORY_BGM.play

      end

      

      #--------------------------------------------------------------------------

      # new method: self.set_victory_text

      #--------------------------------------------------------------------------

      def self.set_victory_text(actor, type)

        text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)

        text += actor.victory_quotes(type)[rand(actor.victory_quotes(type).size)]

        text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT

        $game_message.face_name = actor.face_name

        $game_message.face_index = actor.face_index

        $game_message.add(text)

        wait_for_message

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: self.display_exp

      #--------------------------------------------------------------------------

      def self.display_exp

        SceneManager.scene.show_victory_display_exp

        actor = $game_party.random_target

        @victory_actor = actor

        set_victory_text(@victory_actor, :win)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: self.gain_exp

      #--------------------------------------------------------------------------

      def self.gain_exp

        $game_party.all_members.each do |actor|

          temp_actor = Marshal.load(Marshal.dump(actor))

          actor.gain_exp($game_troop.exp_total)

          next if actor.level == temp_actor.level

          SceneManager.scene.show_victory_level_up(actor, temp_actor)

          set_victory_text(actor, :level)

          wait_for_message

        end

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: self.gain_gold

      #--------------------------------------------------------------------------

      def self.gain_gold

        $game_party.gain_gold($game_troop.gold_total)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: self.gain_drop_items

      #--------------------------------------------------------------------------

      def self.gain_drop_items

        drops = []

        $game_troop.make_drop_items.each do |item|

          $game_party.gain_item(item, 1)

          drops.push(item)

        end

        SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)

        set_victory_text(@victory_actor, :drops)

        wait_for_message

      end

      

      #--------------------------------------------------------------------------

      # new method: self.close_windows

      #--------------------------------------------------------------------------

      def self.close_windows

        SceneManager.scene.close_victory_windows

      end

      

      #--------------------------------------------------------------------------

      # alias method: load_database

      #--------------------------------------------------------------------------

      class <<self; alias battle_end_va battle_end; end

      def self.battle_end(result)

        battle_end_va(result)

        return if result == 2

        return if YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT <= 0

        event_id = YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT

        $game_temp.reserve_common_event(event_id)

      end

      

    end # BattleManager

     

    #==============================================================================

    # ■ Game_Actor

    #==============================================================================

     

    class Game_Actor < Game_Battler

      

      #--------------------------------------------------------------------------

      # overwrite method: gain_exp

      #--------------------------------------------------------------------------

      def gain_exp(exp)

        enabled = !SceneManager.scene_is?(Scene_Battle)

        change_exp(self.exp + (exp * final_exp_rate).to_i, enabled)

      end

      

      #--------------------------------------------------------------------------

      # new method: victory_quotes

      #--------------------------------------------------------------------------

      def victory_quotes(type)

        case type

        when :win

          return self.actor.win_quotes if self.actor.win_quotes != [""]

          return self.class.win_quotes

        when :level

          return self.actor.level_quotes if self.actor.level_quotes != [""]

          return self.class.level_quotes

        when :drops

          return self.actor.drops_quotes if self.actor.drops_quotes != [""]

          return self.class.drops_quotes

        else

          return ["NOTEXT"]

        end

      end

      

    end # Game_Actor

     

    #==============================================================================

    # ■ Window_VictoryTitle

    #==============================================================================

     

    class Window_VictoryTitle < Window_Base

      

      #--------------------------------------------------------------------------

      # initialize

      #--------------------------------------------------------------------------

      def initialize

        super(0, 0, Graphics.width, fitting_height(1))

        self.z = 200

        self.openness = 0

      end

      

      #--------------------------------------------------------------------------

      # refresh

      #--------------------------------------------------------------------------

      def refresh(message = "")

        contents.clear

        draw_text(0, 0, contents.width, line_height, message, 1)

      end

      

    end # Window_VictoryTitle

     

    #==============================================================================

    # ■ Window_VictoryEXP_Back

    #==============================================================================

     

    class Window_VictoryEXP_Back < Window_Selectable

      

      #--------------------------------------------------------------------------

      # initialize

      #--------------------------------------------------------------------------

      def initialize

        super(0, fitting_height(1), Graphics.width, window_height)

        self.z = 200

        self.openness = 0

      end

      

      #--------------------------------------------------------------------------

      # window_height

      #--------------------------------------------------------------------------

      def window_height

        return Graphics.height - fitting_height(4) - fitting_height(1)

      end

      

      #--------------------------------------------------------------------------

      # col_max

      #--------------------------------------------------------------------------

      def col_max; return item_max; end

      

      #--------------------------------------------------------------------------

      # spacing

      #--------------------------------------------------------------------------

      def spacing; return 8; end

      

      #--------------------------------------------------------------------------

      # item_max

      #--------------------------------------------------------------------------

      def item_max; return $game_party.battle_members.size; end

      

      #--------------------------------------------------------------------------

      # open

      #--------------------------------------------------------------------------

      def open

        @exp_total = $game_troop.exp_total

        super

      end

      

      #--------------------------------------------------------------------------

      # item_rect

      #--------------------------------------------------------------------------

      def item_rect(index)

        rect = Rect.new

        rect.width = item_width

        rect.height = contents.height

        rect.x = index % col_max * (item_width + spacing)

        rect.y = index / col_max * item_height

        return rect

      end

      

      #--------------------------------------------------------------------------

      # draw_item

      #--------------------------------------------------------------------------

      def draw_item(index)

        actor = $game_party.battle_members[index]

        return if actor.nil?

        rect = item_rect(index)

        reset_font_settings

        draw_actor_name(actor, rect)

        draw_exp_gain(actor, rect)

        draw_jp_gain(actor, rect)

        draw_actor_face(actor, rect)

      end

      

      #--------------------------------------------------------------------------

      # draw_actor_name

      #--------------------------------------------------------------------------

      def draw_actor_name(actor, rect)

        name = actor.name

        draw_text(rect.x, rect.y+line_height, rect.width, line_height, name, 1)

      end

      

      #--------------------------------------------------------------------------

      # draw_actor_face

      #--------------------------------------------------------------------------

      def draw_actor_face(actor, rect)

        face_name = actor.face_name

        face_index = actor.face_index

        bitmap = Cache.face(face_name)

        rw = [rect.width, 96].min

        face_rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, rw, 96)

        rx = (rect.width - rw) / 2 + rect.x

        contents.blt(rx, rect.y + line_height * 2, bitmap, face_rect, 255)

      end

      

      #--------------------------------------------------------------------------

      # draw_exp_gain

      #--------------------------------------------------------------------------

      def draw_exp_gain(actor, rect)

        dw = rect.width - (rect.width - [rect.width, 96].min) / 2

        dy = rect.y + line_height * 3 + 96

        fmt = YEA::VICTORY_AFTERMATH::VICTORY_EXP

        text = sprintf(fmt, actor_exp_gain(actor).group)

        contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP

        change_color(power_up_color)

        draw_text(rect.x, dy, dw, line_height, text, 2)

      end

      

      #--------------------------------------------------------------------------

      # actor_exp_gain

      #--------------------------------------------------------------------------

      def actor_exp_gain(actor)

        n = @exp_total * actor.final_exp_rate

        return n.to_i

      end

      

      #--------------------------------------------------------------------------

      # draw_jp_gain

      #--------------------------------------------------------------------------

      def draw_jp_gain(actor, rect)

        return unless $imported["YEA-JPManager"]

        dw = rect.width - (rect.width - [rect.width, 96].min) / 2

        dy = rect.y + line_height * 4 + 96

        fmt = YEA::JP::VICTORY_AFTERMATH

        text = sprintf(fmt, actor_jp_gain(actor).group, Vocab::jp)

        contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP

        change_color(power_up_color)

        draw_text(rect.x, dy, dw, line_height, text, 2)

      end

      

      #--------------------------------------------------------------------------

      # actor_jp_gain

      #--------------------------------------------------------------------------

      def actor_jp_gain(actor)

        n = actor.battle_jp_earned

        if actor.exp + actor_exp_gain(actor) > actor.exp_for_level(actor.level + 1)

          n += YEA::JP::LEVEL_UP unless actor.max_level?

        end

        return n

      end

      

    end # Window_VictoryEXP_Back

     

    #==============================================================================

    # ■ Window_VictoryEXP_Front

    #==============================================================================

     

    class Window_VictoryEXP_Front < Window_VictoryEXP_Back

      

      #--------------------------------------------------------------------------

      # initialize

      #--------------------------------------------------------------------------

      def initialize

        super

        self.back_opacity = 0

        @ticks = 0

        @counter = 30

        contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP

      end

      

      #--------------------------------------------------------------------------

      # update

      #--------------------------------------------------------------------------

      def update

        super

        update_tick

      end

      

      #--------------------------------------------------------------------------

      # update_tick

      #--------------------------------------------------------------------------

      def update_tick

        return unless self.openness >= 255

        return unless self.visible

        return if complete_ticks?

        @counter -= 1

        return unless @counter <= 0

        return if @ticks >= YEA::VICTORY_AFTERMATH::EXP_TICKS

        YEA::VICTORY_AFTERMATH::VICTORY_TICK.play

        @counter = 4

        @ticks += 1

        refresh

      end

      

      #--------------------------------------------------------------------------

      # complete_ticks?

      #--------------------------------------------------------------------------

      def complete_ticks?

        for actor in $game_party.battle_members

          total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS

          bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks

          now_exp = actor.exp - actor.current_level_exp + bonus_exp

          next_exp = actor.next_level_exp - actor.current_level_exp

          rate = now_exp * 1.0 / next_exp

          return false if rate < 1.0

        end

        return true

      end

      

      #--------------------------------------------------------------------------

      # draw_item

      #--------------------------------------------------------------------------

      def draw_item(index)

        actor = $game_party.battle_members[index]

        return if actor.nil?

        rect = item_rect(index)

        draw_actor_exp(actor, rect)

      end

      

      #--------------------------------------------------------------------------

      # exp_gauge1

      #--------------------------------------------------------------------------

      def exp_gauge1; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE1); end

      

      #--------------------------------------------------------------------------

      # exp_gauge2

      #--------------------------------------------------------------------------

      def exp_gauge2; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE2); end

      

      #--------------------------------------------------------------------------

      # lvl_gauge1

      #--------------------------------------------------------------------------

      def lvl_gauge1; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE1); end

      

      #--------------------------------------------------------------------------

      # lvl_gauge2

      #--------------------------------------------------------------------------

      def lvl_gauge2; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE2); end

      

      #--------------------------------------------------------------------------

      # draw_actor_exp

      #--------------------------------------------------------------------------

      def draw_actor_exp(actor, rect)

        if actor.max_level?

          draw_exp_gauge(actor, rect, 1.0)

          return

        end

        total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS

        bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks

        now_exp = actor.exp - actor.current_level_exp + bonus_exp

        next_exp = actor.next_level_exp - actor.current_level_exp

        rate = now_exp * 1.0 / next_exp

        draw_exp_gauge(actor, rect, rate)

      end

      

      #--------------------------------------------------------------------------

      # draw_exp_gauge

      #--------------------------------------------------------------------------

      def draw_exp_gauge(actor, rect, rate)

        rate = [[rate, 1.0].min, 0.0].max

        dx = (rect.width - [rect.width, 96].min) / 2 + rect.x

        dy = rect.y + line_height * 2 + 96

        dw = [rect.width, 96].min

        colour1 = rate >= 1.0 ? lvl_gauge1 : exp_gauge1

        colour2 = rate >= 1.0 ? lvl_gauge2 : exp_gauge2

        draw_gauge(dx, dy, dw, rate, colour1, colour2)

        fmt = YEA::VICTORY_AFTERMATH::EXP_PERCENT

        text = sprintf(fmt, [rate * 100, 100.00].min)

        if [rate * 100, 100.00].min == 100.00

          text = YEA::VICTORY_AFTERMATH::LEVELUP_TEXT

          text = YEA::VICTORY_AFTERMATH::MAX_LVL_TEXT if actor.max_level?

        end

        draw_text(dx, dy, dw, line_height, text, 1)

      end

      

    end # Window_VictoryEXP_Front

     

    #==============================================================================

    # ■ Window_VictoryLevelUp

    #==============================================================================

     

    class Window_VictoryLevelUp < Window_Base

      

      #--------------------------------------------------------------------------

      # initialize

      #--------------------------------------------------------------------------

      def initialize

        super(0, fitting_height(1), Graphics.width, window_height)

        self.z = 200

        hide

      end

      

      #--------------------------------------------------------------------------

      # window_height

      #--------------------------------------------------------------------------

      def window_height

        return Graphics.height - fitting_height(4) - fitting_height(1)

      end

      

      #--------------------------------------------------------------------------

      # refresh

      #--------------------------------------------------------------------------

      def refresh(actor, temp_actor)

        contents.clear

        reset_font_settings

        YEA::VICTORY_AFTERMATH::LEVEL_SOUND.play

        draw_actor_changes(actor, temp_actor)

      end

      

      #--------------------------------------------------------------------------

      # draw_actor_changes

      #--------------------------------------------------------------------------

      def draw_actor_changes(actor, temp_actor)

        dx = contents.width / 16

        draw_actor_image(actor, temp_actor, dx)

        draw_param_names(actor, dx)

        draw_former_stats(temp_actor)

        draw_arrows

        draw_newer_stats(actor, temp_actor)

        draw_new_skills(actor, temp_actor)

      end

      

      #--------------------------------------------------------------------------

      # draw_actor_image

      #--------------------------------------------------------------------------

      def draw_actor_image(actor, temp_actor, dx)

        draw_text(dx, line_height, 96, line_height, actor.name, 1)

        draw_actor_face(actor, dx, line_height * 2)

        exp = actor.exp - temp_actor.exp

        text = sprintf(YEA::VICTORY_AFTERMATH::VICTORY_EXP, exp.group)

        change_color(power_up_color)

        contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP

        draw_text(0, line_height * 2 + 96, dx + 96, line_height, text, 2)

        reset_font_settings

      end

      

      #--------------------------------------------------------------------------

      # draw_param_names

      #--------------------------------------------------------------------------

      def draw_param_names(actor, dx)

        dx += 108

        change_color(system_color)

        text = Vocab.level

        draw_text(dx, 0, contents.width - dx, line_height, text)

        dy = 0

        for i in 0...8

          dy += line_height

          text = Vocab.param(i)

          draw_text(dx, dy, contents.width - dx, line_height, text)

        end

      end

      

      #--------------------------------------------------------------------------

      # draw_former_stats

      #--------------------------------------------------------------------------

      def draw_former_stats(actor)

        dw = contents.width / 2 - 12

        dy = 0

        change_color(normal_color)

        draw_text(0, dy, dw, line_height, actor.level.group, 2)

        for i in 0...8

          dy += line_height

          draw_text(0, dy, dw, line_height, actor.param(i).group, 2)

        end

      end

      

      #--------------------------------------------------------------------------

      # draw_arrows

      #--------------------------------------------------------------------------

      def draw_arrows

        dx = contents.width / 2 - 12

        dy = 0

        change_color(system_color)

        for i in 0..8

          draw_text(dx, dy, 24, line_height, "→", 1)

          dy += line_height

        end

      end

      

      #--------------------------------------------------------------------------

      # draw_newer_stats

      #--------------------------------------------------------------------------

      def draw_newer_stats(actor, temp_actor)

        dx = contents.width / 2 + 12

        dw = contents.width - dx

        dy = 0

        change_color(param_change_color(actor.level - temp_actor.level))

        draw_text(dx, dy, dw, line_height, actor.level.group, 0)

        for i in 0...8

          dy += line_height

          change_color(param_change_color(actor.param(i) - temp_actor.param(i)))

          draw_text(dx, dy, dw, line_height, actor.param(i).group, 0)

        end

      end

      

      #--------------------------------------------------------------------------

      # draw_new_skills

      #--------------------------------------------------------------------------

      def draw_new_skills(actor, temp_actor)

        return if temp_actor.skills.size == actor.skills.size

        dw = 172 + 24

        dx = contents.width - dw

        change_color(system_color)

        text = YEA::VICTORY_AFTERMATH::SKILLS_TEXT

        draw_text(dx, 0, dw, line_height, text, 0)

      end

      

    end # Window_VictoryLevelUp

     

    #==============================================================================

    # ■ Window_VictorySkills

    #==============================================================================

     

    class Window_VictorySkills < Window_Selectable

      

      #--------------------------------------------------------------------------

      # initialize

      #--------------------------------------------------------------------------

      def initialize

        dy = fitting_height(1) + 24

        dw = 172 + 24 + 24

        dh = Graphics.height - fitting_height(4) - fitting_height(1) - 24

        super(Graphics.width - dw, dy, dw, dh)

        self.opacity = 0

        self.z = 200

        hide

      end

      

      #--------------------------------------------------------------------------

      # item_max

      #--------------------------------------------------------------------------

      def item_max; return @data.nil? ? 0 : @data.size; end

      

      #--------------------------------------------------------------------------

      # refresh

      #--------------------------------------------------------------------------

      def refresh(actor, temp_actor)

        contents.clear

        if actor.skills.size == temp_actor.skills.size

          unselect

          @data = []

          create_contents

          return

        end

        @data = actor.skills - temp_actor.skills

        if @data.size > 8

          select(0)

          activate

        else

          unselect

          deactivate

        end

        create_contents

        draw_all_items

      end

      

      #--------------------------------------------------------------------------

      # refresh

      #--------------------------------------------------------------------------

      def draw_item(index)

        rect = item_rect(index)

        skill = @data[index]

        return if skill.nil?

        rect.width -= 4

        draw_item_name(skill, rect.x, rect.y, true)

      end

      

    end # Window_VictorySkills

     

    #==============================================================================

    # ■ Window_VictorySpoils

    #==============================================================================

     

    class Window_VictorySpoils < Window_ItemList

      

      #--------------------------------------------------------------------------

      # initialize

      #--------------------------------------------------------------------------

      def initialize

        super(0, fitting_height(1), Graphics.width, window_height)

        self.z = 200

        hide

      end

      

      #--------------------------------------------------------------------------

      # window_height

      #--------------------------------------------------------------------------

      def window_height

        return Graphics.height - fitting_height(4) - fitting_height(1)

      end

      

      #--------------------------------------------------------------------------

      # spacing

      #--------------------------------------------------------------------------

      def spacing; return 32; end

      

      #--------------------------------------------------------------------------

      # make

      #--------------------------------------------------------------------------

      def make(gold, drops)

        @gold = gold

        @drops = drops

        refresh

        select(0)

        activate

      end

      

      #--------------------------------------------------------------------------

      # make_item_list

      #--------------------------------------------------------------------------

      def make_item_list

        @data = [nil]

        items = {}

        weapons = {}

        armours = {}

        @goods = {}

        for item in @drops

          case item

          when RPG::Item

            items[item] = 0 if items[item].nil?

            items[item] += 1

          when RPG::Weapon

            weapons[item] = 0 if weapons[item].nil?

            weapons[item] += 1

          when RPG::Armor

            armours[item] = 0 if armours[item].nil?

            armours[item] += 1

          end

        end

        items = items.sort { |a,b| a[0].id <=> b[0].id }

        weapons = weapons.sort { |a,b| a[0].id <=> b[0].id }

        armours = armours.sort { |a,b| a[0].id <=> b[0].id }

        for key in items; @goods[key[0]] = key[1]; @data.push(key[0]); end

        for key in weapons; @goods[key[0]] = key[1]; @data.push(key[0]); end

        for key in armours; @goods[key[0]] = key[1]; @data.push(key[0]); end

      end

      

      #--------------------------------------------------------------------------

      # draw_item

      #--------------------------------------------------------------------------

      def draw_item(index)

        item = @data[index]

        rect = item_rect(index)

        reset_font_settings

        if item.nil?

          draw_gold(rect)

          return

        end

        rect.width -= 4

        draw_item_name(item, rect.x, rect.y, true, rect.width - 24)

        draw_item_number(rect, item)

      end

      

      #--------------------------------------------------------------------------

      # draw_gold

      #--------------------------------------------------------------------------

      def draw_gold(rect)

        text = Vocab.currency_unit

        draw_currency_value(@gold, text, rect.x, rect.y, rect.width)

      end

      

      #--------------------------------------------------------------------------

      # draw_item_number

      #--------------------------------------------------------------------------

      def draw_item_number(rect, item)

        number = @goods[item].group

        if $imported["YEA-AdjustLimits"]

          contents.font.size = YEA::LIMIT::ITEM_FONT

          text = sprintf(YEA::LIMIT::ITEM_PREFIX, number)

          draw_text(rect, text, 2)

        else

          draw_text(rect, sprintf(":%s", number), 2)

        end

      end

      

    end # Window_VictorySpoils

     

    #==============================================================================

    # ■ Scene_Battle

    #==============================================================================

     

    class Scene_Battle < Scene_Base

      

      #--------------------------------------------------------------------------

      # alias method: create_all_windows

      #--------------------------------------------------------------------------

      alias scene_battle_create_all_windows_va create_all_windows

      def create_all_windows

        scene_battle_create_all_windows_va

        create_victory_aftermath_windows

      end

      

      #--------------------------------------------------------------------------

      # new method: create_victory_aftermath_windows

      #--------------------------------------------------------------------------

      def create_victory_aftermath_windows

        @victory_title_window = Window_VictoryTitle.new

        @victory_exp_window_back = Window_VictoryEXP_Back.new

        @victory_exp_window_front = Window_VictoryEXP_Front.new

        @victory_level_window = Window_VictoryLevelUp.new

        @victory_level_skills = Window_VictorySkills.new

        @victory_spoils_window = Window_VictorySpoils.new

      end

      

      #--------------------------------------------------------------------------

      # new method: show_victory_display_exp

      #--------------------------------------------------------------------------

      def show_victory_display_exp

        @victory_title_window.open

        name = $game_party.battle_members[0].name

        fmt = YEA::VICTORY_AFTERMATH::TOP_TEAM

        name = sprintf(fmt, name) if $game_party.battle_members.size > 1

        fmt = YEA::VICTORY_AFTERMATH::TOP_VICTORY_TEXT

        text = sprintf(fmt, name)

        @victory_title_window.refresh(text)

        #---

        @victory_exp_window_back.open

        @victory_exp_window_back.refresh

        @victory_exp_window_front.open

        @victory_exp_window_front.refresh

      end

      

      #--------------------------------------------------------------------------

      # new method: show_victory_level_up

      #--------------------------------------------------------------------------

      def show_victory_level_up(actor, temp_actor)

        @victory_exp_window_back.hide

        @victory_exp_window_front.hide

        #---

        fmt = YEA::VICTORY_AFTERMATH::TOP_LEVEL_UP

        text = sprintf(fmt, actor.name)

        @victory_title_window.refresh(text)

        #---

        @victory_level_window.show

        @victory_level_window.refresh(actor, temp_actor)

        @victory_level_skills.show

        @victory_level_skills.refresh(actor, temp_actor)

      end

      

      #--------------------------------------------------------------------------

      # new method: show_victory_spoils

      #--------------------------------------------------------------------------

      def show_victory_spoils(gold, drops)

        @victory_exp_window_back.hide

        @victory_exp_window_front.hide

        @victory_level_window.hide

        @victory_level_skills.hide

        #---

        text = YEA::VICTORY_AFTERMATH::TOP_SPOILS

        @victory_title_window.refresh(text)

        #---

        @victory_spoils_window.show

        @victory_spoils_window.make(gold, drops)

      end

      

      #--------------------------------------------------------------------------

      # new method: close_victory_windows

      #--------------------------------------------------------------------------

      def close_victory_windows

        @victory_title_window.close

        @victory_exp_window_back.close

        @victory_exp_window_front.close

        @victory_level_window.close

        @victory_level_skills.close

        @victory_spoils_window.close

        wait(16)

      end

      

    end # Scene_Battle

     

    #==============================================================================



    # ▼ End of File



    #==============================================================================
     
    #18
  19. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    class Game_actor < Game_Character attr_accessor :game_variables[5]

     

     alias zale_actor_init_587vgnmdi3 initialize

     def initialize(name)

       case actor.name

         when 'Eric'

           @game_variables = 2

         when 'Ryoma'

           @game_variables = 3

         when 'Ernest'

           @game_variables = 2

         when 'Terence'

           @game_variables = 2

         when 'Isabelle'

           @game_variables = 4

         when 'Alice'

           @game_variables = 4

         when 'Noah'

           @game_variables = 3

         else

           @game_variables = 7

       end

       zale_actor_init_587vgnmdi3(name)

     end

    end
    So. Ooops. My bad. I didn't actually look it up and guessed that Game_Actor < Game_Character. It's actually Game_Actor < Game_Battler, so try fixing that :x
     
    #19
  20. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    it can't change the variables, because @game_variables is NOT one of the game's general variables. I said you could try to change this to $game_variables[5] to see if that works.

    But without the array indicator [5] there is no variable to change. And it's also a difference wether you start that piece of code with @ or with $.

    And yes, there was a mixup - my variant of the code would have gone to another part of the script.

    But please test with Zalerinians correction of the class and the correction of $game_variables[5] first, perhaps that might work...
     
    #20

Share This Page