Problem saving to memory



  • Hi Everyone,

     My first post and just need some help with a problem i am currently having, so i'm trying to save to my memory for my second rooms spawn and i can't get it to write to the memory. i will show you some pictures and what i am typing in my console to see if i'm making a mistake:

     

    Game.spawns.Spawn2.memory.minCreeps.lorry = 2

    That is what i am using to try and write to my memory and now i will show pictures:

     

    http://imgur.com/0HovPbV 

     

    As you can see, my Spawn1 has everything i want and i'm just trying to replicate it into my Spawn2 but i seem to be making a mistake that i cannot see. i obviously got it right the first time to write into my Spawn1's memory.

    Any help would be great and many thanks as well.


  • Culture

    You need to define "minCreeps" first. Since it doesn't exist you're trying to add a property to undefined, which doesn't work.

    if(Game.spawns.Spawn2.memory.minCreeps) {
    Game.spawns.Spawn2.memory.minCreeps = {}
    }
    Game.spawns.Spawn2.memory.minCreeps.lorry = 2