object.states versus variable checks?

I’m trying to learn to use states when scripting AI for enemies and I’m having a hard time grasping on
what benefits states would give me over simple ‘status’ variable check.

I noticed that a controller can only have one state?
Or is there a way to have some scripts running no matter what the state is?

This is a slight issue for me since I would like to have some functions to be running all the time.

Shift click?

Attachments

Demo.blend (439 KB)

Oh that was funny, I always thought that option was only affecting the visibility of the controls in logic view.

you can also use the state actuator in the same fashion,

Well I’m doing all the checks in Python so I’ll probably lean on to my own variable.

Logic bricks are fastest and most accurate for evaluating properties,

properties have one over on variables as any other object can grab it

own[‘value’]=target[‘value’]

like

Keypress X--------------
property On=true---------python
property target!=false—/

python

if Key.positive and Prop.positive and Prop2.positive:
(tab)Do stuff

if I use

if own[‘Value’]==“blah”:

I get “missfires” occasionally or a lack of firing,

Well ofcourse I use object properties, but to me they are variables, just ‘global’ and stored on object.

Anyway I don’t see how it could be less accurate to read if with Python or what would cause your issue.
I have never ran in to such issue.

States are conceptual not different to properties.
The overall data of an object is state too ;).

It depends how you interpret the data.

You can implement state machines as you like:

  • build-in state machine
  • properties
  • any state machine implementation in Python
  • a mixture of the above methods

A controller can be assigned to exactly one state. This might require that you create additional controllers. In most cases this is a very minor issue (except for Python controllers). I guess this is for a simpler user interface.

Place them in a state that gets activated all the time (you can switch to multiple states).
see this state explaining thread