PDA

View Full Version : How to .... use the FSM tool



Kremator
Aug 14 2009, 16:15
I'm really interested in learning how to use the FSM that has just been released by BIS.

This thread can be used for all your wonderful finds / and .fsm files.

Happy scripting.

TeRp
Aug 14 2009, 16:42
Here's some info by BIS on the subject:
http://community.bistudio.com/wiki/FSM
http://community.bistudio.com/wiki/FSM_Editor_Manual

Cheers :)

Kremator
Aug 14 2009, 18:26
A good start TeRp. Now all we need are for some of our community gurus to lead the way and light the torches of knowledge (Oooohhh cheesy !)

Maruk
Aug 14 2009, 20:27
There are many ways of using the fsm editor in Arma 2 and this tool can be used even beyond Arma 2 engine as you can generate any type of code from it with the fsm compiler driven by custom config files.

However, maybe the most obvious way is to create .fsm file in the editor and use it in your mission by http://community.bistudio.com/wiki/execFSM command instead of the conventional linear script as written in sqf. During Arma 2 mission development, hundreds of different fsms were created and stored directly in fsm format (bifsm can store some additional information but we normally did not use it for common fsm files at all).

You can achieve the same results both ways, but for certain types of tasks fsms are easier to create and understand.

Kremator
Aug 14 2009, 22:26
Thanks for the input Maruk. Appreciate it.

I'm sure you will see the community coming up with loads of FSM code in the future.

twisted
Aug 15 2009, 12:14
really interested to see how fsm tool works out. in arma1 there was expectation of what fsm could do thaT NEVER came to happen. now it seems there's more chance of that.

i looked at the tool but it is non-intuitive for a layman like me. hopefully smart modders could make something amazing and perhaps some real awesome AI innovations.

is it more possible this time? as last there was a limitation where the default AI would auto kick in. now is the new AI able to resist being taken over by default AI automatically.

lwlooz
Aug 15 2009, 13:28
Hello there,

It would be lovely if we could be provided with documentation about the possible functions (function="something")
and what they do as used in the class CfgFSMs of config based FSM structures. :)

.kju [PvPscene]
Aug 15 2009, 15:13
check BI fsm and you will learn fast

Kremator
Aug 15 2009, 15:19
There are bound to be FSM gurus out there that can give us a hand.

I totally agree with kju that we should look at what BIS already have - indeed a good starting point.

Anyone used FSMs before ?

NeoArmageddon
Aug 19 2009, 12:47
Heyho,

i just played a little bit around with the FSM Editor and its great!

The scripting is equal to sqf, but you dont have to make loops and if-constructions. You have the ability to make non-linear scripts. Thats not just great for ai-scripting...

I made a easy zombie script... a zombie is attacking a group of civilians... after they died, they return as zombies too... looks great in the editor... 100 civilians and 1 zombie. 10 mins of scripting in fsm editor but a lots of fun!

USSRsniper
Aug 26 2009, 20:45
How does one activates the FSM script in game? Just as any other script?

.kju [PvPscene]
Aug 27 2009, 06:47
http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

search for FSM

Inkompetent
Aug 27 2009, 09:38
How does one activates the FSM script in game? Just as any other script?

Just like a SQF script, just that you use execFSM instead of execVM.

Alex72
Aug 27 2009, 09:52
Just for some insight by a normal dude like myself. Can this be done by someone that doesnt know scripting? Thinking more of just taking an example and change values around etc. Or is it massivly complex?

Thanks.

Alex

Inkompetent
Aug 27 2009, 09:58
Basically it *is* scripting, just that it's done in a graphical editor. Every single item in the FSM sequence has to be scripted to do anything.

TheHarvesteR
Aug 27 2009, 20:34
Traditionally FSMs are made ONLY with script... using a 'switch' structure where each case in the switch is a state... as in :


switch(state){
case 1:
state 1 behaviour;
check for conditions that lead to other states;
break;
case 2:
same as above and so on and on....
break;
}

What BIS has done was create a graphical interface through which you can build your FSM in a more visual way... the scripting is still there, but the FSM editor lets you focus on the behaviours and frees you from worrying about the bureaucracies of doing the same thing with code alone...

I didn't know about this editor... it's quite awesome!! that's why ArmA is the best game ever!!

Cheers

goose4291
Aug 31 2009, 20:10
Heyho,

i just played a little bit around with the FSM Editor and its great!

The scripting is equal to sqf, but you dont have to make loops and if-constructions. You have the ability to make non-linear scripts. Thats not just great for ai-scripting...

I made a easy zombie script... a zombie is attacking a group of civilians... after they died, they return as zombies too... looks great in the editor... 100 civilians and 1 zombie. 10 mins of scripting in fsm editor but a lots of fun!

Care to share said script mate? :)

NeoArmageddon
Sep 1 2009, 08:38
Care to share said script mate? :)

Nope! Why? Because I have to solve some arma2 related issue. The zombies are not good for coops etc... just for some kind of script testing. Exept they are approching and "infecting" other, they act like normal civilians, cause of the micro ai. I have to solve this problem first!

Mike84
Sep 1 2009, 10:49
Nope! Why?
Since this is a learning thread?

NeoArmageddon
Sep 1 2009, 12:50
"Why?" was a retorical question. The answer follows in my post: "I have to solve some arma2 related issue."

Nothing to do with the learning thread.

I added a "Because" above.

If you want to reproduce my script and the bugs just start FSM Editor, place a start state and write:

_unit=_this select 0;
enemys=[soldier1,soldier2,soldier3];
Enemys is a array of units.

Create a "true" condition and like it with the start state. Create a new state with:

_target = enemys select(floor(random(count(enemys)));
Link it with the true-condition. Create a condition with:

!isNil("_enemy")
Priority 0
Link it with a new state with the code:

_unit domove getpos _target;
Link this with two new conditions.
One is:

_target distance _unit>5
and its linked back to the last state

The other condition is:

_target distance _unit>=5
Its linked with a new State:

[_target] execFSM "thisfsm.fsm";
Over a true condition this state is linked with the first white state under the start state.

This is a simple script to "spread a virus"-script. But its not perfcect because of ArmA2 AI