ID:156781
 
Allo.

So after fiddling around with my mates we decided that we were going to use a system similar to that of World of Warcrafts (and semi like the "slot" thing seen in lummox skin design part 4).

So the way i was thinking of doing it was one of two ways. the first way was a basic you can see the equipped item in the inventory with an adjusted icon state with an E over it stating its equipped. The second way was to actually make a new panel and tab so as to hold a graphical imagery of the equipped items (very much like what you see in wow with the person picture and boxes to showcase the items).

I decided to go with the graphical side of things as heck it shows dedication right?

So my question is basically how would i go about actually doing this kind of system. i findled with a system where each slot was named a certain section and that variable simply held the "type" of object so that overlays could be rebuilt on load but i dont have a clue where to start on actually making the panel i want rebuild without saving icon data.
You would somehow have to save which items are equipped. Just loop through them all and re-add overlays based on that.
In response to Falacy
Well i have it so each item is given a "slot" and that seems to be working fine (i used the code given in the skin guide by lummox since that does exactly what it needs to do)

And i got it to easily rebuild the icons overlays for the player by making a mob variable and making that hold the type reference of the clothing in question.

Just cant figure out how to make something read what goes where and place it in the appropriate "grid" box for my stuff.

like.. pane is called Equipment and that holds all the little grids that will then hold each slotted item.

So head slot should find and search for any equipped head items and then place it back in the grid but not quite sure how to go about it =\ thats the problem lol
In response to Midgetbuster
Just name the grids after the slots and reference them that way
In response to Falacy
Hmm its going as i planned. =\


Slot thingy is pretty much just cut and paste from lummox skin guide #4.

obj/items
var/islot // equipment islot

verb/Get()
set src in oview(1)
if(src in oview(1)) // sanity check; the verb could come in late
loc = usr
usr << "You pick up [src]."
oview() << "[usr] picks up \a [src]."
usr.UpdateInventory()

verb/Drop()
set src in usr
if(src in usr) // sanity check; the verb could come in late
if(IsEquipped())
usr.Unequip(src)
if(IsEquipped()) return // unequip failed
loc = usr.loc
usr << "You drop [src]."
oview() << "[usr] drops \a [src]."
usr.UpdateInventory()

proc/IsEquipped()
if(islot)
var/mob/M = loc
if(ismob(M) && M.equipment && M.equipment[islot]==src)
return 1
return 0

verb/Equip()
if(islot) usr.Equip(src)

verb/Unequip()
if(islot) usr.Unequip(src)

clothing //Define Clothes
pants

shirts
testshirt
icon = 'CShirt_Lightning.dmi'
icon_state = "invent"
islot = "shirt"

overalls
Suit
icon = 'SuitBlack.dmi'
icon_state = "invent"
islot = "overalls"
Blug
icon = 'CShirt_Lightning.dmi'
icon_state = "invent"
islot = "shirt"

mob/proc/UpdateInventory()
var/items = 0
for(var/obj/items/O in src)
if(equipment && O.islot && equipment[O.islot]==O)
continue // don't show equipped items
winset(src, "inventory", "current-cell=[++items]")
src << output(O, "inventory")
winset(src, "inventory", "cells=[items]") // cut off any remaining cells
///*
mob/proc/UpdateEquipment()
var/items = 0
for(var/islot in equipment)
winset(src, "equipment", "current-cell=1,[++items]")
src << output(islot, "equipment")
winset(src, "equipment", "current-cell=2,[items]")
src << output(equipment[islot], "equipment")
winset(src, "equipment", "cells=2x[items]") // cut off any remaining rows
//*/

mob/proc/UpdateEquipment2()
for(var/islot in equipment)
if(shirt)
var/obj/S = new //tryed this first to check output and it worked but it holds no "reference" so i cant hold unequip etc. so i reverted to that "shirt" thing but it only sends the "path" of it not the actual icon itself.
S.icon = shirt
src << output(usr.shirt, "grid1")



mob/var
pants
shirt //Holds the path to the object currently with how i got it all things come out as invent state (on the character even) where theres a blue background etc for display purposes.


EDIT ADDON: i just realized that equipment was an associative list of sorts and that i could just do it that way and voolah it worked.

mob/proc/UpdateEquipment()
for(var/islot in equipment)
src << output(equipment["overalls"], "grid1")


now i just need to figure out how to make it so the overlay it adds is not the icon state i set it to be for previewing :(