Individual Slot Draw

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I was tinkering something from the window base called draw_item_name. I copied the tidbit of script and placed it in my equip slot. There's something I want to ask, how can I draw the icons of the equipment I have individually?

Because normally, this:

#-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y, width, line_height, item.name) endholds all the equipment icons and place them in line with the name of the equipment. So, how can I separate the icons from the names individually? I want to draw weapon icon for example at x = 90, y = 15, then armor icon at x = 12, y = 10, how can I do that?
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
but when I make my own dimensions for example:

#-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, 21, 21, enabled)everyone of the equipment icons go to x = 21, y = 21.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Yes, because you're telling it to draw it at that position.

You should just write your own drawing method, rather than putting it in the draw_item method.
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Yes, however, i only know how to use the draw_icon, which specifically, I can draw the icon I want.

If I am going to use the same draw method style though, how can I just separate the icon so the icons of the weapons and armors I equip or unequip appears in a different position individually?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
you should make the x,y based on the index, or at least the y part or the x part... you'll do that on the method that calls draw_item_name, or edit draw_item_name so that it still takes index as a parameter so you can change the draw_icon call from there...


EDIT: or well, you might just wanna make a hash that stores the location point of each equip slot, check the equip slot id of the item, and load the correct x,y coordinates
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
you should make the x,y based on the index, or at least the y part or the x part... you'll do that on the method that calls draw_item_name, or edit draw_item_name so that it still takes index as a parameter so you can change the draw_icon call from there...

EDIT: or well, you might just wanna make a hash that stores the location point of each equip slot, check the equip slot id of the item, and load the correct x,y coordinates
that seems to be the best route. I tried making a hash:

icon_location = {1=> (25, 21)2=> (26, 21)# and so forth}but then it returns to my original problem that if I ever draw them, all of them are collected to that same location. All the icons of the items are still drawn. So I was wondering how to easily separate the icons of the equipped items....
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
and how did you used the hash? you will of course need to configure the draw call to utilize the hash correctly, else your hash just lurks there for no reason at all


PS: you forgot an important part, the comma after each hash entry
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
what I did was to recreate the draw_item thing and made it with a different name, created it on the other draw method:

Code:
icon_location = {1=> (25, 21),2=> (26, 21),# and so forth}draw_item_name_new(item.icon_index, icon_location.values[item.icon_index], enabled = true)
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
that doesn't give you an error???

the array entry to the hash was placed inside () and not [], there was no , after the icon_location

what's draw_item_name_new? does it take an array for the x,y?

and also, you should just use icon_location[id] instead of icon_location.values

Also, since ur basing it on icon_index, then all items that use the same icon will be placed on same spot, and any icon not defined will probably return 0 or nil

that's why I was more of suggested you to use the equip slot/type id (item.etype_id)

if I were you I'd do something like this:

Code:
item_loc = {  1 => [10,15],  2 => [30,100],}draw_item_name(item.icon_index,item_loc[item.etype_id][0],item_loc[item.etype_id][1],and so on)
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top