How to modify property from children?

Hi everyone,

I need help for modify property from my children.

I wrote this:

 own.children['fireM'] += 1                 
                 if own.children['fireM'] >= 1:         
                    own.children['fireM'] = 0    

And blender say : "Clist[key]: ‘‘fireM’’ key not in list’’.

So, what’s wrong?

Thank you for youre help.

I think you should set the prop first,
if it doesn`t exist at all ,how to +1

Try this…

for obj in own.children:
if fireM in obj:
obj[‘fireM’]+=1

Enviado desde mi HTC One S usando Tapatalk 2

object.children is a list of objects

select a child by name object.children[‘Name’][‘Property’] = Value
of do it as mandango said and change the property for every child

For mandango’s approach, the correct code would be:



for obj in own.children:
     if 'fireM' in obj:
          obj['fireM'] += 1


@Josip - I never knew you could grab an object from the children CList directly (with obj.children[‘childobjectname’], for example)! That’s very helpful, thanks!