# How to switch between Action Actuators

I have two action actuators, and I need to switch between the two immediately once a variable has changed. I have tried multiple things such as logic bricking the set up and using this script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['Move']
if sens.positive:
if own['Y Axis'] == 1:
cont.activate(cont.actuators['Y Axis'])
cont.deactivate(cont.actuators['X Axis'])
else:
cont.activate(cont.actuators['X Axis'])
cont.deactivate(cont.actuators['Y Axis'])


Where own['Y Axis'] is the variable that this is dependent on. It works the first time the variable is switched, and then it doesn't work afterwards. The actuators, Y Axis and X Axis are Action actuators with the Loop End playback type set. How can I do this? Thanks!

You have to change the layer or priority of one of the action actuators :

OR

instead of having two actuators and activating and deactivating the other one, you can use just one and switch the used action :

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['Move']
if sens.positive:
if own['Y Axis'] == 1:
cont.actuators['Axis'].action = 'Action1'
cont.activate(cont.actuators['Axis'])
else:
cont.actuators['Axis'].action = 'Action2'
cont.activate(cont.actuators['Axis'])