Jump to content
black_hawk_mw2_87

Use Map Flags To Teleport To A Position

Recommended Posts

Hello, community! I have seen such a script, but I can't find it anywhere:

- the player needs to complete multiple tasks;

- he's debriefed by his HQ and must open a local map (EDEN item, placed on the map);

- when he interacts with the map, a map is opened all over the screen;

- all tasks are visible on this map as flags;

- the flags' markers change its size (grow a little) when the mouse marker is pointing at them;

- during this action a text with description is shown next to the current flag marked;

- when you click on the flag, you will be teleported to the location;

- I want to use the script on the VR map for testing and then move it to the mission's map;

- I want another such map asset (item) to be temporary spawned next to me (near player's new location) after being teleported, so the player can go back to the HQ debriefing area, once the task is completed (the player will be allowed to do that only when it's finished /this is not a mandatory condition/). | The second possible variant is just another copy of the map item at the specific task location, but the condition with the task completed must be "true";

- I want the task to be activated, when the player is just spawned and teleported to the task's location, so I guess I will have to put a trigger there.

Thanks for the help in advance! 🙂

Share this post


Link to post
Share on other sites

I was talking about a "strategic map" script. Now I have found out how to call it out and use it, but is there a way to do that via a scroll up down command, for example: addAction ir anything else like it? 🙂

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

Here's a generic Hold Action for you,

 

Spoiler

openMAP=[ 
 player, 
 "Open Strategic Map", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "alive player", 
 "alive player", 
 {}, 
 {}, 
 {PUT MAP CALL HERE!}, 
 {}, 
 [], 
 2, 
 0, 
 false, 
 true 
] call BIS_fnc_holdActionAdd;

 


Put your map call where it says HERE.

Have fun!

  • Like 2

Share this post


Link to post
Share on other sites
27 minutes ago, black_hawk_mw2_87 said:

but is there a way to do that via a scroll up down command, for example: addAction ir anything else like it? 🙂

Well, basically this:

player addAction ["Teleport",{player setPos [1234,5678,0]}];

https://community.bistudio.com/wiki/addAction

 

Edit: I haven't used the hold action function, but @wogz187 suggestion would be worth looking at.

  • Like 3

Share this post


Link to post
Share on other sites

So, this using @beno_83au example

 

Spoiler

openMAP=[ 
 player, 
 "Open Strategic Map", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "alive player", 
 "alive player", 
 {}, 
 {}, 
 {player setPos [1234,5678,0]}}, 
 {}, 
 [], 
 2, 
 0, 
 false, 
 true 
] call BIS_fnc_holdActionAdd;

 

Have fun!

  • Like 4

Share this post


Link to post
Share on other sites
37 minutes ago, wogz187 said:

So, this using @beno_83au example

 

  Hide contents


openMAP=[ 
 player, 
 "Open Strategic Map", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "alive player", 
 "alive player", 
 {}, 
 {}, 
 {player setPos [1234,5678,0]}}, 
 {}, 
 [], 
 2, 
 0, 
 false, 
 true 
] call BIS_fnc_holdActionAdd;

 

Have fun!

@wogz187, @beno_83au Thank you both! You are amazing! This is outstanding! You are real friends to be honest! 🙂 So, if I am right, this is the entire script I need to use? 🙂 I mean, both of you have suggested 2 different scripts, but, if I am not wrong, the one above is the combined version of them? 🙂

Cheers! 🙂

  • Like 2

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

Beno's is an add action and the other one is hold add action. So the first one will be in the action menu, just tap space or mmb to activate. The second one you have to hold the button until the wheel icon fills (the value 2 is the length of the hold action).

  • Like 2

Share this post


Link to post
Share on other sites
17 minutes ago, wogz187 said:

@black_hawk_mw2_87,

Beno's is an add action and the other one is hold add action. So the first one will be in the action menu, just tap space or mmb to activate. The second one you have to hold the button until the wheel icon fills (the value 2 is the length of the hold action).

So, I put them both inside the map's item (white board for example) one after another in its init field? The first one adds the action and the other one makes the player use the hold action to activate it? 🙂 I hope it ain't quite confusing as an explanation already... 😄

  • Like 1

