Hello, I wanted to know if someone could help me write a script(I am very bad at scripting:().
The idea is that this script would change which animation a armature would play in game,
Not just walk\stand kind of change, But rather the actual logic brick settings depending on a property,
So for example the logic brick is set to play [A actions] if property [prop] is equal to 1,
And if property [prop] is equal to 2 it plays [B actions],
so that the player can be changed from [Player A] to [Player B] and each plays different actions
(I hope i explained this pretty good,if not here is a pic)
I have an “Actions” script (module actually) that triggers every time the armature[“Action”] property is changed. Basically, when it triggers is just does this
if own["Action"] == "Idle":
own.playAction("Idle", 1, 61, blendin=5, speed=1, play_mode=1)
own is the armature.
play_mode=1 is looping.
play_mode=0 is play once.
All you need to do is change the “Action” property when you want the action to change and it will play the correct one based on your if statements. I can upload a more complete example if you would like.
Check the API for more information on “playAction.”
First off, Thank you, This is very helpful,
Second, Yes I would like to see a more complete example,
Could also include a Blend file?
This would be helpful, Thanks in advance
well , use a box that is really the “manager” (he manage physic and logic)
then parent the armature to this box (i guess you know already this)
then , just because you re not expert with python , manage what you can with bricks.
select the box, add a property “action” , and make it as string , call this first action “anything”, (is a action fake)
action [anything]
logic:
keyboard(W) -> and -> property = “walk”
keyboard(I) -> and -> property = “idle”
then select the armature,
add a property “action” , exactly as for the box.
add a always sensor with true pulse.
add a controller and a text: