Jump to content

Recommended Posts

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

@_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

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

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

@_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!

  • Like 1

Share this post


Link to post
Share on other sites

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

@_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! 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×