SNKMAN – User

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " (={2,})([^ = ])(.*)([^ = ])(={2,}) * " to " $1 $2$3$4 $5 ")
m (Text replacement - "\[ *((ftp|http)s?:\/\/[^ ]+)([^{])=([^}])([^ ]+)" to "[$1$3{{=}}$4$5")
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
In my free time i do a lot of .sqf and config.cpp scripting and testing.
In my free time i do a lot of .sqf and config.cpp scripting and testing.


'''Current Project:''' [http://forums.bistudio.com/showthread.php?t=92269 Group Link 4 Special FX Edition]
'''Current Project:''' [http://forums.bistudio.com/showthread.php?t{{=}}92269 Group Link 4 Special FX Edition]


----
----
Line 50: Line 50:


'''Default:''' ( Bad )
'''Default:''' ( Bad )
<code><nowiki>
<code style="display: block"><nowiki>
Global_Bool = True;
Global_Bool = True;


Line 63: Line 63:


Examples:
Examples:
<code><nowiki>
<code style="display: block"><nowiki>
if (Global_Bool) then
if (Global_Bool) then
{
{
Line 72: Line 72:
</nowiki></code>
</nowiki></code>


<code><nowiki>
<code style="display: block"><nowiki>
if (count _array < Global_Number) then
if (count _array < Global_Number) then
{
{
Line 79: Line 79:
</nowiki></code>
</nowiki></code>


<code><nowiki>
<code style="display: block"><nowiki>
if (player distance _object < Global_Distance) then
if (player distance _object < Global_Distance) then
{
{
Line 86: Line 86:
</nowiki></code>
</nowiki></code>


<code><nowiki>
<code style="display: block"><nowiki>
if !(_object in Global_Array) then
if !(_object in Global_Array) then
{
{
Line 103: Line 103:


'''Optimized:''' ( Good )
'''Optimized:''' ( Good )
<code><nowiki>
<code style="display: block"><nowiki>
Global_System = [True, 30, 500, [] ];
Global_System = [True, 30, 500, [] ];
</nowiki></code>
</nowiki></code>
Line 113: Line 113:


Select the Bool: True
Select the Bool: True
<code><nowiki>
<code style="display: block"><nowiki>
(Global_System select 0)
(Global_System select 0)
</nowiki></code>
</nowiki></code>


Select the Number: 30
Select the Number: 30
<code><nowiki>
<code style="display: block"><nowiki>
(Global_System select 1)
(Global_System select 1)
</nowiki></code>
</nowiki></code>


Select the Array: []
Select the Array: []
<code><nowiki>
<code style="display: block"><nowiki>
(Global_System select 3)
(Global_System select 3)
</nowiki></code>
</nowiki></code>
Line 129: Line 129:


Examples:
Examples:
<code><nowiki>
<code style="display: block"><nowiki>
if (Global_System select 0) then
if (Global_System select 0) then
{
{
Line 138: Line 138:
</nowiki></code>
</nowiki></code>


<code><nowiki>
<code style="display: block"><nowiki>
if (count _array < (Global_System select 1) ) then
if (count _array < (Global_System select 1) ) then
{
{
Line 145: Line 145:
</nowiki></code>
</nowiki></code>


<code><nowiki>
<code style="display: block"><nowiki>
if (player distance _object < (Global_System select 2) ) then
if (player distance _object < (Global_System select 2) ) then
{
{
Line 152: Line 152:
</nowiki></code>
</nowiki></code>


<code><nowiki>
<code style="display: block"><nowiki>
if !(_object in (Global_System select 3) ) then
if !(_object in (Global_System select 3) ) then
{
{

Latest revision as of 18:19, 28 April 2023

I'm Markus 30 years old and from germany.

In my free time i do a lot of .sqf and config.cpp scripting and testing.

Current Project: Group Link 4 Special FX Edition


FSM: ( Fine State Machine )

In Arma 2 we have 2 different .fsm which are used to set how A.I. should behave in combat.

1. NativeFSM ( CACharacters\CfgFSMs.hpp )
2. ScriptedFSM ( CACharacters\Scripts\Danger.fsm )

Bouth FSMs are initialized in the "CACharacter" >> "CfgVehicles" >> "CAManBase".

The NativeFSM is used to control the general behaviour of A.I. units in combat.
It will choose if A.I. should go to cover or attack a known enemy.
If A.I. should reload while in cover or if A.I. should look for any other ( may better ) cover.
It also let you choose if A.I. should provide cover or if they should try fighting on their own.

The ScriptedFSM is used to control the general behaviour of A.I. in situations which are dangerous.
This is something like a Event Handler which is triggering after a specific event happend.
The ScriptedFSM Conditions:

  • Detect Enemys: This will trigger every time A.I. has detected a enemy unit.
  • Detect Weapon fire: This will trigger every time a unit has fired a weapon.

Note: The A.I. which should detect weapon fire must have the chance to know more then 0 about the unit which has fired the weapon.

  • Detect Enemys Near: This will trigger every time A.I. has detected a enemy unit which is very close.
  • Detect Explosions: This will trigger every time after something is exploded? ( Havent seen this so far... )
  • Detect Dead Bodys: This will trigger every time A.I. has detected a dead body. Note: Exploded vehicles are triggered here too.
  • Detect Stop Fire: This will trigger randomly and make A.I. to stop moving for 4 - 8 sec.

If multiple conditions match then they will be triggered given to the priority set in the event.


Global Array System

Each "Global Variable" will be stored in the memory. This means many "Global Variable" will need much memory space. You can reduce the resources used from "Global Variable" by using a "Gloabal Array" which stores all needed values instead of creating a new "Global Variable" for each value.


Default: ( Bad ) Global_Bool = True; Global_Number = 30; Global_Distance = 500; Global_Array = []; Now we have created 4 different "Global Variable" which will need 3x more memory like the optimized way.


Examples: if (Global_Bool) then { Global_Bool = False; ....... };

if (count _array < Global_Number) then { ....... };

if (player distance _object < Global_Distance) then { ....... };

if !(_object in Global_Array) then { Global_Array = Global_Array + [_object]; ....... } else { Global_Array = Global_Array - [_object]; ....... };


Optimized: ( Good ) Global_System = [True, 30, 500, [] ]; Now we have stored all values in only 1 "Global Variable" called "Global_System".

You can check / select the needed value by using (Global_System select Index). Index is the position ( number ) in which the given value was stored.


Select the Bool: True (Global_System select 0)

Select the Number: 30 (Global_System select 1)

Select the Array: [] (Global_System select 3)


Examples: if (Global_System select 0) then { Global_System set [0, False]; ....... };

if (count _array < (Global_System select 1) ) then { ....... };

if (player distance _object < (Global_System select 2) ) then { ....... };

if !(_object in (Global_System select 3) ) then { Global_System set [3, (Global_System select 3) + [_object] ]; ....... } else { Global_System set [3, (Global_System select 3) - [_object] ]; ....... };