_WARHAWK_ 2 Posted June 12, 2020 Hello, I'm trying to create a task that by pressing a key it completes the task. So far I'm able to link it to complete after a set time but would like it to be: Create Task: Open Map Press Map Key Task Complete. Share this post Link to post Share on other sites
wogz187 1086 Posted June 12, 2020 @_WARHAWK_ You can try something like this,visibleMap Spoiler waitUntil {visibleMap}; _mapTask setTaskState "Succeeded"; *untested Have fun! Share this post Link to post Share on other sites
_WARHAWK_ 2 Posted June 12, 2020 Hmm...ok So I put this into the On Activation box in the Trigger expression? Share this post Link to post Share on other sites
_WARHAWK_ 2 Posted June 12, 2020 Ok that didn't work...I saw something along the lines of this: Triggered when map is opened or closed either by user action or script command openMap. addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; }]; mapIsOpened: Boolean - true if map is opened mapIsForced: Boolean - true if map is forced Would I use this on the trigger or the task module? Share this post Link to post Share on other sites
wogz187 1086 Posted June 12, 2020 @_WARHAWK_, Quote addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; }]; Yeah! Event handlers are great. I should have looked for that first. Spoiler you_mapEvent=addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; if (_mapIsOpened) then { _mapTask setTaskState "Succeeded"; removeMissionEventHandler ["Map",you_mapEvent]; }; }]; Something like this pasted into the init properties dialog should work. Keep in mind it will respond to the first time the map is opened. *Still untested Have fun! 1 Share this post Link to post Share on other sites
_WARHAWK_ 2 Posted June 12, 2020 Ok so I have a Create task to assigned, a Set State task to complete and a trigger right now. Trigger is synced to the set task state module. Which init would I put it in? Share this post Link to post Share on other sites
wogz187 1086 Posted June 12, 2020 @_WARHAWK_, Quote Ok so I have a Create task to assigned, a Set State task to complete and a trigger right now. Trigger is synced to the set task state module. Which init would I put it in? You can paste the above just about anywhere code will stick. Init properties dialog, trigger, waypoint statement, random object's init, init.sqf. The important part is that it is running when the map event happens. So perhaps the trigger which precedes this task. Have fun! 1 Share this post Link to post Share on other sites
_WARHAWK_ 2 Posted June 12, 2020 Got it. Thank you 😄 2 Share this post Link to post Share on other sites