Page MenuHomeFeedback Tracker

Ability to control trigger condition check treshhold
Closed, ResolvedPublic

Description

Hello BIS Team,

it would be great to deliver a treshhold for condition checks on triggers.
Reason: The trigger is being checked every 0.5 second.

I want to save some cpu cycles and want to check it every 5 seconds. The option Trigger Timeout is controlling IF the condition is true after 5 seconds repeatedly, but not the condition check itself.

Thanks and Regards
Dirk

Details

Legacy ID
2691079628
Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
Scripting
Additional Information

currently i am creating some trigger based scripts, because i want to get rid of while loops on the server.

While i programmed the scripts i tried find the most efficient way to analyze clientactions. The trigger seemed to be a solution, because these are directly engine integrated and hopefully optimized actions.

I played around with triggers and this sample trigger has been created:
_triggerTimeset setTriggerStatements [

"[thislist] call armajunkies_fnc_aj_TriggerCondition",
"this",
Activation
format["[thislist, thisTrigger, '%1',true] spawn armajunkies_fnc_aj_onTerrTriggerStatusChange;conditiontime=time+5; player globalchat 'act'",_name],
// Deactivation

        ""

];

armajunkies_fnc_aj_TriggerCondition:
_triggerlist = _this select 0;
_active = false;
player globalChat str _thislist;

//TODO Es muss doch eine bessere Lösung geben?
{
if(isplayer _x && alive _x && ((getpos _x) select 2) < 15) then {_active=true;player globalChat "yep";};
} forEach _triggerlist;

player globalChat format["end with %1",_active];

_active


Reason for the function: I was not able to check if a playerobject is in the thislist by using in or count for the trigger from a dedicated server.
However: The code showed the impact on my server (the little helper messages). If i have 20 triggers, which i cant optimize in their way to check the condition, than i produce a massive overhead on the cpu.

Event Timeline

Bohemia edited Steps To Reproduce. (Show Details)Feb 4 2015, 9:36 PM
Bohemia edited Additional Information. (Show Details)
Bohemia set Category to Scripting.
Bohemia set Reproducibility to Always.
Bohemia set Severity to None.
Bohemia set Resolution to Open.
Bohemia set Legacy ID to 2691079628.May 7 2016, 8:13 PM

This condition will make your function run about every 5 sec:

"round (time % 5) == 0 && {[thislist] call armajunkies_fnc_aj_TriggerCondition}"

Bohemia added a subscriber: Bohemia.May 7 2016, 8:13 PM

Hello KK,

thanks for this answer. The condition solves the problem.
Just for the others, because i want to link this issue to the biki.

Condition Eval Order: First Condition && Second Condition
If the first condition fails the code, marked as code with {} will not be executed.

First condition: Modulo time.
If the Modulo is able to divide the current time without a rest, the condition is true.
It is a perfect condition for this purpose.

I was not able to get this idea. Because my programming knowledge is not fresh. I am a server administrator and forgot some really important mathematic operations.

Please feel free to correct me.
The fr can be closed it is solved.

LouMontana closed this task as Resolved.Nov 6 2020, 4:01 PM
LouMontana updated the task description. (Show Details)
LouMontana edited Steps To Reproduce. (Show Details)
LouMontana edited Additional Information. (Show Details)
LouMontana set Operating System to Windows 7.