Equipped equipment

Hi!

 

I need to show all equipped equipment, but if I haven't gun, show this error "Cannot read property 'iconIndex' of null

 


var a=0, i=0;

for(i=0; i< 5; i++){

var ico = $gameParty.members()[0].equips().iconIndex;

if(ico == null){ico = 0;}

a+=40;

}


 

I'm trying a lot of ways, but anything can anyone help me?
Try this

Code:
var a=0, i=0;for(i=0; i< 5; i++){  if($gameParty.members()[0].equips()[i] !== null){    var ico = $gameParty.members()[0].equips()[i].iconIndex;    if(ico == null)      ico = 0;    a+=40;  }}
Thank you! :3

Original thread: https://forums.rpgmakerweb.com/threads/equipped-equipment.54546/