LSValmont 789 Posted April 13, 2019 Guys, I need some help here. I am doing a pretty complex mission that has several custom GUI elements. Lastly I've been experiencing that after several minutes of game play the GUI interfaces begin to take longer and longer to load. AddActions, holdActions, cutText, Inventory EH, Custom Menus etc... all begins to lag and fall behind. Server and client FPSs are fine it is just the GUI elements that lag (Like a memory leak of some sort). Any idea how could I find out what script could be causing the issue or track down the cause somehow other than removing scripts one by one and then testing the mission for hours each time... Share this post Link to post Share on other sites
GEORGE FLOROS GR 4206 Posted April 13, 2019 3 minutes ago, LSValmont said: begin to take longer and longer to load. It might be that you keep accidentally spawning more than one time the same code. If yes , you can add a check with a Variable. Else check also : https://community.bistudio.com/wiki/Initialization_Order 1 Share this post Link to post Share on other sites
pierremgi 4737 Posted April 14, 2019 enable debug console (if not) and: count diag_activeSqfScripts in watch line then, run: copytoclipboard str diag_activeSqfScripts If you wrote the codes, you can see how much time they are repeated and if it's OK (not saying it's wrong, but many spawned codes on many units are resource consuming and must terminate). Chase for: - while {true} loops. Is it necessary, If yes, can you group some codes? - endless waitUntil conditions . Example: waitUntil {!alive someDisableDamageUnit}; - repetitive codes for nuts! Classic: While {true} do { {<add some EHs> } forEach allUnits }; Should be: While {true} do { {<add some EHs>; _x setVariable ["checkVarHere",true] } forEach (allUnits select {isNil {_x getVariable "checkVarHere"} }); etc... In scenario: Do not spawn too much units for nuts. Use BI dynamic simulation and corpse/wreck management. You can script your own spawn/despawn especially for ambient/civilian life without tactical context. And the best for the end. 1 1 Share this post Link to post Share on other sites
LSValmont 789 Posted April 14, 2019 Thank you both George and Pier Quick question, what would be the best way to prevent duplicate scripts from running on the same unit? 1 Share this post Link to post Share on other sites
pierremgi 4737 Posted April 14, 2019 2 hours ago, LSValmont said: Thank you both George and Pier Quick question, what would be the best way to prevent duplicate scripts from running on the same unit? As I wrote above. Add a variable on the unit (here checKVarHere in my example) and run the code only when the variable is nil: like this: isNil {_x (or your unit) getVariable "checkVarHere"} // pay attention for the syntax: isNil { someThing getVariable stringedVariable } So, define it by any value inside your code: _x (or your unit) setVariable ["checkVarHere", someValue]; 1 Share this post Link to post Share on other sites