Equip(obj/Equipment/I, mob/Z)
if(I.dReduction > 0) Z.DamageReduction+=I.dReduction
if(I.dRpen > 0) Z.DRPEN+=I.dRpen
I.dEquip = 1
mb_msgout("You equip [I.dName] on your [getSlot(I)]!", Z)
mb_msgout("[Z.name] equips [I.dName] on their [getSlot(I)]!", oview(0, Z))
Z.equipment.Add(I[I.dSlot])
Z.inventory.Remove(I)
Remove(obj/Equipment/I, mob/Z)
if(I.dReduction > 0) Z.DamageReduction-=dReduction
if(I.dRpen > 0) Z.DRPEN-=dRpen
I.dEquip = 0
mb_msgout("You equip [I.dName] on your [getSlot(I)]!", Z)
mb_msgout("[Z.name] removes [I.dName] from their [getSlot(I)]!", oview(0, Z))
Z.equipment.Remove(I[I.dSlot])
Z.inventory.Add(I)
Problem description:
Basically i'm trying to index the items index in the equipment list by a # a max of 10 objects the item i try to wear has a dSlot of 1 so it should goto the first index? but it doesnt it just throws a list out of bounds error.
Error
runtime error: list index out of bounds
proc name: Equip (/obj/Equipment/proc/Equip)
source file: EquipmentSystem.dm,44
usr: ThunderZ (/mob/Player/saiyan)
src: RetardHat (/obj/Equipment/RetardHat)
call stack:
RetardHat (/obj/Equipment/RetardHat): Equip(RetardHat (/obj/Equipment/RetardHat), ThunderZ (/mob/Player/saiyan))
/Command/testwear (/Command/testwear): Process(ThunderZ (/mob/Player/saiyan), RetardHat (/obj/Equipment/RetardHat))
/Parser (/Parser): Process(ThunderZ (/mob/Player/saiyan), /Command/testwear (/Command/testwear), /list (/list))
/Parser (/Parser): Parse("testwear retard", ThunderZ (/mob/Player/saiyan))
Telnet @127.000.000.001 (/client): Command("testwear retard")
This line is your problem. You are accessing the equipment object as a list. It is not a list, therefore, you are getting an error.
That's what you meant.