Share this post


Link to post
Share on other sites
On ‎9‎/‎2‎/‎2019 at 11:07 PM, black_hawk_mw2_87 said:

I promise I will test both versions, so thank you, fellas! 🙂

Hello, friends.

I did not want to create a new topic having a question in connection to this one. I would like to do something more in addition to this working dynamic map. So here it is:

Let us say I have created X numbers of tasks that can be chosen from the map to complete. I need a script that checks if all the tasks are completed. In this case the scenario would be successfully finished. Let's say I would use a variable name for each single task called "task1, task2..." etc. What would you suggest me to do? I need an option that can be used in a trigger because it would be much easier and I have a reason for that: I could eventually decide to - 1. start a final task to report in that all of the tasks are completed, or 2. directly complete the scenario.

Thank you in advance and cheers! 🙂

Share this post


Link to post
Share on other sites
33 minutes ago, black_hawk_mw2_87 said:

Hello, friends.

I did not want to create a new topic having a question in connection to this one. I would like to do something more in addition to this working dynamic map. So here it is:

Let us say I have created X numbers of tasks that can be chosen from the map to complete. I need a script that checks if all the tasks are completed. In this case the scenario would be successfully finished. Let's say I would use a variable name for each single task called "task1, task2..." etc. What would you suggest me to do? I need an option that can be used in a trigger because it would be much easier and I have a reason for that: I could eventually decide to - 1. start a final task to report in that all of the tasks are completed, or 2. directly complete the scenario.

Thank you in advance and cheers! 🙂

OK..I'm trying to help here...let's see:

 

You need to create a parent task, let's say "Disrupt enemy operations".

Then,  you'll need to create a series of "child tasks".

-clear Enemy base ///child task 1

-Destroy SAM sites ///child task 2

-Assassinate Enemy Commander ///child task 3

-destroy ammo depot. ///child task 4

Once child tasks 1,2,3,4 are complete, then the parent task is fulfilled.

 

 

 

In one of my mission, I use this script to achieve that.

//make sure these 3 are identical inside the _makeTaskN arrays
_myTaskIDs = ["Task01","Task02","Task03"];

//this task will be the parent task and checks if all three sub tasks are complete
_makeParentTask = ["ParentTask01",player,[format ["Put the CERBERUS Crime Inc. out of business by killing all the BOSSES, destroying all the STOCKPILES and clearing all the HIDEOUTS !"],"DISMANTLE ALL CERBERUS ACTIVITIES",""],objNull,"ASSIGNED",4,true,true,"target"];
_makeParentTask2 = ["ParentTask02",player,[format ["Eliminate ALL the CERBERUS HVT"],"Eliminate ALL the CERBERUS HVT",""],objNull,"ASSIGNED",1,true,true,"kill"];
_makeParentTask3 = ["ParentTask03",player,[format ["Suppress the Air Defenses Network to allow CAS and HELI TRASPORT, as well as SUPPLY and VEHICLE drop. Use the CRUISE MISSILES support or place explosive to destroy  RADAR and SAM site."],"Suppression of Enemy Air Defenses",""],objNull,"ASSIGNED",2,true,true,"DESTROY"];



//_makeParentTask4 = ["ParentTask04",player,[format ["Put the NARCOS out of business!"],"Complete all three tasks!",""],objNull,"ASSIGNED",0,true,true,"target"];

_makeTask1 = [["Task01","ParentTask01"],player,["Destroy ALL NARCOTICS,MONEY and WEAPONS stockpiles","Destroy ALL STOCKPILES",""],objNull,"ASSIGNED",3,true,true,"destroy"];
_makeTask2 = [["Task02","ParentTask01"],player,["Clear all the CRIMINALS hideouts in the RED circles.More you clear, more will disclose/unlock.","Clear ALL HIDEOUTS",""],objNull,"ASSIGNED",2,true,true,"attack"];

