0
$\begingroup$

So, I basically have a few empty objects that are adding 1 to their 'Interval' properties every refresh of my game. The script I'm adding to the object that has an animation is connected with an always sensor on 1 positive skip and an action actuator with all the data prepared. The name of the actuator is right in the script. I'm sure. The animation is supposed to be activated as soon as the Interval property of "Empty.007" in my scene is higher than 60. But it isn't activating. Could anyone help me with this? It would be greatly appreciated.

import bge

cont = bge.logic.getCurrentController()
own = cont.owner
act = cont.actuators["Action"]
scene = bge.logic.getCurrentScene()
Interval1 = scene.objects["Empty.007"].get['Interval']
Interval2 = scene.objects["Empty.008"].get['Interval']
Interval3 = scene.objects["Empty.009"].get['Interval']

acc = 60

if Interval1 > acc:
    cont.activate(act)
$\endgroup$
  • $\begingroup$ I forgot to skip 1 in the always actuator but it still work, i tested it $\endgroup$ – Strapicarus Dec 9 '17 at 2:50
1
$\begingroup$

Your action actuator is not being activated because you have a sintax error in

Interval1 = scene.objects["Empty"].get['interval'] you have to use parenthesis in the .get('interval')

enter image description here

Cube logic:

enter image description here

from bge import logic

act = logic.getCurrentController().actuators['Game']
obj = logic.getCurrentScene().objects['Empty']
print(obj['interval'])

if obj['interval'] >= 60:
    logic.getCurrentController().activate(act)

Empty logic:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.