How to set up logic bricks for diferent character behaviors?

How to set up logic bricks for diferent character behaviors without repeting animations cicles? (if i press a keybord sensor more then once).

Hi there everyone. Iam facing some problems during making the logic bricks set up for animations.

Iam using armatures and i defined two modes for a robot i created, aircraft and walk mode. When i press a keybord sensor i want to switch between this modes whithout repeat the animations if for some reason the user press the same button again. The ideia is to mantain the character under walk mode or under aircraft mode and have animations cicles to represent the switch between both modes.

Right now iam trying to replace the mesh with an add object actuator without sucess. My main problem is that blender doesnt replace the mesh after executing the animation cicle for transforming the robot and i can´t make Blender execute an action just once. Maybe there is a way to lock a play action actuator in a certain frame and then creating a cicle for retourning the other pose?

Please help,

Thanks.

Hello

here’s some tips ( not verified)
Give the character an Int property and make a way ( collision sensors maybe) to change that property for a given state, ex:
1 = walk
2 = aircraft
and so on
Now, link the keyboard sensor with many Expression Controllers as many states you have with propname == 1, another with propname ==2 and so on, and link each controller with Action Actuators with the different animations
Clear?
Maybe it’ll work?! :slight_smile:

Bye e um abraço

Thanks OTO! I will try this out. I was not able to understand what exactly do you mean by using colisions sensors. Because i want this animations to be activatade by the keybord and hold the character inside a state until i hit another predefined key.

The collision sensors it’s just one of the ways to put the character in a particular state, for ex: when the character enters in a room it collides with an invisible object to trigger the property values… I guess …muita cachaça… :slight_smile:

You can also use strings as state names. This makes it easier to debug. Finally it could have a little less performance. But if you have more states and more complex logic it is worth.

You can control your animation it you set the action actuator with property. Then you can set the frame directly. This allows "sub-"loops, reverse and to know which frame is played. But for playing you have to change the property.

I use a character with a complex python script acting as final state maschine (fsm).
I can change the state by sending a message e.g. “open_door” to the armature. The armature will change to state “open_door” and changes the action to play a open door action. When finished it sends a message back to the sender that the animation is finished. It does not play animations that can’t fit together e.g. “open_door” when state is “walking”. It must be “stand”.
This allows you to define a nice behaviour and let you synchronice animations between different objects.

I hope this helps

“The collision sensors it’s just one of the ways to put the character in a particular state, for ex: when the character enters in a room it collides with an invisible object to trigger the property values… I guess …muita cachaça… :)”

@OTO: i see… like you did under “otopushing” is it right? But sadly a solution exactly how “otopushing” is not going to fit my intentions. Yesterday i was trying to make a hidden plane parented to the character with property, collision sensor and a replace mesh. But Blender crashes, probably because there is a conflict with my parented objects (currently i also have a camera folllowing the character).

"You can also use strings as state names. This makes it easier to debug. Finally it could have a little less performance. But if you have more states and more complex logic it is worth.

You can control your animation it you set the action actuator with property. Then you can set the frame directly. This allows "sub-"loops, reverse and to know which frame is played. But for playing you have to change the property.

I use a character with a complex python script acting as final state maschine (fsm).
I can change the state by sending a message e.g. “open_door” to the armature. The armature will change to state “open_door” and changes the action to play a open door action. When finished it sends a message back to the sender that the animation is finished. It does not play animations that can’t fit together e.g. “open_door” when state is “walking”. It must be “stand”.
This allows you to define a nice behaviour and let you synchronice animations between different objects.

I hope this helps"

@Monster: thanks for you reply Monster. Could you please point out a tutorial where i can study the “propertyes” solution? Saddly python is to advanced for me in that case.

See you!

Dear Thorgal

instead of dancing the “samba” all night, you should practice, practice… :slight_smile:
Look at me…dance like a…telegraph post, but making little demos
Try this one:
http://otothecleaner.free.fr/downloads/exdifferentstates.blend

Bye

@OTO:
Hey very nice demo. :o
Sorry about my ignorance but i was not able to set your character back to walk mode after he crouches. I tried to add another cube with a diferent property value but it did not work. Even if i try to change the value for the existing cube it keeps repeating the crouch mode. :frowning:

“I tried to add another cube with a diferent property value but it did not work. Even if i try to change the value for the existing cube it keeps repeating the crouch mode. :(”

Forget ! I just figuret out. I need just to add another cube with a diferent STATE not a different property value.

I added an empty and this empty “shoots” cubes whith diferent states for diferent keybord
sensors this empty is parented to the main character and follow him. Probably Monster will :smiley: about this lamer method but it works for dumb persons like me.

Now i just need to figurate how i will make the transitions between one state and another run smooth (have an intermediate animation for it).