I’m having some trouble setting the action for an action actuator using python. It’s for animations for getting in and out of vehicles. Here’s the part of the script that sets it:
The VehicleType property (in this case it’s kestrelPilot, ‘kestrel’ is just the name of the vehicle design I found on deviantart.com) is used to get the enter and exit animations (kestrelPilotEnter and kestrelPilotExit).
It worked perfectly for the enter animation, but for some reason it doesn’t work for the exit animation unless the kestrelPilotExit animation is selected in Action Editor of the .blend file or the animation is put in the action space of the actuator. Otherwise the console gives me an error message saying the action wasn’t found, even though print(vehicleType + ‘Exit’) always returns kestrelPilotExit when I tested it. If I have to I’ll use different actuators for each vehicle action, but I want to see if I can fix this first.
I first noticed this when I started using Ubuntu instead of Windows XP. I wanted to see what Ubuntu was like so I set it up so I could boot either Ubuntu or XP. From what I could find through testing different things the problem is not from the script, but from the .blend. I made the enter animation when I was still using XP and the exit animation when I started using Ubuntu. Both times I used Blender 2.57.1, the only difference being the operating system. The same error occurs on both systems and with earlier versions of Blender 2.5.
Could someone help with this? I’d attach the game, but it’s not one .blend file, it’s multiple files linked into one level and I don’t think I can upload that.
Are you currently using the latest version of Blender? Just wondering.
As to the actual problem, I don’t know if this is the solution, but perhaps you should just do:
vehicleType = vehicle[‘VehicleType’]
Accessing the variable with get() may have been the problem, because if there’s an error, the returned value will be None, and that could have been the problem if the returned value is None.
I am using the latest version of Blender, and using vehicle[‘VehicleType’] didn’t help. I also tried bypassing that altogether by using:
exitVehicleAnim.action = ‘kestrelPilotExit’
This should have worked because that’s the correct name, but it didn’t. That’s why I think it has something to do with the animation itself. I’ve tried making a new animation, but it still says it can’t find the action, even though it should be able to and the enter animation works fine.
Try setting the action beforehand and printing out what the action is before you assign it to see what it should look like. It would seem like you’re doing everything correctly, so I’m not sure what the problem could be.
So I just discovered something interesting. Since my character is a group I could just append it directly into a new file, but when I checked the animations I noticed that kestrelPilotExit (the one that hasn’t been working) wasn’t in this list of animations. And since the group is linked into the level where I test everything, that would explain why the game couldn’t find the animation. Somehow new animations are no longer being added to the group, and thus are never being detected within the test level. This must have started when I began using Ubuntu, since that’s when I noticed the problem.
So that’s sorted out, but I still have no idea how to fix this. Any ideas?
Hey, try using the F-Curve fix in the Help menu - maybe that will help. Don’t save afterwards unless it works, though. Also, see if any new animations created can be seen, as well.
The problem is, that Blender can’t know what actions you want and what actions you do not want in you group.
Importing all actions would create an awfull large data block.