Snippet of the Python code:
- Code: Select all
actSubEnter = ptAttribActivator(1, 'Enter region activator')
actSubExit = ptAttribActivator(2, 'Exit region activator')
animSubRamp = ptAttribAnimation(3, 'Ramp Animation', netForce=1)
...
def OnNotify(self, state, id, events):
if (not PtWasLocallyNotified(self.key)):
return
if ((id == actSubEnter.id) and state):
animSubRamp.value.backwards(0)
animSubRamp.value.speed(1)
animSubRamp.value.playRange(0, 5)
Snippet of the AlcScript:
- Code: Select all
SubWorld_02:
type: subworld
animations:
- name: SubRampAnim_02
autostart: 0
loop: 0
Region_Anim_Start:
logic:
modifiers:
- name: logMod_TrigAniStart
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: enter
trignum: -1
activators:
- type: objectinvolume
remote: Region_Anim_Start
actions:
- type: pythonfile
ref: :SubWorld_02_PFM
actions:
- type: pythonfile
name: SubWorld_02_PFM
pythonfile:
file: aniSubTest
parameters:
- type: activator
ref: logicmod:logMod_TrigAniStart
- type: activator
ref: logicmod:logMod_TrigAniStop
# This is what I assume is wrong:
- type: animation
ref: :SubRampAnim_02 # (already tried without ":")
Now, the proper section in OnNotify gets called as expected (put some "print" in the code and checked the Python0.log),
BUT: The log reports:
"AttributeError: 'NoneType' object has no attribute 'backwards' "
on the line "animSubRamp.value.backwards(0)"
So I'm guessing that the animation gets not properly passed as a parameter to python, because the ptAttribAnimation animSubRamp has value of "None".
Actually, I don't really know how to pass an animation.
By name of the animation, by the animation, by object, by ... (responder?)
Or do I simply use a wrong syntax?
Solution: There's a modified prp_LogicClasses.py on page 2 of this thread; explanations in the thread itself.