_makeTask20 = [["Task20","ParentTask03"],player,["<marker name='samtask'>SEEK and DESTROY</marker> SAM site to Suppress the Air Defenses Network<img image='pictures\sam.jpg'/>","Destroy SAM site",""],objNull,"ASSIGNED",4,true,true,"destroy"];
_makeTask21 = [["Task21","ParentTask03"],player,["<marker name='radartask'>SEEK and DESTROY</marker> RADAR site to Suppress the Air Defenses Network<img image='pictures\radar.jpg'/>","Destroy RADAR site",""],objNull,"ASSIGNED",5,true,true,"destroy"];
_makeTask23 = [["Task23","ParentTask02"],player,["Eliminate the NARCOS Boss IVAN LAZARAT<img image='pictures\balkan_hvt2.jpg'/>","KILL IVAN LAZARAT",""],objNull,"ASSIGNED",6,true,true,"kill"];
_makeTask24 = [["Task24","ParentTask02"],player,["Eliminate the MAFIA Boss MARIO CASALESI<img image='pictures\italy_hvt2.jpg'/>","KILL MARIO CASALESI",""],objNull,"ASSIGNED",7,true,true,"kill"];
_makeTask25 = [["Task25","ParentTask02"],player,["Eliminate the WEAPONS smuggler Boss NIKOLAY TAMBOV<img image='pictures\russia_hvt.jpg'/>","KILL NIKOLAY TAMBOV",""],objNull,"ASSIGNED",8,true,true,"kill"];
_makeTask26 = [["Task22"],player,["Meet your TEAM by the tactical area","Meet your TEAM",""],getPosASL deck,"ASSIGNED",1,true,true,"meet"];
//_makeTask8 = [["Task08","ParentTask03"],player,["Kill NARCOS HVT","Kill NARCOS HVT",""],"ASSIGNED",0,true,true,"kill"];
//_makeTask9 = [["Task09","ParentTask03"],player,["Pick up suitcase nr. 3","Pick up suitcase nr. 3",""],"ASSIGNED",0,true,true,""];



//spawning loops to handle individual task conditions
//this is an easy way to edit and read/handle task conditions and results
TexTask1 = false;
TexTask2 = false;
//TexTask = false;
TexTask23 = false;
TexTask24 = false;
TexTask25 = false;
//TexTask7 = false;
//TexTask8 = false;
//TexTask9 = false;
ParentTask01 = false;
ParentTask02 = false;
ParentTask03 = false;



