Jump to content
Chantal

Show image while hovering over a choice + text formatting issue

Recommended Posts

Hi there! 

Lately I've been trying to perfect my message system and so far so good. But I've run into a challenge that I can't figure out myself. 

 

What I want to do is when a player hovers over a choice, I can display a different face graphic per choice. Like so (gogo fancy editing skills!): 

post-7300-0-43741600-1375041879_thumb.jpgpost-7300-0-75860500-1375041882_thumb.jpg
Also, I've been trying but I can't get the text to go over the portrait like that. It's different with choices, because they're in a different window from the textbox and you can just place the choices over it. But with normal text the text makes room for the portrait. The only thing I could find was a way to move the entire textbox, but that's not what I'm looking for. 

Here's what I have now: 

post-7300-0-73351400-1375042015_thumb.jpg 

It's halfway there, just need the text to basically ignore that the portrait is being drawn. 

 

I'm using the entire Modern Algebra's ATS system: http://rmrk.net/index.php/topic,44525.0.html

 

ny help would be greatly appreciated :) 
 

ps. I feel like there should be an option to place the text where I want without moving the entire window. But I just can't find it...

 

Share this post


Link to post
Share on other sites

you know how you can have commands like /n[1] and /c[1]?

 

you can use that on each choice to determine the pic eg.

assuming you portrait graphics are in a set of them selves(that is 1 files has lets say 6 of the same character but with different moods), you can add a command that changes the portrait index if a command is shown.

 

e.g

 

Choice 1 = "/p[2] You're like a puppy" will cause the third image to display. by checking for the "/p" command and parsing the number in the []

Choice 2 = "I hate cat's" now this should be default, so if "/p" is not found , the portrait is set to default.

 

 

as for the issue with the text not being lined up because of the portrait. you can try setting the text box to a different z value logically this will mean that the text would be out of the way of the portrait. but im not really sure what going on there.

Share this post


Link to post
Share on other sites

/p[n] Doesn't seem to work at all. It just shows '/p[n]'. I tried every possible way of writing it (in the choices, below the choices, in a script, in a comment, etc) but nothing works. 

\p[n] Gives me the name of party member n. 

