mob/pet
icon = 'pet.dmi'
var
mob/player/owner
var/list/spells = list()
var/list/spell_unlocks = list()
New()
..()
spell_unlocks = list(
3 = list(new /obj/spell/Heal),
5 = list(new /obj/spell/Antidote),
8 = list(new /obj/spell/Blaze),
10 = list(new /obj/spell/Sleep)
)
spells = list() // Initialize the spells list
client << "spell_unlocks initialized: [spell_unlocks]"
// Proc to handle leveling up
proc/levelUp()
// Debug message to check level and spell unlocks
client << "Checking for spell unlocks at level [level]."
// Check if new spells are unlocked at this level
if(level in spell_unlocks)
client << "Unlocking spells for level [level]."
for(var/obj/spell/spell in spell_unlocks[level])
spells += spell
client << "<i><b>[name]</b> has learned [spell.name]!</i>"
// Debugging each spell learned
client << "Spells list: [spells]"
else
client << "No spells to unlock at level [level]."
Problem description:
I'm having an issue where the pet is not learning spells at the defined level in a list. I have debugged all day and haven't figured it out. Any information would be grand.
Reading it over, wouldn't you want to output those messages to owner instead of client?