More than one playaction() in same BGE script

I my BGE python script, I have

obj.playAction('man_clothAction',0,20,layer=0,play_mode=bge.logic.KX_ACTION_MODE_PLAY)
obj.playAction('man_clothAction',30,42,layer=0,play_mode=bge.logic.KX_ACTION_MODE_LOOP)


But when I run the code only last one runs.The difference is in the timeline. One is from 0-20 and other is from 30 to 42.

You can run actions simultaneously by setting them on different layers.

However, playing the same action will result in weird overlapping issues. For example, when the loop starts at frame 30, it will inherit the positions etc set in the previous frames. The first action will appear to do nothing.

You'll want to use separate actions and different layers.

obj.playAction('name_of_first_action', 0, 20, layer=0, play_mode=bge.logic.KX_ACTION_MODE_PLAY)
obj.playAction('name_of_other_action', 30, 42, layer=1, play_mode=bge.logic.KX_ACTION_MODE_LOOP)


And if you need to stop it later:

obj.stopAction(layer=1)


The playAction method simply executes the issued play directive, so the last issued is the one that plays.

• this was flagged as low quality, can you add some more to your answer. Nov 8 '14 at 15:32
• @David For what reason? I mean, the implied question here seems to be: "Why does only the last one run?", and I think my answer explains that fully. Nov 8 '14 at 16:02
• the SE system automatically flags posts that are short, among other reasons. There is nothing wrong with what you wrote, but you may be able to add more to explain why or add a solution. Nov 8 '14 at 16:23
• @GoranMilovanovic How to run both? Nov 10 '14 at 4:40
• @user5507 You can only play one action at a time. Nov 10 '14 at 12:49