setDirection – Talk
Lightwolf's Note
-https://community.bistudio.com/wiki?title=setDirection&oldid=88331
I had very different results to your claim. This command does work with Arma 3 locations. If you read carefully, it only changes the orientation of the area and icon if it has one. This code demonstrates the icon rotation:
location2 = createLocation ["VegetationPalm", getpos player, 200, 200];
Location2 setText "Benargee's Palm Tree";
Location2 setDirection 45;
Now observe the map and you will see the icon is rotated 45 degrees. The text is not rotated as that would make no sense.
The only thing that stands true, is that you can not edit preexisting locations built into the map.
EDIT: To prove that not only the icon rotates, but also the area, here is a script that provides visual demonstration:
//set parameters so that marker reflects location's exact area. feel free to change area and angle.
xArea = 10;
yArea = 30;
pos = position player;
angle = 45;
//create marker for visualization
marker2 = createMarker ["mk2", position player ];
"mk2" setMarkerShape "RECTANGLE";
"mk2" setMarkerBrush "Border";
"mk2" setMarkerSize [xArea, yArea];
"mk2" setMarkerDir angle;
"mk2" setMarkerColor "ColorBlack";
//create location and set parameters
location2 = createLocation ["VegetationPalm", (getMarkerPos "mk2"), xArea, yArea];
Location2 setText "Benargee's Palm Tree";
Location2 setDirection angle;
location2 setRectangular true;
null = [] spawn {while {true} do {hintSilent ("Am I in the location?\n" + (str (getpos player in location2))); sleep 0.1;};};
Here you will have a script that shows you the area is in fact rotated, and a hint that tells the player is in the location or not. You will notice the hint is consistent with the map marker area. (A3 1.40) --Benargee (talk) 18:52, 30 March 2015 (CEST)
Lightwolf's Answer:
Thx also to you, for your quick answer, i got also a qick answer from http://feedback.arma3.com/view.php?id=18867
now i know my misstake!
My problem was not the "set Direction" command, it was the "direction" command!
The Variable of the Location when i use the direction command, have to be Global, not Local!
//Example 1:
_locationDir = direction _location_X; //<-- do not return anything, not work!
//Example 2:
_locationDir = direction location_X; //<-- Works perfect.
I'm really happy that now my script works XD....
My script find all locations on altis, and create a marker for each, with the right position size and angle.
and diffrent color for diffrent types (ex: Namecity,Namevillage)
so it works fine, and found all the locations,... but now im wondering about some City Locations!
Kavala for example, not all the houses inside the location?
Do you know if this correct? or i did something wrong?
Or/and is there a way to edit the predefined Locations (like Kavala for example)?
Here my finished Script:
// Find Location Script
//Define the Search-Settings
// Settings: Choose Location of Interest
_My_Searchpool = []; // <- Do Not Change! (_My_Searchpool = [];)
_My_Searchpool_nr = 0; // 0 = All Towns and City with Citycenter
// 1 = All Towns and City
// 2 = Only "NameLocal" (Lone or small Village)
// 3 = Only "NameVillage" (Village)
// 4 = Only "NameCity" (Small City/town)
// 5 = Only "NameCityCapital" (Big City)
// 6 = Only "CityCenter" (Center of Citys)
// 20 = Only "Hill"
// 30 = Only "StrongpointArea" <-- not predefined
// 40 = Only "Airport" <-- not predefined
// 60 = Only "NameMarine"
//not predefined Locations:
// Strategic, StrongpointArea,
// FlatArea, FlatAreaCity, FlatAreaCitySmall
// Airport, ViewPoint, RockArea, BorderCrossing
// VegetationBroadleaf, VegetationFir, VegetationPalm, VegetationVineyard
// Settings: Center Coordinates of the Search Radius
_My_COORD_XY = []; // Let it Empty to use defined Coordinates (Example: _My_COORD_XY = [];)
// Input your own Coordinates (Example: _My_COORD_XY = [9727.9033, 22299.189];
_My_COORD_XY_nr = 1;// 0 = Select your Own new defined Coordinates (inputted at _My_COORD_XY = [9727.9033, 22299.189];)
// 1 = Default (Center of Altis)
// Settings: Range of Search Area
_My_Range_X = 0; // input your own Range (Example: _My_Range_X = 0;)
_My_Range_X_nr = 1; // 0 = To Select your Own defined Range (inputted at _My_Range_X = 0;)
// 1 = Default (Whole Map, from the Center of Altis, means )
// (Do not Touch the Script below, otherwise may it not works anymore!)
//>>> The Script convert data from Settings to the Scriptcode
switch (true) do {
case (_My_Searchpool_nr == 0): {_My_Searchpool = ["NameLocal","NameVillage","NameCity","NameCityCapital","CityCenter"];};
case (_My_Searchpool_nr == 1): {_My_Searchpool = ["NameLocal","NameVillage","NameCity","NameCityCapital"];};
case (_My_Searchpool_nr == 2): {_My_Searchpool = ["NameLocal"];};
case (_My_Searchpool_nr == 3): {_My_Searchpool = ["NameVillage"];};
case (_My_Searchpool_nr == 4): {_My_Searchpool = ["NameCity"];};
case (_My_Searchpool_nr == 5): {_My_Searchpool = ["NameCityCapital"];};
case (_My_Searchpool_nr == 6): {_My_Searchpool = ["CityCenter"];};
case (_My_Searchpool_nr == 20): {_My_Searchpool = ["Hill"];};
case (_My_Searchpool_nr == 30): {_My_Searchpool = ["StrongpointArea"];};
case (_My_Searchpool_nr == 40): {_My_Searchpool = ["Airport"];};
case (_My_Searchpool_nr == 60): {_My_Searchpool = ["NameMarine"];};
};
switch (true) do {
case (_My_COORD_XY_nr == 1): {_My_COORD_XY = [15000,16000];};
};
switch (true) do {
case (_My_Range_X_nr == 1): {_My_Range_X = 100000;};
};
//<<< End convert data from Settings
// Now the script start the search process
_nearestCity = nearestLocations [_My_COORD_XY, _My_Searchpool, _My_Range_X];
// Here the script define the Variables we need for our results below
_nearestCity_countall = count _nearestCity; //count all found Objects
_location_selectNr = 0; //selectnr we need to select the right location in the _nearestCity array
_location_X = _nearestCity select _location_selectNr; //location_x is the selcted Location from the Array
// Now the script creates a marker for each found Location
_getLocationshape = objNull;
_locationMarker_X = objNull;
_locationMarker_list = objNull;
_locationMarker_list = [];
while {_nearestCity_countall >= 1} do {
_location_X = _nearestCity select _location_selectNr;
_locationType = type _location_X;
_locationShape = rectangular _location_X;
_locationPos = position _location_X;
_locationsize = size _location_X;
location_X = _location_X;
_locationDir = direction location_X;
switch (_locationType) do {
case "NameLocal": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorOrange";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "NameVillage": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorRed";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "NameCity": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorPink";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "NameCityCapital": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorYellow";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "CityCenter": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorBlack";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "StrongpointArea": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorGrey";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "Airport": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorUNKNOWN";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "NameMarine": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorBlue";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
case "Hill": {
_getLocationshape = objNull;
if (_locationShape) then {_getLocationshape = "RECTANGLE";} else {_getLocationshape = "ELLIPSE";};
_this = createMarker [format ["%1%2", _locationType, _location_selectNr], _locationPos];
_this setMarkerShape format ["%1", _getLocationshape];
_this setMarkerType "mil_flag";
_this setMarkerDir _locationDir;
_this setMarkerColor "ColorGreen";
_this setMarkerBrush "Solid";
_this setMarkerSize _locationsize;
};
};
_locationMarker_X = format ["%1%2", _locationType, _location_selectNr];
_locationMarker_list = _locationMarker_list + [ _locationMarker_X ];
_location_selectNr = _location_selectNr + 1;
_nearestCity_countall = _nearestCity_countall - 1;
sleep 0.01;
};
sleep 1;
// make local markerlist array to a Global Variable, to used by other script sqf (ex: to delete all the marker)
locationMarker_list = _locationMarker_list;
//{DeleteMarker _X} forEach _locationMarker_list; //<--- use this script code to delete all the created marker!
After preview this comment, i tried to copy paste it, to check if it also work, but seems that it only will work when you write it again, so its here just to see what i've done... --Lightwolf (talk) 00:42, 1 April 2015 (CEST)