ID:145679
 
Code:
world
mob = /mob/create_character

mob/create_character
var/mob/character
Login()
var/charactername = input("Hello, Pick a name for your character, something you wish for people to call you in the game.","Character Name?")
switch(input("Below pick one of the following backgrounds you wish for your character to be. It determines what skills you get in the game.","Character Background?") in list("Warrior","Cleric","Magician"))
if ("Warrior")
switch(input("Please Select your Hair Style.","Character Hair Style?") in list("Spikey","Long","Short"))
if ("Spikey")
src.overlays +='spikey.dmi'
character = new /mob/You/Warrior()
if ("Long")
src.overlays +='long.dmi'
character = new /mob/You/Warrior()
if ("Short")
src.overlays +='short.dmi'
character = new /mob/You/Warrior()
if ("Cleric")
switch(input("Please Select your Hair Style.","Character Hair Style?") in list("Skikey","Long","Short"))
if ("Skikey")
src.overlays +='spikey.dmi'
character = new /mob/You/Cleric()
if ("Long")
src.overlays +='long.dmi'
character = new /mob/You/Cleric()
if ("Short")
src.overlays +='short.dmi'
character = new /mob/You/Cleric()
if ("Magician")
switch(input("Please Select your Hair Style.","Character Hair Style?") in list("Skikey","Long","Short"))
if ("Skikey")
src.overlays +='spikey.dmi'
character = new /mob/You/Magician()
if ("Long")
src.overlays +='long.dmi'
character = new /mob/You/Magician()
if ("Short")
src.overlays +='short.dmi'
character = new /mob/You/Magician()
character.name = charactername
src.client.mob = character
/* if(character.gender=="female")
character.icon_state="2"*/

character.loc=locate (5,5,1)
world<<"<B>[character] has logged in!"
del(src)
..()


Problem description:When you login in it does everything. It asks u to load/create/delete then if u choose new it will ask you what class. Then it asks what type of hair do you want. But when you login in you don't got no hair? Can anyone help?

                haircolor = input("Choose a hair color:", "Choosing your icon:") in list("Black", "Brown", "Grey", "Red", "White")
switch(ggender)
if("Male")
I = new('Male.dmi')
hairstyle = input("Choose a hair style: ", "Choosing your icon: ") in list("Balding", "Short", "Moustache", "Long")
if("Female")
I = new('Female.dmi')
hairstyle = input("Choose a hair style: ", "Choosing your icon: ") in list( "Short", "Long", "Ponytail", "Ponytail2")
var/obj/hair/overlay/O = new()
O.owner = src
O.NewHair()

obj/hair/overlay
var/mob/owner
icon = 'hair.dmi'
layer = MOB_LAYER + 2
proc/NewHair()
icon_state = "[owner.haircolor][owner.hairstyle]"

This is how mine works. Just add icon states. you can do rgb() colors for hair too, but I think that there'd be too many blue-haired avatars in that case. Anyway, make a hair object, like I do. Works like a charm. It also allows for hair styling, to change the type and color of the player's hair - simply remove, modify color and style, then add again.

--Vito
In response to Vito Stolidus
ok thanks
In response to Animekid09
Don't give him that.
                        src.overlays +='spikey.dmi'
character = new /mob/You/Magician()
if ("Long")
src.overlays +='long.dmi'
character = new /mob/You/Magician()
if ("Short")
src.overlays +='short.dmi'
character = new /mob/You/Magician()

It's because your overlaying the variables to src not character.
Also, I would suggest making a hair variable, and storing the object with the hair there, so you can easily remove it by.

src.overlays+=src.hair
src.overlays-=src.hair
In response to Flame Sage
Mine works too!

--Vito
In response to Vito Stolidus
Why make him rework his whole entire code to fit around your mold?
Why not FIX the error like he asked?
In response to Flame Sage
I edited my code and made it so they just half to get hair
from a barber but when u talk to him you still
don't get any hair. Can anyone help?



mob/Barber
icon = 'npcs.dmi'
icon_state ="barber"
NPC = 1
dir = NORTH
DblClick()
if(src in view(1))
switch(input("Would you like hair on your head?","Choose Your Hair Style")in list("Yes","No"))
if("Yes")
switch(input("Please choose your hair sytle.","Choose Your Hair Style")in list("Spikey","Short"))
if("Spikey")
var/obj/X=new/obj/overlays/spikey_hair
overlays += X
usr.loc =locate(1,1,1)
if("Short")
var/obj/Z=new/obj/overlays/short_hair
overlays += Z
usr.loc =locate(1,1,1)
if("No")
usr.loc =locate(1,1,1)
else
return


obj
overlays
spikey_hair
icon ='hair.dmi'
icon_state ="spikey"
short_hair
icon ='hair.dmi'
icon_state ="short"
In response to Animekid09
This is your problem:
overlays += X  //Whos overlays? \
This is defaulting to src, being the mob you DblClick()


It should be:
usr.overlays+=X  //This will add hair to the person who DblClick()ed


Same goes for the other one.
In response to Detnom
Ok i got it all worked out anf fixed but there is still one tiny little problem. For some reason its appearing as an underlay. I have checked my code over and over again but could not find the mistake. Can someone please help me?

mob/Barber
icon = 'npcs.dmi'
icon_state ="barber"
NPC = 1
dir = NORTH
DblClick()
if(src in view(1))
switch(input("Would you like hair on your head?","Choose Your Hair Style")in list("Yes","No"))
if("Yes")
switch(input("Please choose your hair sytle.","Choose Your Hair Style")in list("Spikey","Short"))
if("Spikey")
var/obj/X=new/obj/overlays/spikey_hair
usr.overlays+=X
usr.loc =locate(1,1,1)
if("Short")
var/obj/Z=new/obj/overlays/short_hair
usr.overlays+=Z
usr.loc =locate(1,1,1)
if("No")
usr.loc =locate(1,1,1)
else
return


obj
overlays
spikey_hair
icon ='hair.dmi'
icon_state ="spikey"
short_hair
icon ='hair.dmi'
icon_state ="short"
In response to Animekid09
obj/overlays
layer=MOB_LAYER+1
In response to Mysame
alright thanks.