Custom Menu Script + Variable Display Script

● ARCHIVED · READ-ONLY
Started by Jocho 9 posts View original ↗
  1. Good morning! I'm working on a game to teach English to Japanese students. The game employs a "conversation battle system" which is more-or-less an event where the player is presented with a question or statement and has to choose the correct response from a list. Correct answers gain health and wrong answers lose health while prompting the question/statement again.

    The game has multiple party members that stay pretty consistent throughout the game: the main character Ichiro, his friend Sakura, and their talking, floating knows-every-language book. Only Ichiro's HP and stats matter in combat. The other two characters are just for show. If Ichiro loses all his HP, game over. 

    As for stats, the game has only 3 stats: HP, "Pride", and "Morale", the latter two being variables. Everything else is superfluous and edited out at present.  

    All of that is well and good, but I fear I'm looking for some scripts to spruce up the game:

    1) Custom Menu

    My current menu looks as such, employing an experience bar script (in which I edited out the MP bar as it's useless) and Yanfly's custom menu script that allows for different menu options (Area Info and World Map, here).
    Menu Screen.png
    What I'm looking for is a way to display the other stats (Pride and Morale, which are variables) as well as the other characters who are in your party. The below mock-up shows what I'm envisioning. For the stats, making them fit in with the HP and EXP bars is paramount. In regards to the follower characters, when a character leaves your party, having them not show up on the menu screen adds slightly more impact since the characters never physically follow the player around. 

    Ideal Menu Screen.png

    In addition, having it so that skills and items automatically open instead of having to select the single character would be ideal. None of the following party members have skills that need to be selected, and items can't be used on them.

    2) Variable Display

    My current battle menu looks rather like a normal screen, and that's because it is.

    Battle Screen.png

    In the game, players can acquire an item called a "scanner" which will tell them how much damage a wrong answer will inflict as well as, when upgraded, how many turns a battle will be. While I envision the scanner displaying data in the upper-right hand corner with a dimmed background like the HP bar presently, and activated by turning a switch on or off (so it can be turned off when not in battle), I'm very open to suggestions. I just want it to be easily visible while not taking up the lower part of the screen (as sometimes, player portraits appear there mid-battle to talk and such).

    View attachment 17160

    Thank you from the bottom of my heart in advance for anyone brave enough to take my request. If you'd like more info on the game, feel free to read this post (about halfway down) or this one from my blog or message me.
  2. From what I understood by reading, you won't have any other stats, just Pride and Morale, right?


    Then why not use real parameters for them instead of variables?


    Displaying them is easy enough, especially because you will have only one actor with these stats.


    Showing the followers there is simple too, just need to move down the default positions of the followers a bit and that's all. Do you want to show only the follower's face and name there or something else too?


    For the map variables, you could try out Napoleon's Variable Display script. That should do the trick.


    But I don't remember if it got any background displayed or not.


    I could set these up for you tomorrow if you still need it. Just to make sure, you use Yanfly's Menu Engine, right?
  3. Thanks for the response, Sixth!

    Yeah, I'm using Yanfly's Menu Engine. 

    I'll play around with Napoleon's Variable Display script. Not sure if it'll do what I'm wanting, but I'll see what I can do with it! :) Maybe learn some scripting in the process.

    As for why I'm using Pride and Morale as variables and not parameters? I simply wasn't sure how to set up those as parameters. Since you gain them through events, I didn't need them to increase with level or anything, and because I knew how to set it up through events (which is how my whole battle system works out), I figured I'd just do what I knew would work instead of messing with forces beyond my understanding. 

    About the followers: just a name and picture is needed. They have no stats to interact with. Having them smaller or distinct from the main character in some way would be good too. 

    Is it possible to have the "skills" and using items not require selecting a character?

    Thanks again for the help (and for the redirect to Napoleon's scripts (he has a lot of really good ones!))! 
  4. A few more questions:


    The game will have only 3 characters, from which 1 is the main player, and the other two is for conversations/story only, right?


    Are you planning on using any other character (even for just temporary for a short story-line)?


    If you won't plan on using any other characters, hard-coding the whole main menu is the easiest way.


    If you plan on having some other party members, I will need to code it dynamically, which would take a bit longer, but still easy to do.


    Also do you want the followers face and name exactly as your mock up picture shows? Or maybe lined up horizontally would be okay too?


    Or if you want, I can just make a whole bunch of options for you, so that you can define every position of everything as you want, and can change it anytime later by yourself? Like X and Y positions of texts, faces and gauges, width, height of face sizes, etc, basically anything you want can be included in the settings. This would be the easiest to do, to be honest. :D


    You can use normal stats instead of variables like this:


    1. Make the class stat curves so that it stays on 1 forever, from level 1 to level 99.


    This way, it won't increase on level up ever.


    2. Name your parameters how you like in the "Terms" section of the database.


    3. You can increase these parameters with the "Change Parameters" event command in the editor just like you would increase variables.


    4. You can check for the value of these parameters by using the "Conditional Branch" command with the "Script" option.


    $game_actors[1].param(2) >= 32, for example would return true if the player got 32 or more from the 2nd parameter. Param list starts with 0 (MHP by default) and goes in the same order as you see it in the "Change Parameter" command list.


    But displaying parameters there or variables doesn't really matter, so it's your choice.


    I'm going back to work now, but I will try to finish this today evening.


    Edit:


    Seems like I won't finish it today. And I won't be home till Friday, so unfortunately, you will have to wait. :(


    I already disabled the actor selecting for every scene.


    But I noticed that you removed the MP gauge from the main menu scene. I did that too, but left it for the other scenes, because I guess you will want it to show for the other menus, right?


    Variable display (or the first 2 parameters display, whichever you prefer, changeable) on the main menu is completed.


    The info shown on the followers is almost complete too. Needs a bit of a change in visuals to be prettier. :)


    And I encountered a bug which I created while removing the actor selection from every scene. Now you can use recovery items and recovery spells, even if the item/spell got no valid effects on the user (ex: using a "Heal" skill is possible even when the user got full HP). I plan to fix this, unless you want it to stay this way (which I doubt :D ).


    So, yeah, until Friday then!
  5. Thank you so much for all your help, Sixth! 

    I will probably have a short scene or two with other characters, so having the menu work dynamically would be better. 

    The mock up isn't set in stone. If you have another way, as long as it gives the pictures and names, it'll be great! And easier for you is better, I think. :p So yeah, giving me the options with X and Y and whatnot is fine. 

    As for the MP, I'm actually not using it for this game. All skills are MP-less.

    Can't wait to see what you've come up with. :)
  6. Ok, I just got home a few hours ago.


    I realized that I haven't put any screenshot of how it looks now.


    So, here is the current look:


    cprx1.PNG


    Nothing fancy, really.


    The settings are not made yet, all of this is hard-coded.


    That's what I will make next.


    If there is anything you want to add anywhere, just let me know.


    I suppose you won't use any class in the game, I mean, you won't display it anywhere, right?


    Because I want to center the HP/XP bar and the stat display in it's own little box to look ordered and a bit less chaotic.


    I also want to center the name and level display vertically, but for that I need to know if you plan to have any states displayed and if yes, can I move the state icons to a whole different position? Like, below the actor's face graphic?


    It is a bit late now here, so I will try to finish everything tomorrow.


    I know, I'm a bit slow, sorry. :(
  7. That's awesome! I like what you've done. You're right about how to display everything. I'm looking forward to how it looks with the name and level centered. 

    To answer your question: no states. Hope that makes things simpler. :)

    Thanks so much for doing this. And I'll actually be away for two days, so don't feel the need to rush to get it done. Slow and steady wins the race, right? :p

    Best of luck! 
  8. I guess I finished most of the things.

    Here are some screenshots:

    http://www.mediafire.com/view/wfx9e39j91t26if/cprx2-3f.PNG

    http://www.mediafire.com/view/qmuucyqcw6ggczv/cprx2-2f.PNG

    http://www.mediafire.com/view/2dd3mbmzdm7jo6y/cprx2-1f.PNG

    http://www.mediafire.com/view/ky3dj93r5p7aebm/cprx2-0f.PNG

    As you can see, the follower faces will change position automatically, depending on the party size, they will be always centered and lined up horizontally.

    Now, I have no idea what to do with the empty space between the player info and the follower info.

    I suppose you can just put a picture logo there with the name of your game or something with a background script. I wanted to add a picture option myself too, but I just can't figure out how to dispose any sprites properly in any scene, so I just passed on that one, sorry.

    I also have no idea what to do with the "Followers" text and line when there are no followers yet. It feels a bit empty looking at all the space there then.

    I am waiting for some suggestions/requests to do something with these empty places, so if you want to show anything there, just tell me.

    I could try to make some kind of help text display there, so it shows different text when you move the cursor on the main menu scene if you want.

    The player info has been changed, made the gauges longer, re-positioned some info (actor name, level).

    You can change the Y position of the player info and follower info however you want at the settings.

    You can change the color of the boxes, borders, the divider line and XP gauge.

    You can choose what to display, parameters or variables, and you can choose which variables/parameters to use and what text to display for them.

    You can change the "Followers" text above the divider line, you can change "XP" text on the XP gauge too.

    Some notes:

    If you have more than 4 party members, an ugly little arrow will show up at the bottom of the info window. To avoid that, try to not get more than 4 party members at once. You wrote that you won't have more than 3 main characters (1 hero and 2 companions) and some occasional guests, so I can only hope that you will have max 3 followers. If not, let me know and I will try to fix it.

    Also, I haven't managed to fix the item/skill use issue, so it is still possible to use any recovery item/skill regardless if it has any effect on the actor or not. I'm hitting walls on this one. >.>

    You wrote that you won't have any MP in the game, so I can only hope that this won't bother you, because I wasted almost all my free time to try to fix this, and not in the mood to try another round of it.

    Well, here is the code if you want to test it:

    Spoiler
    module CustomMenu1 # <-- No touchy-touchy! #-------------------------------------------------------------------------------# Variable and Param Display Settings#-------------------------------------------------------------------------------# Set the displayed variables here and the text for them.#-------------------------------------------------------------------------------Variable_Display = true # Set this to true if you want to show variables instead # of parameters from the database as your stats. # The below settings will only works if 'Variable_Display' is set to true!Variable1 = 1 # 1st displayed variable (top one)Variable2 = 2 # 2nd displayed variable (bottom one)VariableText1 = "Pride" # Text displayed for the 1st variable (top one)VariableText2 = "Morale" # Text displayed for the 2nd variable (bottom one)# The below settings will only work if 'Variable_Display' is set to false!Param1 = 2 # The 1st displayed parameter's IDParam2 = 3 # The 2nd displayed parameter's ID# The text shown for the parameters can be setup in the database under the 'Terms'# tab at the 'Parameters' settings. The param IDs and their name by default are:# 0 - MaxHP, 1 - MaxMP, 2 - ATK, 3 - DEF, 4 - MAT, 5 - MDF, 6 - AGI, 7 - LUK#-------------------------------------------------------------------------------# Text Options#-------------------------------------------------------------------------------# Some text display options.#-------------------------------------------------------------------------------XPText = "XP" # Text shown on the XP barFollowerText = "Followers" # Text shown above the follower face display area#-------------------------------------------------------------------------------# XP Gauge Settings#-------------------------------------------------------------------------------# Set the colors of the XP gauge here.#-------------------------------------------------------------------------------XPGaugeColor1 = [ 70,200, 70,100] # Color for the left side of XP gaugeXPGaugeColor2 = [ 90,200, 90,250] # Color for the right side of XP gauge# [ R , G , B , A ]#-------------------------------------------------------------------------------# Vertical Position Settings#-------------------------------------------------------------------------------# Set the Y position of player and follower information here.#-------------------------------------------------------------------------------Y_Offset_P = 0 # The vertical offset for all the player information shownY_Offset_F = 60 # The vertical offset for all the follower information shown#-------------------------------------------------------------------------------# Color options of visuals#-------------------------------------------------------------------------------# Set the color options for various graphical things shown in the here.#-------------------------------------------------------------------------------DivLineColor1 = [220,220,220,250] # The upper color for the divider line (2px)DivLineColor2 = [ 60, 60, 60,250] # The lower color for the divider line (1px)# [ R , G , B , A ]PlayerBoxC1 = [ 60, 60, 60,120] # The color of the player info boxPlayerBoxC2 = [200,200, 40,250] # The color of the player info border# [ R , G , B , A ]FollowerBoxC1 = [ 60, 60, 60,120] # The color of the follower info boxesFollowerBoxC2 = [ 40,200, 40,250] # The color of the follower info borders# [ R , G , B , A ]end # <-- No touchy-touchy! #==============================================================================# ■ Window_Base#==============================================================================class Window_Base < Window #-------------------------------------------------------------------------- # * new method: exp_rate #-------------------------------------------------------------------------- def exp_rate(actor) @cur_exp = actor.exp - actor.current_level_exp @next_exp = actor.next_level_exp - actor.current_level_exp rate = @cur_exp * 1.0 / @next_exp rate = [[rate, 1.0].min, 0.0].max end #-------------------------------------------------------------------------- # * overwrite method: draw_actor_face #-------------------------------------------------------------------------- alias sixth_draw_face121 draw_actor_face def draw_actor_face(actor, x, y, enabled = true) if SceneManager.scene_is?(Scene_Menu) if actor.index == 0 yop = CustomMenu1::Y_Offset_P bx = 2 by = 2 + yop bw = contents.width - 4 bh = line_height * 5 + 6 color1 = Color.new(*CustomMenu1::playerBoxC2) contents.fill_rect(bx, by, bw, bh, color1) color = Color.new(*CustomMenu1::playerBoxC1) contents.fill_rect(bx + 2, by + 2, bw - 4, bh - 4, color) draw_face(actor.face_name, actor.face_index, x + 5, y + 5 + yop, enabled) elsif actor.index == 1 if $game_party.members.size == 2 x = contents.width/2 - 48 elsif $game_party.members.size == 3 x = contents.width/4 - 48 else x = contents.width/6 - 48 end y += CustomMenu1::Y_Offset_F color1 = Color.new(*CustomMenu1::FollowerBoxC2) contents.fill_rect(x - 4, y + 94, 104, 130, color1) color = Color.new(*CustomMenu1::FollowerBoxC1) contents.fill_rect(x - 2, y + 96, 100, 126, color) draw_face(actor.face_name, actor.face_index, x, y + 98, enabled) elsif actor.index == 2 if $game_party.members.size == 3 x = contents.width/4*3 - 48 else x = contents.width/6*3 - 48 end y += CustomMenu1::Y_Offset_F color1 = Color.new(*CustomMenu1::FollowerBoxC2) contents.fill_rect(x - 4, y - 4, 104, 130, color1) color = Color.new(*CustomMenu1::FollowerBoxC1) contents.fill_rect(x - 2, y - 2, 100, 126, color) draw_face(actor.face_name, actor.face_index, x, y, enabled) elsif actor.index == 3 y += CustomMenu1::Y_Offset_F x = contents.width/6*5 - 48 color1 = Color.new(*CustomMenu1::FollowerBoxC2) contents.fill_rect(x - 4, y - 102, 104, 130, color1) color = Color.new(*CustomMenu1::FollowerBoxC1) contents.fill_rect(x - 2, y - 100, 100, 126, color) draw_face(actor.face_name, actor.face_index, x, y - 98, enabled) else y += CustomMenu1::Y_Offset_F draw_face(actor.face_name, actor.face_index, x, y + 98, enabled) end else sixth_draw_face121(actor, x, y, enabled = true) end end #-------------------------------------------------------------------------- # * overwrite method: draw_current_and_max_values - Yanfly code! Anti-text shrink! #-------------------------------------------------------------------------- def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2) total = current.to_s + "/" + max.to_s if dw < text_size(total).width + text_size(Vocab.hp).width change_color(color1) draw_text(dx, dy, dw, line_height, current.to_s, 2) else xr = dx + text_size(Vocab.hp).width dw -= text_size(Vocab.hp).width change_color(color2) text = "/" + max.to_s draw_text(xr, dy, dw, line_height, text, 2) dw -= text_size(text).width change_color(color1) draw_text(xr, dy, dw, line_height, current.to_s, 2) end end #-------------------------------------------------------------------------- # overwrite method: draw_actor_simple_status #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, dx, dy) if actor.index == 0 dy -= line_height / 2 dx += 5 if SceneManager.scene_is?(Scene_Menu) dy += 5 if SceneManager.scene_is?(Scene_Menu) yop = 0 yop = CustomMenu1::Y_Offset_P if SceneManager.scene_is?(Scene_Menu) yo = CustomMenu1::Y_Offset_F draw_actor_name(actor, dx, dy + yop) draw_actor_icons(actor, 0, dy + line_height * 4 + 3 + yop) dw = contents.width - dx - 4 # 124 dw -= 5 if SceneManager.scene_is?(Scene_Menu) color1 = Color.new(*CustomMenu1::XPGaugeColor1) color2 = Color.new(*CustomMenu1::XPGaugeColor2) draw_gauge(dx, dy + line_height * 2 + yop, dw, exp_rate(actor), color1, color2) color1 = color2 = normal_color draw_current_and_max_values(dx, dy + line_height * 2 + yop, dw, @cur_exp, @next_exp, color1, color2) change_color(system_color) draw_text(dx, dy + yop, dw - 24, line_height, Vocab::level_a + " ", 2) draw_text(dx, dy + line_height * 2 + yop, dw, line_height, CustomMenu1::XPText) if CustomMenu1::Variable_Display == true draw_text(dx, dy + line_height * 3 + yop, dw, line_height, CustomMenu1::VariableText1) draw_text(dx, dy + line_height * 4 + yop, dw, line_height, CustomMenu1::VariableText2) else draw_text(dx, dy + line_height * 3 + yop, dw, line_height, Vocab::param(CustomMenu1::param1)) draw_text(dx, dy + line_height * 4 + yop, dw, line_height, Vocab::param(CustomMenu1::param2)) end draw_text(0, dy + line_height * 6 + yo, contents.width, line_height, CustomMenu1::FollowerText, 1) change_color(normal_color) draw_text(dx, dy + yop, dw, line_height, actor.level.to_s, 2) draw_actor_hp(actor, dx, dy + line_height * 1 + yop, dw) change_color(normal_color) if CustomMenu1::Variable_Display == true draw_text(dx, dy + line_height * 3 + yop, dw, line_height, "#{$game_variables[CustomMenu1::Variable1]}", 2) draw_text(dx, dy + line_height * 4 + yop, dw, line_height, "#{$game_variables[CustomMenu1::Variable2]}", 2) else draw_text(dx, dy + line_height * 3 + yop, dw, line_height, actor.param(CustomMenu1::param1), 2) draw_text(dx, dy + line_height * 4 + yop, dw, line_height, actor.param(CustomMenu1::param2), 2) end color1 = Color.new(*CustomMenu1::DivLineColor1) color2 = Color.new(*CustomMenu1::DivLineColor2) contents.fill_rect(0, dy + line_height * 7 + yo, contents.width, 2, color1) contents.fill_rect(0, dy + line_height * 7 + 2 + yo, contents.width, 1, color2) elsif actor.index == 1 dy -= line_height / 2 dy += CustomMenu1::Y_Offset_F if $game_party.members.size == 2 dx = contents.width/2 - 48 elsif $game_party.members.size == 3 dx = contents.width/4 - 48 else dx = contents.width/6 - 48 end draw_text(dx - 1, dy + 98*2, 100, line_height, actor.name, 1) elsif actor.index == 2 dy -= line_height / 2 dy += CustomMenu1::Y_Offset_F if $game_party.members.size == 3 dx = contents.width/4*3 - 48 else dx = contents.width/6*3 - 48 end draw_text(dx - 1, dy + 98, 100, line_height, actor.name, 1) elsif actor.index == 3 dy -= line_height / 2 dy += CustomMenu1::Y_Offset_F dx = contents.width/6*5 - 48 draw_text(dx - 1, dy, 100, line_height, actor.name, 1) else dy -= line_height / 2 dy += CustomMenu1::Y_Offset_F dx = contents.width/6*5 - 48 draw_text(dx - 1, dy + 98, 100, line_height, actor.name, 1) end endend#==============================================================================# ■ Scene_MenuBase#==============================================================================class Scene_MenuBase < Scene_Base #-------------------------------------------------------------------------- # overwrite method: next_actor #-------------------------------------------------------------------------- def next_actor on_actor_change end #-------------------------------------------------------------------------- # overwrite method: prev_actor #-------------------------------------------------------------------------- def prev_actor on_actor_change endend#==============================================================================# ■ Scene_ItemBase#==============================================================================class Scene_ItemBase < Scene_MenuBase #-------------------------------------------------------------------------- # overwrite method: determine_item #-------------------------------------------------------------------------- def determine_item if item.for_friend? @actor_window.index = 0 use_item activate_item_window#~ show_sub_window(@actor_window)#~ @actor_window.select_for_item(item) else use_item activate_item_window end endend#==============================================================================# ■ Scene_Menu#==============================================================================class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # overwrite method: create_command_window #-------------------------------------------------------------------------- alias sixth_rid_select112 create_command_window def create_command_window sixth_rid_select112 @command_window.set_handler:)skill, method:)on_personal_ok)) @command_window.set_handler:)equip, method:)on_personal_ok)) @command_window.set_handler:)status, method:)on_personal_ok)) endend
    The code is not the best, not cleaned up entirely but works.

    If you find any bugs, report them to me. :)

    And if you have anything else you want in the menu, just tell me and I will try to do it.

    Ohh, and sorry for the slow-poke work. :p
  9. This is really awesome! I haven't encountered any bugs so far. I'll let you know if anything comes my way, but until then, thank you so much Sixth! Perfect!