Here you go https://drive.google.com/file/d/0BwT_0l ... sp=sharing
I fixed it according to your project, but imo it needs some refactoring. First of all you are using arrays but not arrays functionality, you just use them as holders for instance variables... so you could move those instance variables to guns family and use UIDs which are faster then "codes".
Anyway I've made it here based on "codes".
You also could do it differently in the way you have it but I'm not sure if you realize that you set gun_data "active" property, but you never read it... so engine had no idea which gun data you want to use. You could loop the family and check for "active" property... but picking by UID is surely better idea, and much faster.
Anyway it works, hope you understand the changes, so you could implement it in the rest of the project.