Search the Community
Showing results for tags 'Select'.
Found 9 results
-
// Listing all spots found in reverse sorted: _spots = [_building] call BIS_fnc_buildingPositions; // Take each spot ([x,y,z]) and its Z axis and sort them by highest to lower: _spots = [_spots, [], {_x select 2}, "DESCEND"] call BIS_fnc_sortBy; Above, a code where I'm identifying the highest spot in a building, but reading the BIS_fnc_sortBy, I'm pretty sure there are ways to figure out which two of those spots are closer to the object-target outside. My goal here is to let snipers know which position inside the building will provide a better view of the target zone far away, avoiding at least the center building walls itself. Any idea? I think perhaps using apply? My brain... Edited 45min later 😂: // Selecting only those spots that are near the target-zone when compares the the building center position (regularly the middle of the building asset): _spots = _spots select { _x distance2D _objTarget < (_building distance2D _objTarget) }; Running some tests, it's working well with towers (assets that often are narrow buildings) but not with churches where their bell towers are at one end of the building. Used: https://community.bistudio.com/wiki/BIS_fnc_buildingPositions https://community.bistudio.com/wiki/BIS_fnc_sortBy https://community.bistudio.com/wiki/select
-
Ride Where You Look Pick your desired vehicle seat by looking, when: getting into a vehicle switching seats inside a vehicle hopping from one vehicle to another in Zeus telling an AI which seat to take ACE dragging/carrying/escorting (ACE not required) Steam Workshop GitHub Usage In CBA Keybinds > Ride Where You Look, set up the keys [Show Seats] (L Ctrl) and [Select Seat] (Ctrl + X). Press and hold [Show Seats] (L Ctrl) to see which seat you are selecting. Press [Select Seat] (X) to move to that seat. Client & Server This mod can be used client-side for player usage and Zeus controlling local AI. Zeus controlling remote AI will require all machines to load this mod. Requirements CBA_A3 Plans Add compartment check Known Issues Several issues can arise due to vehicle model inconsistencies: Some proxies appear where there is no available seat Some seats do not have proxies visible Some vehicles do not switch you to the seat you're looking at These issues need to be individually resolved with tweaks. Report issues here. License This work is licensed under a Arma Public License Share Alike.
- 25 replies
-
- 10
-
Hey guys, I am thinking of changing some tank reload sounds for use with my group. I am considering changing some of the default reload sounds of the round being loaded to a couple different ones. Only thing is, I'd like it to be kind of random across several different sounds. I already figured I would need to make a small mod out of it that would override the files that tanks use (in this case I believe it's default vanilla tank reload sfx). I think I would be able to override the sound itself, but I would like to have a few variants of the reload sfx which would be chosen and played at random. Is it possible to script in any way? I will be thankful for any guidance in this regard. Thanks! Adam
-
Hey guys, I am coming to ask for help with what seems to me like a relatively simple thing, yet I cannot figure this out. I would like to have the AI unit run a script which will make it go prone and stay in place on command. The problem is I cannot seem to get the unit to do what the script says. I beleive it's something to do with the "this select" command and since I cannot figure it out I would be grateful if someone could tell me how to get it to work. What I have so far in the Civ unit init: this addAction ["Get on the ground!", {execVM "Civ_ground.sqf"}]; I can approach the unit and order it to get on the ground, but as I stated, it does not want to do it. In the Civ_ground.sqf I have this: _civ = _this select 0; _civ setunitPos "DOWN"; _civ setBehaviour "CARELESS"; _civ disableAI "MOVE"; Thanks a lot for your help! Adam
-
Zero Divisor in select function
lawman_actual posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I keep getting a "zero divisor" error when trying to select from an array after using the find command. The basic situation is; 16 people each with their own individual waypoints. When the units reach the waypoint, the following is executed: For units in group 1: nul = [this,1] execVM 'law\setRotation.sqf'; For units in group 2: nul = [this,2] execVM 'law\setRotation.sqf'; setRotation.sqf contains the following: params [["_subject", objNull],["_typeCode", 0]]; if (_typeCode == 0) then { //Insert Code to generate error report here }; if (_typeCode == 1) then { _unitsAlpha = [ pak_mainyu1_2, pak_mainyu1_3, pak_mainyu1_4, pak_mainyu1_5, pak_mainyu1_6, pak_mainyu1_7, pak_mainyu1_1, pak_mainyu1_8 ]; _positionInQueue = _unitsAlpha find _subject; _bearingsBriefing_alpha = [ 271.587, 250.801, 225.084, 202.869, 172.511, 147.108, 26.615, 20.786 ]; _bearingFrom = _bearingsBriefing_alpha select _positionInQueue; _startPos = getPosAtl _subject; _watchTarget = [_startPos,3,_bearingFrom] call BIS_fnc_relPos; _watchTarget set [2,1.8]; _subject doWatch _watchTarget; }; if (_typeCode == 2) then { _unitsBravo = [ pak_mainyu2_2, pak_mainyu2_3, pak_mainyu2_4, pak_mainyu2_5, pak_mainyu2_6, pak_mainyu2_7, pak_mainyu2_1, pak_mainyu2_8 ]; _positionInQueue = _unitsBravo find _subject; _bearingsBriefing_bravo = [ 271.587, 250.801, 225.084, 202.869, 172.511, 147.108, 26.615, 20.786 ]; _bearingFrom = _bearingsBriefing_bravo select _positionInQueue; _startPos = getPosAtl _subject; _watchTarget = [_startPos,3,_bearingFrom] call BIS_fnc_relPos; _watchTarget set [2,1.8]; _subject doWatch _watchTarget; }; What i can't figure out is why it's trying to select a value that's out of range. There are 8 units in each group, a matching set of 8 names in the _unitsX arrays, and 8 entries within the bearing array. Should be a simple case of 1 - obtain unit name from waypoint completion 2 - find name within array 3 - select corresponding bearing from the bearing array I ran a separate test to go through the same process 1 by 1 which passed without error, so I'm guessing it's to do with some of these waypoints being completed at the same time: _testGroup = [ pak_mainyu2_1, pak_mainyu2_2, pak_mainyu2_3, pak_mainyu2_4, pak_mainyu2_5, pak_mainyu2_6, pak_mainyu2_7, pak_mainyu2_8 ]; { player sideChat (format ["Subject: %1",_x]); _subject = _x; _unitsBravo = [ pak_mainyu2_2, pak_mainyu2_3, pak_mainyu2_4, pak_mainyu2_5, pak_mainyu2_6, pak_mainyu2_7, pak_mainyu2_1, pak_mainyu2_8 ]; _positionInQueue = _unitsBravo find _subject; player sideChat (format ["PosInQ: %1",_positionInQueue]); _bearingsBriefing_bravo = [ 271.587, 250.801, 225.084, 202.869, 172.511, 147.108, 26.615, 20.786 ]; //player sideChat (format ["Subject: %1, Position: %2",_subject,_positionInQueue]); _bearingFrom = _bearingsBriefing_bravo select _positionInQueue; player sideChat (format ["BearingFrom: %1",_bearingFrom]); _startPos = getPosAtl _subject; _watchTarget = [_startPos,3,_bearingFrom] call BIS_fnc_relPos; _watchTarget set [2,1.8]; _subject doWatch _watchTarget; sleep 3; } forEach _testGroup; Maybe there's something to do with using local variable handles that I'm not understanding here. Thanks, Law -
Move Unit to NearestObjects of Certain Type, Select 0
aie-boshell posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I need a script to allow me to move a unit to the nearest object of a certain type. I believe the answer is nameofunit move {nearestobject [position nameofunit, "land_pencilred_f"]} I tried this with "land_pencilred_f" being the classname of the objects that I'd like my unit to move to the nearest pencil to his current location. No luck so far but any help is much appreciated :-) -
Hello everyone, I have a question here. I started working on something that I considered really simple which turned out fast a bit more complicated. I've been continiously banging my head on my desk for the past hour so I decided to come over here where I would surely get help from some of the more talented folks out there. Basically how do I check if and what the player has selected in his inventory? For example: In this screenshot the player has selected the First Aid Kit. How do I check if he actually has done that?
-
Help With Choosing A Random Variable (BIS_fnc_selectRandom)
atomickrypton posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello BIS Forums, I am working on a mission which involves a cool chase scene, and to put in a "randomness" factor, I have recorded 3 different paths the AI can take. The paths work, but for some reason, the script I am using to choose the random path isn't really working. Here it is: _poi = _this select 0; _randomMovement = ["pursuitPath1","pursuitPath2","pursuitPath3"]; _dataPath = _randomMovement call BIS_fnc_selectRandom; hint format ["The path will be: %1",_dataPath]; sleep 0.5; // The script works up until here.. if (_dataPath == pursuitPath1) then { hint "good"; _pursuit1 = [_poi] execVM "path\play.sqf"; // play, play3 and play4 are the files that make the AI follow the path, they all work when I execute them through the debug console or by trigger. waitUntil {scriptDone _pursuit1}; terminate _pursuit1; }; if (_dataPath == pursuitPath2) then { hint "bueno"; _pursuit2 = [_poi] execVM "path\play3.sqf"; waitUntil {scriptDone _pursuit2}; terminate _pursuit2; }; if (_dataPath == pursuitPath3) then { hint "gut"; _pursuit3 = [_poi] execVM "path\play4.sqf"; waitUntil {scriptDone _pursuit3}; terminate _pursuit3; }; I am still learning the basics and everything there is to scripting, so bear with me if I made a simple error. I believe it has to do with the condition with the if statement, however, I am not sure what to do and google has failed me in this endeavor. If there is any help you all can offer it will be greatly appreciated! Thanks all : ) -
Need help with; Random selection from List of choices.
Vectif posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello once again; I've come across another thing that I was wondering how could I do. I'm working in a mission currently; and there's a loadout that you always spawn with, right? - I kind of don't like that I'm or the people playing would always spawn with the same uniform everytime they spawn/respawn; so I was trying to use "BIS_fnc_selectRandom" but I couldn't really understand how to apply it. Here I'm using a loadout script (Kill_Phil's; https://forums.bistudio.com/topic/142113-respawn-with-custom-loadout/),although, everything works fine and all; but I wanted to know or get some help towards how to make this work making it choose a random uniform off of a list; and maybe same for Headgear. here's the script; loadout.sqf (All credit to Kill_Phil for the "template".)- 6 replies
-
- Select
- From Random Choices
-
(and 3 more)
Tagged with: