ID:1133224
 
How would you guys go about making a paperdoll equipment system using a interface? I've tried to do it but failed and could use some help.

Examples:

http://imageftw.com/uploads/20120131/SF_equipment.PNG

http://www.byond.com/games/hubpic/102846_11689.png

http://www.maps4heroes.com/heroes5/pictures/mods/ inventory_mod.jpg
How's this related to Design Philosophy?
In response to Zaoshi
Zaoshi wrote:
How's this related to Design Philosophy?

He wants to know what steps to take to make one, he's not really asking for specific code (at least that's my understanding)
But it's still development problem, not design such as deciding about stats.
In response to Dariuc
Dariuc wrote:
Zaoshi wrote:
How's this related to Design Philosophy?

He wants to know what steps to take to make one
I would say it's a design philosophy question as there's many ways to get a system like this working, depending on what you want to do with it...


One way would be grid that don't have a discernible look to them but can still be interacted with. You could then have images/icons appear in specific cells of the grid depending on where you want the item to be, and the other grid cells just won't have any interaction.

Example:
[_][_][_]
[_][_][_]
[_][_][_]
[_][_][_]

let's say I wanted to use this 3x4 grid for an equipment screen.

[_][x][_]
[x][x][x]
[_][x][_]
[_][x][_]

This could be an example of the interactable grid cells (defined by code). Now, normally the grid won't show lines or anything of the sort. What you can do though, is create icons that go in those cells that represent the empty slot, giving a nice style and an obvious position for the items.

You will, of course, have to work with some mouse drag/drop code to get something like this to work.

At the same time, your inventory could be another grid populated by all your items.

Another way to get this to work is with labels and a bunch of variables and a clusterf*** of code, it's best to just use grids in this case though.

All in all, this is probably one of the better ways to go about equipment in a game instead of just having random stuff you can put on/remove.

Seriously, tons of games on BYOND use a system that allows you to put on 5 shirts at the same time. It's silly.
Lol I agree one reason I need this and its more effective. I still can't find a good way to get it and I know I have to use a grid system for it to work most effectively. I'll be coming back here if I figure anything out.
Well, getting it to work with a grid system isn't too hard. Just make a 3x4 grid control and make it a drop-zone in the options.

Then you'd set it up that, on startup, it fills the cells with whatever item slots you want. For example lets say the ehad is the top center so it would be cell 1,2 (I think) and you can use output() to display an icon in there.

Then what you would do is make it so that, when you drop an item on there, it gets the cell you dropped it to and checks which item type is supposed to go there. If the types don't match, it does nothing (or gives the user an error). If it does, it equips the item, and then the item calls its personal equip code which will change what's displayed in the grid.

Or at least that's how i'm doing it and it works great.
Please refrain from going off topic.
I don't understand what the problem is... This type of thing is very simple to do

obj/thing/one
icon = 'things.dmi'
icon_state = "one"

obj/thing/two
icon = 'things.dmi'
icon_state = "two"

obj/thing/three
icon = 'things.dmi'
icon_state = "three"

equipment_grid

var/list/slots[3][4]

proc/set_slot(x, y, atom/movable/atom)
slots[x][y] = atom

proc/get_slot(x, y)
return slots[x][y]

proc/empty()
for(var/ix = 1 to 3)
for(var/iy = 1 to 4)
slots[ix][iy] = null

equipment_grid_client_display
var/equipment_grid/equipment_grid = new

var/tmp/client/viewer = null

var/tmp/list/screen_references = list()

var/tmp/state = 0 //1 == shown

proc/show(screen_x, screen_y)
if(!viewer) CRASH("You tried to show a display without setting client first!")

if(state) return //very bad things will happen if you show this after its already shown, so prevent that
state = 1

for(var/ix = 1 to 3)
for(var/iy = 1 to 4)
var/atom/movable/a = equipment_grid.get_slot(ix, iy)
if(!a) continue
var/atom/movable/display = new
display.icon = a.icon
display.icon_state = a.icon_state
display.maptext = a.maptext
display.maptext_width = a.maptext_width
display.maptext_height = a.maptext_height

var/posx = screen_x + ix
var/posy = screen_y + iy

display.screen_loc = "[posx],[posy]"

viewer.screen += display
screen_references += display

proc/hide()
if(!state) return
state = 0

for(var/o in screen_references)
viewer.screen -= o
screen_references.Cut()

mob
var/equipment_grid_client_display/grid = new
verb
test_equipment_grid()

if(grid.state) grid.hide()
else

grid.viewer = src.client

grid.equipment_grid.set_slot(2, 4, new /obj/thing/one)
grid.equipment_grid.set_slot(2, 3, new /obj/thing/two)
grid.equipment_grid.set_slot(1, 3, new /obj/thing/two)
grid.equipment_grid.set_slot(3, 3, new /obj/thing/two)
grid.equipment_grid.set_slot(2, 2, new /obj/thing/three)
grid.equipment_grid.set_slot(2, 1, new /obj/thing/three)

grid.show(4, 4)