-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
State Machine - Add Condition Check Frequency #1282
base: master
Are you sure you want to change the base?
Conversation
why not |
I think it would make more sense to compile these checks into We would only have to modify createFromConfig and not touch any other sqf.
|
If a var determining the next check is set on a condition evaluation, it would not take into account a state transition via a condition that is lacking the |
Just script your own delay into the already existing condition block. |
I can see the value in not adding overhead, but as of now there is only limited use of the state machine with most people opting for FSMs or even iterating through with their own PFH/stacked onEach. A few shorthands like this and the FSM editor config should make utilizing the state machine much more accessible. |
Never said "overhead". |
I think low usage is an argument in this case. Low usage of the state machine is a pity, and the most common cause I hear people say for avoiding the state machine is that they are simply much more familiar with FSM and they are not willing to port over/rewrite their AI in the state machine format. By adding shorthands and having the FSM editor compile config you can make the state machine much more attractive to work with. |
Man, it would be great to have the timer on the statemachine. Can we make this a thing, please? |
|
|
I'd prefer if it was compiled into code. If you're concerned about it not resetting without additional code, you could do that like this: if (CBA_missionTime >= _lastCheck + _condFrequency && {_current setVariable [..., nil]; true}) |
There wouldn't be a concern over readability if it was compiled into the condition? It would also need to set/evaluate vars before the condition check and would probably require a |
if (_conditionFrequency > 0) then {
_condition = compile format [QUOTE( \
true && \
{ \
private _return = false; \
if ((_current getVariable [ARR_2((QQGVAR(lastCheckedState) + str _id), '')]) isEqualTo _thisState) then { \
private _lastCheckedTime = _current getVariable [ARR_2((QQGVAR(lastCheckedTime) + str _id), CBA_MissionTime)]; \
if (CBA_MissionTime >= (_lastCheckedTime + %2)) then { \
_current setVariable [ARR_2((QQGVAR(lastCheckedTime) + str _id), CBA_MissionTime)]; \
_return = true; \
} else { \
_return = false; \
}; \
} else { \
_current setVariable [ARR_2((QQGVAR(lastCheckedState) + str _id), _thisState)]; \
_current setVariable [ARR_2((QQGVAR(lastCheckedTime) + str _id), CBA_MissionTime)]; \
_return = false; \
}; \
_return \
} && \
%1 \
), _condition, _conditionFrequency];
}; Any suggestions? |
- cfgName to `conditionFrequency`
When merged this pull request will:
condFrequency
for determining transition frequency .conditionPrecondition
parsing in the FSM Editor compile config.Aim and Intent: