ID:1097368
 
(See the best response by FIREking.)
Code:
var/const
ARMOR_LAYER = FLOAT_LAYER-4

item
Plate_Armor
icon = 'Armors'
icon_state = "Plate Armor"
def = 5
layer = ARMOR_LAYER


Problem description: What i have to add to this code for make a wear, unwear item?? please if someone can tell me how i do that in newbie in this and i dont know how to do it.

ok and what i have to add to Save and Load proc for save this and when i login load this?
In response to Trainingaccount16
Trainingaccount16 wrote:
ok and what i have to add to Save and Load proc for save this and when i login load this?

Just rebuild it on login, otherwise you're gonna have tons of problems.

when someone logs in and loads a saved character:
0. strip all overlays if there are any
1. check what items they have, which ones are equipped
2. for the ones that are equipped, add up all the overlays and apply them
In response to FIREking
FIREking wrote:
Trainingaccount16 wrote:
ok and what i have to add to Save and Load proc for save this and when i login load this?

Just rebuild it on login, otherwise you're gonna have tons of problems.

when someone logs in and loads a saved character:
0. strip all overlays if there are any
1. check what items they have, which ones are equipped
2. for the ones that are equipped, add up all the overlays and apply them

Wow that sounds good and it sure works but I'm a novice at this and do not know how you do that looks like this?
mob
Login()
src.overlays //?? like that?
Best response
Mob
Login()
//load here
src.overlays.Cut()
HandleEquipmentOverlays()


Then in handle equipment overlays, you'd call each equipped items get overlay function and attach it to your mob. You should write a get overlay proc for anything that can give one.
I saw it just now, it dont work, because if you have equipped an Armor + a Sword if you unequip the sword the armor overlays desapair too. The problem i dont know how to make save the player overlays
obj/overlays/sword
icon = 'different_icon.dmi'
icon_state = "icon_state"
obj/weapon
var/equipped = 0
var/overlay_type = null
proc/isequipped()
//you can write logic here in the future, if you need to
return equipped
proc/get_overlay(mob/m)
//you can add logic here, if you ever need it in the future
return overlay_type
obj/weapon
sword
icon = 'weapons.dmi'
icon_state = "sword"
overlay_type = /obj/overlays/sword

isequipped()
//you can override isequipped logic per item, if needed.
//for example, you could return false if this object isn't allowed in the game anymore due to a balance update
if(is_weapon_allowed(src))
return equipped
return 0

mob
Login()
overlays.Cut()
for(var/obj/weapon/o in src)
if(o.isequipped())
src.overlays += o.get_overlay(src)
..()


The code posted is just to inspire you, please do not copy and paste it. Please use it as a concept and an idea.
Thanks it, do not worry as copy and paste does not like when I started in this I thank you now I'll try to do