API - playAction : I don't get it

Hello,

I’m a kind a beginner in blender scripting world. I followed many tutorials and then I wanted to practice with a personnal project.

I have just a question about API.

I tried that kind of stuff (attached to a simple mesh with an armature) :

import bge

def main():
    cont = bge.logic.getCurrentController()
    item = cont.owner
    
    arma = item.parent
    #item.playAction()
    arma.playAction()
    
main()

As you can see, I didn’t put args on playAction because that was just an api test.

According to bge.types.KX_GameObject :

bge.types.KX_GameObject(SCA_IObject)All game objects are derived from this class

and

playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0)
Plays an action.

for both lines in the code, i get :

‘BL_ArmatureObject’ object has no attribute ‘playAction’
(must be an kind of KX_GameObject according to ‘KX_GameObject.parent’

‘KX_GameObject’ object has no attribute ‘playAction’

I just want to understand why.

My main problem is that my mesh isn’t affected by the armature in game engine, so I tried to play with script to fix it.

Hi ! You’re using an older version of Blender and the module playAction() on KX_GameObject is not yet suported. Switching to Blender 2.5_9 or greater will solve your probblem.