Here is a simplified example of my situation…
i have 28 objects in layer 2. all are named 1-28 accordingly (each object name is just a number between 1 and 28
i have an empty in layer 1
that empty has a property for adding objects
the empty also has a property sensor set to “changed”
when property is 1 i want it to add object 1…
when property is 2 i want it to add object 2…etc
instead of having lots of logic bricks with all of the objects and property values, i have made a script…
cont = GameLogic.getCurrentController() addobj = cont.getActuator("addobj") prop = cont.getSensor("prop") propvalue = prop.getValue() if propvalue<29(): addobj.setObject(propvalue) GameLogic.addActiveActuator(addobj, 1)
when i start the game, the dos displays the error "TypeError: ‘int’ object is not callable
im pretty that this means that the value of propvalue is an integer. and you cannot call an object by using an integer? am i right?
so is there a way to call an object with the value of propvalue? i’m not quite sure how to make the script call the object by name, not integer.
i understand that this may be a little vague, but i tried to explain it as well as i could.
i would appreciate any help. thanks:D