so first things first ill throw some code out here so you can see what kind of system im using. (do note it is basically a direct rip from my objects.dm and world.dm)
//first snip is the builder which makes all my overlays.
//the if statements after the eye and hair grab information from a list made (shown in other snip) and then output the icon etc of that object.
var/list/hair_types = list("bald" = 'blank.dmi', "kakashi" = 'Hair_Kakashi.dmi', "deidara" = 'Hair_Deidara.dmi')
mob/proc/Overlay_Build()
var/L[0]
var/hair = hair_types[type_hair || "bald"] + colour_hair
var/eye = 'Eyes_Base.dmi' + colour_eye
L += hair
L += eye
if(equipped["head"]) L += equipped["head"]
if(equipped["heada1"]) L += equipped["heada1"]
if(equipped["heada2"]) L += equipped["heada2"]
if(equipped["shirt"]) L += equipped["shirt"]
if(equipped["pants"]) L += equipped["pants"]
if(equipped["overalls"]) L += equipped["overalls"]
if(equipped["shoes"]) L += equipped["shoes"]
if(equipped["special"]) L += equipped["special"]
if(equipped["weapon"]) L += equipped["weapon"]
src.overlays = L
//////////////
//direct cut from my objects thing since i think it all may be relevant.
//////
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/EquipGridder(var/type, var/grid) //first part to the below thing.
var/list/Empty = list("overalls" = "D","shirt" = "Z")
if(isnull(equipment["[type]"]))
src << output(Empty["[type]"], "[grid]")
else
src << output(equipment["[type]"], "[grid]")
mob/proc/UpdateEquipment() //really bad and unworking output thing basically for outputting stuff to grids. i need to change this.
src.EquipGridder("shirt", "grid1")
src.EquipGridder("overalls", "grid2")
src.EquipGridder("weapon", "grid3")
mob
proc/Equip(obj/items/O)
if(!O || !O.islot) return
if(equipment && equipment[O.islot])
Unequip(equipment[O.islot])
if(equipment && equipment[O.islot]) return // unequip failed
if(!equipment) equipment = new
equipment[O.islot] = O
src.equipped[O.islot] = O.refe
src << output("You equip <font color = [RarityList["[O.rarity]"]]>[O]</font>.","balog")
src.str += O.strbonus
src.agi += O.agibonus
src.int += O.intbonus
UpdateInventory()
UpdateEquipment()
Overlay_Build()
proc/Unequip(obj/items/O)
var/mob/player = usr
if(!O || !O.islot) return
if(!equipment || equipment[O.islot]!=O) return // failed
equipment -= O.islot
if(!equipment.len) equipment = null // reclaim the list
player.equipped[O.islot] = 0
src << output("You unequip <font color = [RarityList["[O.rarity]"]]>[O]</font>.","balog")
src.str -= O.strbonus
src.agi -= O.agibonus
src.int -= O.intbonus
UpdateInventory()
UpdateEquipment()
Overlay_Build()
var/list/RarityList = list("Junk" = "gray", "Common" = "white", "Uncommon" = "green", "Rare" = "blue", "Epic" = "purple", "Legendary" = "yellow")
var/list/AffinityList = list("Sky" = "lightblue", "Rain" = "blue", "Storm" = "red", "Sun" = "yellow", "Mist" = "purple","Cloud" = "purple","Thunder" = "green")
obj/items
var/islot
var/refe
var/code
var/strbonus = 0, agibonus = 0, intbonus = 0, levreq = 0, affinityreq
var/rarity
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 <font color = [RarityList["[src.rarity]"]]>[src]</font>."
oview() << "[usr] picks up \a <font color = [RarityList["[src.rarity]"]]>[src]</font>."
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 <font color = [RarityList["[src.rarity]"]]>[src]</font>."
oview() << "[usr] drops \a <font color = [RarityList["[src.rarity]"]]>[src]</font>."
usr.UpdateInventory()
usr.UpdateEquipment()
proc/IsEquipped()
if(islot)
var/mob/M = loc
if(ismob(M) && M.equipment && M.equipment[islot] == src)
return 1
return 0
proc/IsReq()
var/AfReq, LReq
if(isnull(src.affinityreq))
AfReq = 1
else if(src.affinityreq == usr.Affinity)
AfReq = 1
else
AfReq = 0
if(usr.level >= src.levreq)
LReq = 1
else
LReq = 0
if(AfReq == 1 && LReq == 1)
return 1
else
return 0
proc/Use()
..()
Clothing //Define Clothes
Use()
set hidden = 1
if(src in usr)
if(IsReq())
if(IsEquipped())
usr.Unequip(src)
else
usr.Equip(src)
else
usr << output("<font color = [RarityList["[src.rarity]"]]>[src]</font> requires the \
<font color = [AffinityList["[src.affinityreq]"]]>[src.affinityreq] Affinity</font> and Level [src.levreq] to equip.", "balog")
Click()
Use()
pants
shirts
testshirt
icon = 'CShirt_Lightning.dmi'
icon_state = "invent"
islot = "shirt"
refe = /obj/iconholders/shirts/testshirt
code = 3
rarity = "Common"
overalls
Suit
icon = 'SuitBlack.dmi'
icon_state = "invent"
name = "Suit of The Gods"
islot = "overalls"
refe = /obj/iconholders/overalls/suit
code = 1
strbonus = 700
agibonus = 700
intbonus = 700
rarity = "Legendary"
levreq = 1
affinityreq = "Thunder"
////////////
//and finally this is the icons that gets linked to by each individual icons "refe" var.
/////
//All object holders will be here as there will be a large list and therefore may get bulky
obj/iconholders
var/code
weapons
layer = FLOAT_LAYER-1
hidan
icon = 'Icons/Weapons/Hidansscythe.dmi'
shirts
layer = FLOAT_LAYER-3
testshirt
icon = 'CShirt_Lightning.dmi'
code = 3
headgear
layer = FLOAT_LAYER-2
pants
layer = FLOAT_LAYER-4
overalls
layer = FLOAT_LAYER-2
suit
icon = 'SuitBlack.dmi'
code = 1
suit2
icon = 'CShirt_Lightning.dmi'
code = 2
So does anyone have any ideas on how i would go about making items then be able to get a colour selection.
I know i can add an additional variable to each item to see if there allowed to RGB in the first place (since some will not be allowed to be recoloured) and thats easy enough. so is making the colour box show up. (since ive done all that for char creation)
The problem is just how id make colours selected (if someone decided to change the colour from the default black to w.e) stick to that object. and then be rebuilt when the olay proc is called.
And also, is this method of doing things alright or am i doing it wrong?
EDIT: There is already an option for colouring added to certain items and there is a root variable for all objects noted as colour. thats changed when they RGB it saves in the content list and is then dragged over to the "equipment" list when its equipped. but after that im not sure what needs to be done =\
This was posted on the 31st. and it is now the 3rd. ive tried different things but i cant seem to figure it out.
so far my attempts have returned all kinds of errors.
Such as: type mismatch, cannot read and an (well not an error but just a fail to work)