Page MenuHomeFeedback Tracker

sleep + drawicon3d inside foreach loop inside the spawn code scoop will cause strange flickering on icon3d
Closed, ResolvedPublic

Description

drawicon3d will NOT flicker if it is just inside the foreach loop inside the spawn code scoop.
drawicon3d will NOT flicker if it is just inside the foreach loop.
drawicon3d will NOT flicker if it is just inside the spawn and used sleep command together.
try adding 1 sleep command inside the foreach loop inside the spawn code scoop will NOT cause strange flickering on icon3d.
{F24270}

Details

Legacy ID
2848862631
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

create a mission on any map
in editor, add a player unit. and then add 2 more units and give them names. Place those 2 units closely together

please place the uploaded sqf into the mission folder
in the init.sqf, add this line:
call compile preprocessFile "Mission_Giver.sqf";

// After that, in the sqf file, please find line 3, and add the name to the array
Mission_Givers=[yourUnitName];

Additional Information

Strange flickering on icon3d IS ONLY caused by trying to draw multiple icon3ds with the drawicon3d+sleep+foreach commands used altogether.

If drawing multiple icon3ds without sleep command, there will be NO flickering

Event Timeline

benw edited Steps To Reproduce. (Show Details)Jul 9 2014, 3:31 AM
benw edited Additional Information. (Show Details)
benw set Category to Scripting.
benw set Reproducibility to Always.
benw set Severity to None.
benw set Resolution to No Bug.
benw set Legacy ID to 2848862631.May 7 2016, 6:55 PM
Bohemia added a subscriber: Lecks.Jul 9 2014, 3:31 AM
Lecks added a comment.Jul 9 2014, 6:09 AM

I'm pretty sure drawIcon3D is designed to be used onEachFrame, not in a For loop (especially with a sleep). The loop isn't necessarily going to run every frame. The flickering would differ with different frame rates.

Edit: Sorry, just looked at your code. You can have a for loop to draw multiple icons, but you shouldn't have any sleep in there. If it did work as you appear to expect, the game would freeze while waiting for your sleeps to finish.

Tajin added a subscriber: Tajin.May 7 2016, 6:55 PM
Tajin added a comment.Jul 9 2014, 10:00 AM

As Lecks said, "drawIcon3d" has to be run onEachFrame to avoid flickering, that kinda makes the ticked invalid.

Check out the alternative solution of putting drawIcon3d inside a "addAction" condition. (those are also checked on every frame but only when you look towards them which makes it ideal for this sort of thing)

Like others have said, you should use OnEachFrame (https://community.bistudio.com/wiki/onEachFrame) or Draw3D (https://community.bistudio.com/wiki/addMissionEventHandler), because the drawing of the the icons/lines needs to be done every frame.

MadDogX added a subscriber: MadDogX.May 7 2016, 6:55 PM

Mass closing tickets marked as resolved more than 1 month ago.

If the issue is in fact not resolved, please create a new ticket referencing this one and ask for it to be re-opened.