_watchTask1 = [] spawn {
	
	_box = [];
	waitUntil {sleep 0.5; !alive (drugBox) AND !alive (drugBox2) AND !alive (drugBox3) AND !alive (moneyBox) AND !alive (moneyBox2) AND !alive (moneyBox3) AND !alive (weaponBox) AND !alive (weaponBox2) AND !alive (weaponBox3)};
	["Task01", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	TexTask1 = true;
	sleep 5;
	//waitUntil {sleep 0.5; (!alive drugBox};
    //deleteMarker "drugBoxMarker1";
	//sleep 1;
	saveGame;
};

_watchTask2 = [] spawn {


	_areas = ["NARCOS","NARCOS_1","NARCOS_2","NARCOS_3","NARCOS_4","NARCOS_5","NARCOS_6","NARCOS_7","NARCOS_8","NARCOS_9","NARCOS_10","NARCOS_11","NARCOS_12","NARCOS_13","NARCOS_14","NARCOS_15","NARCOS_16","WEAPONS","WEAPONS_1","WEAPONS_2","WEAPONS_3","WEAPONS_4","WEAPONS_5","WEAPONS_6","WEAPONS_7","WEAPONS_8","WEAPONS_9","WEAPONS_10","WEAPONS_11","WEAPONS_12","WEAPONS_13","WEAPONS_14","WEAPONS_15","MONEY","MONEY_1","MONEY_2","MONEY_3","MONEY_4","MONEY_5","MONEY_6","MONEY_7","MONEY_8","MONEY_9","MONEY_10","MONEY_11","MONEY_12"]; //list of markers using EOS //list of markers using EOS

	//you don't need an if condition here but more likely waitUntil
	waitUntil {sleep 1; { getMarkerColor _x == "ColorGreen"; } count _areas == count _areas};


	["Task02", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	TexTask2 = true;
	sleep 5;
	saveGame;

};


_watchTask23 = [] spawn {

	waitUntil {sleep 0.5;!alive (ZAG_HVT1)};
	["Task23", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	TexTask23 = true;
	sleep 5;
	saveGame;

};
_watchTask24 = [] spawn {

	waitUntil {sleep 0.5;!alive (ZAG_HVT3)};
	["Task24", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	TexTask24 = true;
	sleep 5;
	saveGame;

};
_watchTask25 = [] spawn {

	waitUntil {sleep 0.5;!alive (ZAG_HVT2)};
	["Task25", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	TexTask25 = true;
	sleep 5;
	saveGame;

};
_watchParentTask = [] spawn {



	waitUntil {sleep 0.5;!alive (ZAG_HVT1) AND !alive (ZAG_HVT2) AND !alive (ZAG_HVT3)};
	["ParentTask02", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	systemchat "ALL CARTEL's BOSSES ELIMINATED";
	ParentTask02 = true;
	sleep 10;
	

};

_watchParentTask = [] spawn {



	waitUntil {sleep 1;!alive (SAM) AND !alive (SAM_1)};
	["ParentTask03", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
	systemchat "CARTEL's AIR DEFENSES NETWORK DESTROYED";
	ParentTask02 = true;
	sleep 10;
	savegame;

};

SLEEP 5;
_watchParentTask = [] spawn {



	waitUntil {sleep 1;(TexTask1 AND TexTask2 AND TexTask23 AND TexTask24 AND TexTask25)};

	if (TexTask1 AND TexTask2 AND TexTask23 AND TexTask24 AND TexTask25) then {

		["ParentTask01", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
		systemchat "ALL TASK COMPLETED";
		ParentTask01 = true;
		sleep 5;
		"END1" call BIS_fnc_endMission;
	    //saveGame;

	};
};

{_x call BIS_fnc_setTask;sleep 3;} foreach [_makeParentTask,_makeParentTask2,_makeParentTask3,_makeTask1,_makeTask2,_makeTask20,_makeTask21,_makeTask23,_makeTask24,_makeTask25,_makeTask26];

I hope it helps man!!

  • Like 3

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87

Create the variable somewhere,

taskComplete=0;

and each time a task completes,

taskComplete= taskcomplete +1;

then,

if (taskComplete== #ofTasks) then {	//configure # of tasks
systemChat format ["You completed %1 tasks. Mission complete.", taskComplete];
};

and you can enclose the previous in a waitUntil if that serves your purpose.

This topic has a bit more about actually using the task framework,



Have fun!

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, black_hawk_mw2_87 said:

Thank you very much, guys! I will test it tomorrow! 🙂 You are very helpful, as always. 🙂 I will later share the results! 🙂 Cheers!!!

Hello, guys, I have tried to set up a simple test scenario, but I have some strange errors. I have used this very old tutorial to create a strategic map:

I have done everything the way it is shown, but when I open the map, an error pops up:

'player |#|setPos [_this select 0];'

Error 1 elements provided, 3 expected

Another issue I have when I tried using this code:

openMAP=[ 
 player, 
 "Open Strategic Map", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "alive player", 
 "alive player", 
 {}, 
 {}, 
 {PUT MAP CALL HERE!}, 
 {}, 
 [], 
 2, 
 0, 
 false, 
 true 
] call BIS_fnc_holdActionAdd;

I put it in a map board init field and it adds the addAction to it, the map is called _map and I put this name inside the code: {_map}, but it shows another error - Init: Reserved variable in expression. I tried to put it in the init.sqf file, but I got the same error. Please, help. 😄

Share this post


Link to post
Share on other sites

Change the variable's name. A reserved variable is something reserved by the game (e.g _this). I've never tried _map so I've never seen it cause an error. It's not listed here or here though but maybe it is one anyway?

 

Also, at a guess, try:

player setPos (getPos (_this select 0));

Depends where it's run from though, but setPos needs a position - https://community.bistudio.com/wiki/setPos

  • Like 1

Share this post


Link to post
Share on other sites
59 minutes ago, beno_83au said:

Change the variable's name. A reserved variable is something reserved by the game (e.g _this). I've never tried _map so I've never seen it cause an error. It's not listed here or here though but maybe it is one anyway?

 

Also, at a guess, try:


player setPos (getPos (_this select 0));

Depends where it's run from though, but setPos needs a position - https://community.bistudio.com/wiki/setPos

I tried with "map1", but I got the same error again.

Then, inside the strategic modules for the both tasks, I have changed the line with the one you provided me, the one above. Now another error shows up:

'player setPos (getPos (_this select 0));'

Error getpos: Type Array, expected Object,Location

So, I guess, this "marked location" has to be defined on the map itself. We can probably use an object (for example a house or something else around could be used for a location), so the player must spawn at its location. 😄

Share this post


Link to post
Share on other sites

So, friends, my map board is called "myMap". I tried this code:

[ 
 myMap,            
 " Open Strategic Map",           
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "_this distance _target < 3",       
 "_caller distance _target < 3",       
 {},             
 {},             
 { _this call _target },     
 {},             
 [],             
 12,             
 0,             
 true,            
 false             
] remoteExec ["BIS_fnc_holdActionAdd", 0, myMap];

Well, it didn't work, but it was the only one code, that did not show me an error and let me click the OK button. 😄 But then it says:

'...

{},

{ _this |#|call _target },

{},

Error call: Type Object, expected code

What should I do now? 🙂

Cheers!

Share this post


Link to post
Share on other sites

@beno_83au It's still not working for me... Would you help me with the entire code or just send a simple VR scenario to see how it works? I will be very thankful. 🙂 And this is an old, but important thread, so it would be very helpful to a lot of people. Thank you for your understanding. Cheers! 🙂

Share this post


Link to post
Share on other sites

I'll have a look, but your code - { _this call _target } - is basically doing this:

[myMap,player,0,[]] call myMap

As _this contains the variables referred to here: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd

And _target is myMap, but when you use call it's trying to call code, and myMap is an object, not code.

 

[
	myMap,
	"Open Strategic Map",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
	"_this distance _target < 3",
	"_caller distance _target < 3",
	{},
	{},
	{
			params ["","_caller"];
			_caller setPos [x,y,z]; <------- position
	},
	{},
	[],
	12,
	0,
	true,
	false
] call BIS_fnc_holdActionAdd;

[x,y,z] needs to be a position if you want a player to be teleported to somewhere after they've finished the holdAction. But what exactly do you want to happen after the action finishes? I don't know about the strategic map though, I've never used it.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, beno_83au said:

I'll have a look, but your code - { _this call _target } - is basically doing this:


[myMap,player,0,[]] call myMap

As _this contains the variables referred to here: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd

And _target is myMap, but when you use call it's trying to call code, and myMap is an object, not code.

 


[
	myMap,
	"Open Strategic Map",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
	"_this distance _target < 3",
	"_caller distance _target < 3",
	{},
	{},
	{
			params ["","_caller"];
			_caller setPos [x,y,z]; <------- position
	},
	{},
	[],
	12,
	0,
	true,
	false
] call BIS_fnc_holdActionAdd;

[x,y,z] needs to be a position if you want a player to be teleported to somewhere after they've finished the holdAction. But what exactly do you want to happen after the action finishes? I don't know about the strategic map though, I've never used it.

I just wanted to open the map using the holdAction function and then see the tasks I have marked on it. I know how to set up the tasks on the map, so we are dealing only with the function to open the map, not to teleport the player using the code. The teleportation can be completed by player's choice after he can see the tasks on the map. So, basically, I would not want this part with the setPos [x, y, z], but only to open the map with the tasks. I have provided the video above as an example of how to use a trigger to open the strategic map itself. So what I need is a condition inside your code, that replaces the "presence" condition of the trigger, which would actually activate the map. Thanks again for the efforts! 🙂 I truly appreciate this! 🙂

Share this post


Link to post
Share on other sites

Thank you for the help and support, but I really give up. I tried some variants, but they don't let me achieve my final goal. Can you help me making it work? 🙂

 

Share this post


Link to post
Share on other sites
3 hours ago, black_hawk_mw2_87 said:

but I really give up

Never, EVER give up bro! Get around it if necessary, but never give up.

 

I use to have a test mission somewhere set up for strategic map>tasks thing...let me see what I can do.

  • 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

×