Drawing Picture On The Highlighted Option

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Hello everybody,

Sorry for endlessly asking questions, but I'm still a beginner in scripting and I don't know many things.

What I want is to draw a picture near the selection rectangle (on a highlighted item).

Since selection rectangle can be only... well a rectangle, I would like to draw 'something' (a picture) on a highlighted option...

Well it all sound weird ~ this picture should more or less explain what i'm trying to achieve:

To clarify - I know how to draw a picture, so let's assume it's just like drawing a text or icon on that option.

The question is:

How to draw 'something' on highlighted option?

/ Draw a picture when cursor is on certain index?

I know many of you thinks: Why do you want to do this, why do you need to have everything complicated?

So, if this process will be kinda complex, I'll do something else then.

Just asking, maybe even for future purposes.
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Hey ♫

Assuming you are modifying a subclass of Window_Selectable, try:

Code:
def draw_item(index)  if(@index == index)     //Do your stuff for the selected record  end  //Do your drawing for all the itemsend
 

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
I'm editing: class Window_MenuStatus < Window_Selectable 

Did you mean something like this?

def draw_item(index) if(@index == index) draw_image(400, 210, "Graphics/Pictures/Status_TP_Twilight_Sparkle.png") end # if if index < 2 actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled) draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2) else # reserve actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) #draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled) draw_actor_minimized_status(actor, rect.x + 108, rect.y + line_height / 2) end # if end # def
(That's actually my draw_item method, how to setup that properly?)



I'm really sorry, I think I confused you. What I meant is to draw something on highlighted option, just something like attaching that picture to selecting rectangle upon highlighting a party member with index > 1.
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
@index is the currently selected index, therefore if @index==index then we are working on the highlighted option. In your code which draws your image is only drawn once, when dealing with the highlighted option but because you always draw it in the same place it doesn't look like it. Try something like:

if(@index == index) r = item_rect(index) ox = -30 oy = item_height/2 draw_image(r.x+ox, r.y+oy, "Graphics/Pictures/Status_TP_Twilight_Sparkle.png")end # ifYou will have to fiddle with oy and ox to get the positioning right, but this will draw that image relative to the highlighted option.
 

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Yes that works, kinda.

It draws pictures at correct places, but It's not drawing a picture near the 'selection rectangle' but it draws them after selecting a character and moving it.

So... when I'll choose third character and replace with first one - the picture will stay in the third slot,

now when I'll replace fourth character with the first one, it again will draw a picture in 4th slot etc.

That way all the pictures are displayed at the same time and it's not dependent on cursor position.

The pictures are disposed after selecting that slot again.

I'm kinda confused, it's hard to explain. =P
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Ah, I see

Try 

@pending_index instead of @index?, which is "Pending position (for formation)"
 
Last edited by a moderator:

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Something like this?

def draw_item(index) if(@pending_index == index) r = item_rect(index) ox = 400 #-30 oy = item_height/2 draw_image(r.x+ox, r.y+oy, "Graphics/Pictures/Status_TP_Twilight_Sparkle.png") end # if if index < 2 ~~~~~~full-size window else # reserve ~~~~~~small window end # if end # defThat didn't draw a picture at all. Did I do something wrong? =P

Actually after changing (ox) it draws these pictures, but the same thing happens - it draws upon selecting ~ not highlighting.

Hmm... It will be harder than I thought.
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Hmm, can you PM me a project with the script and files? If I can fiddle around with it I should probably be able to get it to work :)  
 

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
OK I'll prepare all necessary files, and remove everything not needed to shrink file-size. =P

~ Thank you for taking your time. =P
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,062
Members
137,575
Latest member
akekaphol101
Top