ID:2538520
 
(See the best response by NSBR.)
Code:
proc/DressNPC()

for(var/mob/NPC/P in world)
if(!P.client)
P.overlays += image('Clothing.dmi',icon_state = "Male Snowsuit")


Problem description:

Have a bunch of NPCs with just a base male white model. Would like to add clothes to them when the world opens up but I'm not sure how to code it, and can't find anything. If anyone can help or give suggestions let me know thanks! Also tried making a list so it would just randomly give clothes everytime the world starts. That didn't work either though XD.
You'd probably just want to handle it in /mob/NPC/New()

mob/NPC
var/tmp
clothing_icon = 'Clothing.dmi'
clothing_state = "Male Snowsuit"
New()
..()
overlays += image(clothing_icon,clothing_state)
var/item/equip/Shirt/NShirt

mob/NPC/New()
..()
if(!NShirt) NShirt = new //if npc_shirt hasn't been initialized yet, do so
NShirt.equip(src) //equip the npc_shirt to the npc

item
parent_type = /obj
equip
proc/equip(var/mob/NPC/m)
if(!m) return
m.overlays += src
proc/unequip(var/mob/NPC/m)
if(!m) return
m.overlays -= src
Shirt
icon = 'BaseShirt(M).dmi'
Pants
icon = 'BasePants(M).dmi'
Shoes
icon = 'BaseShoes(M).dmi'

Okay so thank you for that, I was able to find this and tailor it to what I needed but for some reason it still ins't working correctly :/
Ok so I feel like a dummy but I just realized that the code you posted was not just a reply to mine T.T. I plugged that in and it's working XD. Thank you!
mob/NPC/
var/tmp
clothing_icon = 'Clothing.dmi'
clothing_state = "Red Ballcap"
clothing_state2 = "Blue Gentleman Hat"
clothing_state3 = "Red Bandana"
New()
..()
var/Random = rand(1,3)
if(Random == 1)
overlays += image(clothing_icon,clothing_state)
if(Random == 2)
overlays += image(clothing_icon,clothing_state2)
if(Random == 3)
overlays += image(clothing_icon,clothing_state3)

So I went with this to randomize their outfits. It there a simpler way of going about it?
In response to MuckySmith
Best response
mob/NPC/
var/tmp
clothing_icon = 'Clothing.dmi'
list/clothing_states = list("Red Ballcap","Blue Gentleman Hat","Red Bandana")
New()
..()
overlays+=image(clothing_icon,pick(clothing_states))
omg I'm learning so many things. Thank you so much!!