Search the Community
Showing results for tags 'find'.
Found 12 results
-
Looking for help with implementing a weapon to ARMA 3
jKal95 posted a topic in ARMA 3 - FIND OR OFFER EDITING
Hi, I'm looking for someone willing to help me in implementing a weapon to ARMA 3. I have the model, textures and sounds ready, alas I don't possess the skill of actually modding the weapon in to the game. Much appreciated. -JK- -
Need help to find the intented Target of AI
Heavensrevenger posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey I want to make the C-RAM bullets explode if they fly past the target. I know how I'll do the Code but I don't know how to get the object that the C-RAM is currently shooting at. Any help is appreciated! -
optimization [SOLVED] 5 lines only. Can you do it with less?
thy_ posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, folks. Is there any chance you share a faster or more elegant way to write the same result below? Code goal: at the mission starts, search once all named markers and remove all found markers that aren't area markers (rectangles and ellipses), saving the result in a list for further purposes. Pretty sure even the first code line below could be smarter/complete. // Search through all markers on the map with the prefix "mark_" and append them in a list: _areaMarkersOnly = allMapMarkers select {_x find "mark_" isEqualTo 0}; // result example: ["mark_1", "mark_garbage", "mark_2"] but unfortunately including markers with unwanted shapes. { // forEach in _areaMarkersOnly: // It will be needed to identify what will be deleted later: _index = _areaMarkersOnly find _x; // If the marker (_x) is NOT rectangle and is NOT ellipse, so... if ( (markerShape _x != "RECTANGLE") AND (markerShape _x != "ELLIPSE") ) then { // delete this marker from my list: _areaMarkersOnly deleteAt _index; }; } forEach _areaMarkersOnly; SOLVED! Below, you see the code that works for me after the community advice: _acceptableShapes = ["RECTANGLE", "ELLIPSE"]; _prefix = "mark_"; if ( !_debug ) then { // Selecting only relevant markers: _areaMarkersOnly = allMapMarkers select { (_x find _prefix == 0) AND {(markerShape _x) in _acceptableShapes} }; } else { // For debugging purporses, the way to select the relevant markers here it is slightly different. Now selecting all markers shapes: _areaMarkersOnly = allMapMarkers select { _x find _prefix == 0 }; { // forEach _areaMarkersOnly: // _x index in the list, need it to delete _x from the list: _markerIndex = _areaMarkersOnly find _x; // if the marker has no the shapes acceptables, do it: if ( !((markerShape _x) in _acceptableShapes) ) then { // delete the marker from the list: _possibleMinefields deleteAt _markerIndex; // delete the marker from the map: deleteMarker _x; // and print this messages: systemChat format ["DEBUG > Marker '%1' has NO a rectangle or ellipse shape to be considered a area marker.", _x]; }; } forEach _areaMarkersOnly; }; -
Hello, I'd like to ask you if you could help me with this script. I'd like to make intel that is possible to collect by one side and that's BLUFOR. So there would be visible action on intel for BLUFOR but OPFOR would not see that action. Any ideas please?
- 16 replies
-
Hello, I'm trying to set up a script for an artillery to fire on a marker. I have found a script but I need to find the config name of the M4 scorchers ammo. Can somebody help?
-
Find positions for forest borders
Niktus Acid posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I was wondering if there is any way to find forest border/edges positions. nearestTerrainObjects command has the option to search this with typename "FOREST BORDER" but this always return nothing, so no luck here. selectBestPlaces makes use of different expression, but I can't find any combination that suits my needs, something that exactly returns different points where a forest and a meadow joins (and without killing cpu/fps in the process) I'm trying to give AI the best instructions possible for waypoints and forest borders are massive strategic points. Any idea somebody? Thanks! -
Hi! I didn't see a topic addressing this issue, but I recently downloaded Arma 3 to my new desktop and for some reason I am unable to join SOME of the wasteland servers my friends go to play in. I am not getting any error messages or anything such because the browser CANNOT FIND the servers even tho the guys are clearly playing in there. I've tried joining through steam's "join game" feature but it says that the server is not responding. Here's a screenshot of it: So. Any idea? I am simply stumped as after googling for an hour I only found issues of not being able to join a friends server and this should not be the case as I have opened those ports on my router well over a year ago and they are still open and I am trying to join dedicated servers, not some listen server of my friend. I did place static IP's for my desktop and PS4 and it would be very strange if that affected it (It did make it impossible for my macbook pro to connect the wifi for some fethin reason.) I've made exceptions to my firewall rules and all that but nothing. As I said only SOME of the servers do this but SURPRISE SURPRISE the best ones are the ones that my server browser cant' find. Thanks in advance
-
Finding random position in area with uniform distribution
mind posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey, Small topic for those who love to play around with randomness. Have you ever tried to find random point in circle? Let`s try find a random point around player in 1000 meters radius. So we can write something like. player getRelPos [random 1000, random 360]; And here we go, seems cool right? No it is not. Let`s try do that 5000 times, and put a marker for each resulting position. for "_i" from 0 to 5000 do { _pos = player getRelPos [random 1000, random 360]; _markerstr = createMarkerLocal [str random 100,_pos]; _markerstr setMarkerShapeLocal "ICON"; _markerstr setMarkerTypeLocal "hd_dot"; }; Here what we gonna have. As you can see it is not random at all. Dots are concentrated towards center. So how can we have unified distribution? We can write following: for "_i" from 0 to 5000 do { _radius = 1000; _randomValue = random _radius; _distributedValue = _randomValue; if ((1-(_randomValue/_radius)) > (random 1)) then { _distributedValue = (_randomValue + (random (_radius - _randomValue))) }; _pos = player getRelPos [_distributedValue, random 360]; _markerstr = createMarkerLocal [str random 100,_pos]; _markerstr setMarkerShapeLocal "ICON"; _markerstr setMarkerTypeLocal "hd_dot"; }; So here is what we gonna have as result Basically what we do here is: As smaller the random value we get as bigger the chance that we will add to this value a bit. (In simple words ;p) Have a good day -
Good afternoon. I've got a script written up to get some positions within the Tanoa jungle that are along the trails. These positions are ideally "deep" within the jungle (by deep, i mean a few hundred metres) with a few less-than-ideal positions that are captured due to the way I've set this up. It works, but I was wondering if there's a better way to go about this, as it seems to be a pretty long winded and imperfect way of going about getting positions: params ["_mapMiddle","_allRoadPositions","_jungleTrailPositions","_roadPosition"]; _mapMiddle = [10000,10000,0]; _allRoadPositions = _mapMiddle nearRoads 15000; _jungleTrailPositions = []; { _roadPosition = getPos _x; if ((!isOnRoad _roadPosition) && (surfaceType _roadPosition == "#GdtForest")) then { if ((({ (surfaceType _x == "#GdtForest") || (surfaceType _x == "#GdtBeach") || (surfaceType _x == "#GdtSeabed") }) count [ [(_roadPosition select 0) + 200,(_roadPosition select 1) + 200,0], [(_roadPosition select 0) + 200,(_roadPosition select 1) - 200,0], [(_roadPosition select 0) - 200,(_roadPosition select 1) + 200,0], [(_roadPosition select 0) - 200,(_roadPosition select 1) - 200,0], [(_roadPosition select 0) + 100,(_roadPosition select 1) + 100,0], [(_roadPosition select 0) + 100,(_roadPosition select 1) - 100,0], [(_roadPosition select 0) - 100,(_roadPosition select 1) + 100,0], [(_roadPosition select 0) - 100,(_roadPosition select 1) - 100,0] ]) == 8) then { _jungleTrailPositions pushBack _roadPosition; }; }; } forEach _allRoadPositions; { _mkr = createMarker[str _x,_x]; _mkr setMarkerShape "ELLIPSE"; _mkr setMarkerSize [10,10]; _mkr setMarkerColor "ColorOrange"; _mkr setMarkerAlpha 1; } forEach _jungleTrailPositions; systemChat format["All - %1 --- Jungle - %2",count _allRoadPositions,count _jungleTrailPositions]; Basically, to determine if a position is "deep within the jungle" I check positions around it, being 100m & 200m on each cardinal direction, for their surfaceType. It feels sloppy, but I just couldn't come up with another way (besides checking more distances between 0m-200m) to check the area around the given position for any non-jungle area. Is there a better way of doing this?
-
ooookayy Im having trouble understanding why this isn't working .. a = objectList; b = a select 0; c = b select 0; d = c find guy1; where objectList is a global array that holds a bunch of different objects. These objects are suppose to be removed from this array as they are interacted with. In this instance, I have 2 objects (both AI) objectList = [[[guy1]],[[guy2]]]; The problem is, when I interact with the object, it fails to be removed. The object can't be found in the array. d returns -1. Here's my confusion, and Im sure it has something to do with global arrays (though I cant modify it if I cant find the item in the index). When I manually delcare the array: a = [[[guy1]],[[guy2]]]; b = a select 0; c = b select 0; d = c find guy1; d returns the correct index. what the hell am I doing wrong? ._. When I manually declare, the debug console output shows a as this a [[[<NULL-object>]],[[<NULL-object>]]] despite declaring it edit: I worked around this by setting the object's vehvarname in the array instead of the actual object. This allowed me to access the value and remove it at any point in the multidimensional array.
- 1 reply
-
- global array
- find
-
(and 1 more)
Tagged with:
-
Hello! I been developing some sort of "Survival" gamemode with loot spawns and etc-etc; but I been also kind of been modifying maps and trying to add more maps so that there's variation. The issue I'm having is that my "loot" spawns on "positions" of different buildings - and some of the buildings I don't know how to get the name of (as they are custom or imported) and I need help figuring out the items (buildings) of a map or just a building I see around that I find interesting & fun to use. I need to obtain the classnames & positions for these. Thanks!
- 13 replies
-
- Classnames
- Maps
-
(and 2 more)
Tagged with:
-
[FUNCTION] fn_arrayValue.sqf – get, set, add and remove array values by ID (string)
Heeeere's johnny! posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
fn_arrayValues.sqf - v1.2 What? This script gives you the possibility to get, set, add and remove elements from and in an array by using unique IDs (strings) for each array element without having to worry about indexes. The logic behind it is totally simple. Why? TL;DR: I don't know if some people already created and use something like this, but either way, it's useful and took less than an hour to write. Slightly longer version: While developing some multiplayer missions now and then, I was moving data back and forth between client and server, sometimes using relatively large arrays. At some point, I found it annoying having to be careful about what value is at which index and when I somehow change the array, I had to double check again if the correct indexes are read and written. Coming from object-oriented programming languages, I always found it not satisfactory being unable to create custom objects in SQF. I know there is a „pseudo OO“ framework by code34, but that's just too heavy for my needs. All I wanted was being able to have one thing where I can get, set, add and remove values without having to care about anything but identifiers, just like the getters and setters in an object. And that's the idea of this script. How? This script MUST NOT be spawned, because it's got return values (no shit! ;)). Be aware of that when using remote execution. Every ID has to be a string and can only exist once throughout the whole array. Parameters and which are optional (or not) is described in the top of the script so I'll leave that out here. Examples: All examples are assuming “someId†exists, except if mentioned differently. //Creating a new array of this kind: _array = [[], []]; //Getting a value: _value = [_array, "someId"] call fnc_arrayValue; //Setting a value: _array = [_array, "someId", 123] call fnc_arrayValue; //Adding a value (assuming “someId†does not exist): _array = [_array, "someId", 123, true] call fnc_arrayValue; //Removing a value: _array = [_array, "someId", nil, false] call fnc_arrayValue; //Removing a value, only if it is 3: _array = [_array, "someId", 3, false] call fnc_arrayValue; //Setting a value explicitly to nil, instead of removing it from the array: _array = [_array, "someId", nil, true] call fnc_arrayValue; Kudos to Killzone_Kid for his SQF to BBCode Converter. It doesn't matter how much the array changes. You'll always get the desired value behind the same ID, independent from which index it currently has got. Unfortunately, last time I checked, SQF does not allow arrays like this: [123, , true] which is why there has to be a value (e.g. nil) even if you want to delete something from the array. If you did not pass the “isAdd†parameter, hence accidently try to set a value for an ID which does not exist, for instance due to a typo, the value won't be set. Some might consider it a feature if it would, some might not. I personally like my scripts in a way that only very few things happen implicitly, but I'd like to know what you think about that. Download the file here (SpiderOak)