So, either I'm doing it wrong (which is entirely possible) or it doesn't work :(

This is the image file I'm using (it works with the ATS system): 

post-7300-0-40944200-1375104283_thumb.png

Maybe that's wrong? However, when I tried with a normal faceset, it also didn't work. 

 

I changed every z value I came across (in the Face Options script), but that didn't seem to solve the problem. However, while I was fiddling this happened: 

post-7300-0-46939400-1375110131_thumb.jpg

and it grew on me. So I'll just stick with that. So that 'solves' the second part of my question :)

Share this post


Link to post
Share on other sites

Showing images inside the choice box isn't what I'm looking for, it could work, but I'd rather not have it that way to be honest. 

Perhaps I should explain better. 

 

What I'm hoping to accomplish is that when the player is looking through all the choice options, the character's face changes. If it's an angry choice, the angry face is displayed. If it's a happy choice, a smiling one. Similar to the way choices are handled in Jade Empire (

 go to 04:34) 

I was hoping it could be achieved with this scipt, since it has a help window option. Something that displays when hovering over a choice. But instead of showing text at the top of the screen, perhaps it could show a face graphic instead? Though that's just an idea, I have no idea if it can work that way. 

Share this post


Link to post
Share on other sites

sorry , I forgot to mention that i was only providing an algorithm solution's, you will actually need code that I assumed you were script savvy. "/p[n]" doesn't have to be "/P[n]" if you want you can have *I&^%&*(^%(&^%(&[n] but that's a little impractical :P.   I used P because I though it was unused by RPGmVXA's standard code.

 

As Tsukihime said you will need to script that function. unless someone is willing to hand it to you. 

Your image Will work for my idea since it comes in a group. 

 

How Selection of the  Images work is that they all use a "Face_index" , the first image is 0 and the last is 5(or in your case 2).

if you change this, your pic should change.

 

$game_message.face_index

 

Because this is about faces will use \F[n]. when the box is up , this will run once, but Params[0] is what contans your commands

 

def setup_choices(params)
    params[0].each {|s| $game_message.choices.push(s) }
    $game_message.choice_cancel_type = params[1]
    $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n }
  end

in order to make your new bitmap appear each time you select one you will need to do some editing on the Game_Message and Window_Message classes.

the choices get stored in $game_message.choices so don;'t worry about the Game_interpreter.

 

 def update_faces_index
    if $game_message.choice?
      
    $game_message.face_index = @choice_window.index
      contents.clear
    draw_face($game_message.face_name, $game_message.face_index, 0, 0)
    end
    
    end


this function will update the face as you select them but we want to code them
so we will need to to some string editing :)
 
to get the string we can use this
 
cur_choice = $game_message.choice[@choice_window.index]

 

now we want to find the \F[n] code in the string and parse it into a number, and if there is no code it will set to its default index.
you just need to extend the process escape chars for that

Share this post


Link to post
Share on other sites

I have a solution in mind, but that will have to wait until I get around to doing it since I've got some other ideas that I am more interested in. But as usual donations can prioritize things.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Script savy? If only! I'd love to be able to truly understand scripting, but so far I haven't been able to get much farther than editing x, y and z values. Anything beyond that, and I get lost. I'm starting to believe I don't have a scripting bone in my body :P

 

Thank you for trying to explain things and help me, but I'm afraid I don't really understand much of it.When you explain it, it kind of makes sense. But when I try to apply it, I get completely lost... 

Do I edit what you gave me? Do I copy paste it? Where do I put it? Is is already in there and do I edit that? Do I replace Params[0] with F[n]? IS Params[0] F[n]? What do I edit in Game_Message and Window_Message? Or do I add something to Game_Message and Window_Message without editing any existing stuff?

...I could go on, but this is pretty much how confused I am and what skill level I'm on ^^" (skill level = 0)

 

I can't thank you enough for trying to explain it all to me (honestly, I'm extremely grateful!), but I'm just really lost... Perhaps it's a better idea to take Tsukihime's offer and donate something to the cause. 

 

 

 

 

Share this post


Link to post
Share on other sites

I think the easiest way is to assign callback functions to each choice and whenever you hover over a choice, it would call the callback function.

Do you mean Pre assign them in a array before running the the choice code, and using the choice index as the index for the pre determined codes? that's is like 100x times easier than my idea. much cleaner too.

 

Chantal do you want me to write an extension / plugin code for that script you have?

scripting is a very confusing first up, well maybe not so much for Tsukihime. There are tutorials around but it take ages to get your head around things. I found it easier to learn another language(since RGSS tuts are specific to RPGmaker, thus limited). but its all preference. I think I will go with Tsukihime's idiom since by looking at that script it already has lots of Regular expressions, so my way will probably be a bit of a nightmare. 

 

your using all 5 of that guys scripts, right?

I'll make the extension for the faces only...

Share this post


Link to post
Share on other sites

That's the basic idea. A single event (in the context of event-driven programming) can have multiple handlers assigned to it and then have them triggered whenever you fire the event.

 

In this case, the event is simply the moving of the cursor, and the handler contains logic that determines which picture to show.

 

I've written a simple utility script that implements the event itself.

http://www.rpgmakervxace.net/topic/17329-choice-move-handlers/

 

All that is needed is to write the callback method and to figure out how to show the appropriate picture.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Here it is:

it works, just tested

just remember with your image the maximum index value is 2. if I'm not mistaken.

 

to use it is simple 

 

 

just add a script command before each choice call

e.g you even page should like somethinglike this

 

 

Script Call: face_array(0,1,2,3)

Show Text

Show Choices

 

or

 

 

Show Choices

Script Call: face_array(0,1,2,3)

 

      

basically each time you call a show choices you need to use script call unless you aren't changing the order of the images

almost forgot paste thius script above main but below the face script

#ATS: Face Options extended
#==============================================================================
# 
# â–¼ -- ATS: Face Options extended v1.0
# -- Last Updated: 19/03/2013
# -- Level: Medium/Easy
# -- Requires: ATS: Face Options
# 
#=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

#
#  this is an extension of Modern Algebra's ATS:face Options
#  now you have the option to add specific faces to highlisgh choices
#  feel free to PM me or Email at acountsfornoreaon@gmail
#  to request new features.

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#â–¼ INSTRUCTIONS
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To set up your game as intnded follow thewse instructions:
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#every time you want the custom faces appear just add this script call before your 
#call your choices, where "values" is your new index.
#
#     face_array(values)
#
#to add multiple values just seperate them with a comma respectively.
#like this.
#
#    face_array(value, valueII, value III, valueIV) 
# 


# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#â–¼ SCRIPT CALLS
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
#  Assign index for choices respectivly. the maxmum values it can take is 4
#  
#    face_array(value, valueII, value III, valueIV) 
#
#
#



#==============================================================================
# â–¼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, HIV,
# and/or halitosis so edit at your own risk.
#==============================================================================
#============================================================================
#   Game Event
#============================================================================
class Game_Event < Game_Character
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  #  comaptiblity for move route script calls
  #=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  def face_array(a,b = 0,c = 0,d = 0)
        $face_array = [a,b,c,d]
  end
end

#============================================================================
#   Game Interpreter
#============================================================================
class Game_Interpreter
  
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  #  method for script calls assigns the race array
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  def face_array(a = 0,b = 0,c = 0,d = 0)
        $face_array = [a,b,c,d]
  end
  end
#===========================================================================
#   Window Message
#============================================================================
class Window_Message < Window_Base
  attr_accessor :choice_window  #choice window
  attr_accessor :choice_index   #index of choice window
  
  #==========================================================================
  # Gets index of choice window
  #===========================================================================
  def choice_index
    return @choice_window.index
  end
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  #  alias for an alias lol, basically extends the..... alias
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  alias dska_ext_caw maatsfo_creatwins_3hn6
  def maatsfo_creatwins_3hn6(*args, &block) 
    dska_ext_caw(*args, &block) #call origin method
    @choice_window.set_handler(:select, method(:call_picture_update))
    print('..')
  end
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  #  Meat and potatoes, assigns new face
  #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  def call_picture_update
    @atsfo_face.setup($game_message.face_name, $face_array[choice_index])
    print('yes!')
    end
  end
#===========================================================================
#   Window ChoiceList
#============================================================================  
  class Window_ChoiceList < Window_Command
    #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # overwrite select to call handler... this is more important than it seems
    #==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    def select(index)
      super 
      call_handler(:select)
      
    end
    end
 #=============================================================================
 #  end of File
 #=============================================================================

 

EDIT: Give credit to Tsukihime too... if it wasn't for his input i would used a much slower and complicated method.

Edited by Fornoreason1000

Share this post


Link to post
Share on other sites

OMG, thank you so much! It works perfectly :D 
I cannot thank you enough for this. 

 

If you ever need some sprite edits or face edits, let me know and I'd be happy to do it for you :) (I can edit fairly well, but I'm afraid I can't really create from scratch..) Or if there's anything else you need help with, let me know and I'll see what I can do for you :)

Edited by Chantal

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted