Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Everything posted by Tova

  1. Hello Arma truckers ! It is now of common knowledge that Arma AI barely got its driving license ! While the driving is "decent enough" for single vehicles, once they hear the word "convoy", they get petrified and/or start ramming each other... While there are great convoy scripts out there (respects to@norrinand@Devastator_cm), I wanted a script who uses the new features of Arma 3 engine and follows the novacula Occami principle : Simpler is safer. So here's to you the Simple Convoy Script ! And it's robust ! So robust my AI convoy drove for 2.5 hours on Altis without getting stuck ! They crossed bridges, towns and villages, drove on dirt roads, small roads and highways. The recording is from the player perspective as a gunner on the tail vehicle. Convoy was composed of 8 vehicles, a mix of trucks and Humvees, in AWARE behaviour and was setup using MOVE waypoints and the Simple Convoy Script with default parameters (50km/h, 50m spacing). And here's an even longer demo with v. 1.2 of the script ! 8 hours of AI convoy driving on South Asia, the convoy is 7 vehicles long, with parameters 100km/h and 50m spacing. Features : Convoys will not get stuck for no reason ! Robust script Easy to use : put your waypoints in the editor, and run the script only giving the convoy's group name as parameter Player friendly : you can be driver/gunner/commander/passenger in any vehicle of the convoy without breaking the script AI will push through contact (feature can be turned off) Adjustable convoy speed Adjustable convoy spacing Performance and environment friendly 🙂 How to use : Here's a video example : Put the script code in an sqf file, trigger, init field or whatever you fancy, then call it with : convoyScript = [convoyGroup] spawn TOV_fnc_SimpleConvoy; Optional parameters are also available : convoyScript = [convoyGroup, convoySpeed, convoySeparation, pushThrough] spawn TOV_fnc_SimpleConvoy; With : convoyGroup : the group you want to move as a convoy convoySpeed : Maximum speed of the convoy in km/h (default 50 km/h) convoySeparation : distance between each vehicle of the convoy (default 50m) pushThrough : true/false, force the AI to push through contact, only returning fire on the move (default true) The script doesn't exit himself, so once you reach your final waypoint, you'll have to end it with : terminate convoyScript; {(vehicle _x) limitSpeed 5000;(vehicle _x) setUnloadInCombat [true, false]} forEach (units convoyGroup); convoyGroup enableAttack true; The script : Download links : Mission example : Armaholic Known limitations : Having mixed vehicles in the convoy will cause the fastest vehicles to have a not so smooth driving, as they'll accelerate faster than the other vehicles then brake once they reach target speed. ==> Fixed by v. 1.2 Due to how setConvoySeparation works, the convoy will stop on tight turns, vehicles crossing one at a time. Rear vehicles will then often cut the corner to catch up faster if possible (doFollow behavior). Behavior of the convoy when "pushThrough" parameter is disabled isn't very satisfying : passengers in cargo slots will disembark (but keep formation) to engage, armed vehicles will leave convoy formation to engage, some unarmed vehicles will just stop while others will keep pushing on etc. The convoy will eventually recover after the contact is destroyed and the leader calls "Area Clear" (as in they will mount up again and resume convoy route). That however might take up to 20 minutes, as the convoy and dismounts are usually spread over a couple km after the fight. Credits : The Arma community. With special thanks to all those who answer scripting questions on the forums. Changelog : License : Share it, edit it, steal it, rip it, call it your own etc. Arma scripting and modding is about sharing ! If you're having fun, then I'm happy !
  2. You may have noticed that in the civilian presence module, there an option to "enable panic" for the civilians. Basically, it change the units animation set : they move while protecting their heads with their hands in a panicky fashion. I managed to trigger this behavior for players with : player switchMove "ApanPercMstpSnonWnonDnon_ApanPknlMstpSnonWnonDnon" Which make the player crouch in panic mode and change all animations to their panic mode counterpart. This is a dirty workaround that doesn't work for AI units, so how should I do it properly ?
  3. Hello ! I remember back in the older Arma games, when I was playing as a tank commander, I could press the Tab key (Next Target) and the AI gunner would pick the biggest threat and target it. I was playing in Arma 3 today and for some reason, it doesn't seem to work, I also tried the Next Empty Target, Next Target (Vehicle) and Next Empty Target (Vehicle) keys but none of them seems to work ! 😓 Is there anyone who can walk me through it ? PS: I'm not using any mod.
  4. Hello, I have a long string I want to print on the screen using cutText. The command behaviour is use to use linebreaks if the string is too long to fit as a single line on the screen. I would like to predict on how many lines my text is going to be printed. To achieve this I tried using getTextWidth combined with safeZoneW, my understanding being that : getTextWidth : Retrieves the size of my string when printed on screen (with an arbitrary unit?) safeZoneW : Something equivalent to the maximum length of a string to fit as a single line (with an arbitrary unit?) My issue however is that the units of the results seems to be different, on my PC I find : getTextWidth : 33 for the longest string that fits on a single line (found empirically) safeZoneW : 1.56 I believe I should have found a result where roughly getTextWidth == safeZoneW, what did I miss ?
  5. Thanks for the support ! You'd be surprised to hear that the "piano" is just 3 vanilla desks arranged in a "triangle-y" shape 😛
  6. Oh just, the "piano" object I have in the video, so the 3D sound feels more "authentic". The playNote script has a parameter so you can choose the source of the note. If said parameter is not given, it takes the player by default.
  7. @johnnyboy Here’s a rendition of Beethoven’s Ode To Joy using those ping sounds. Actually, it was a bit harder than simply choosing the right sound file from those 7 « pings ». In fact, @Maffwas able to get the note correspondence for each of the files : Track = Note 1 = F3 2 = A3 3 = G2 4 = E4 5 = F4 6 = G4 7 = A4 And as you can see, the 7 sound files ARE NOT the 7 notes of an octave (letters from A to G), the 7 elemental pieces you need to make music ! So we ended up using the pitch parameter from playSound3D to alter sound files and get more notes. Taking A3 as our base, we used this table to get the frequencies of each note and “convert” one note to another. For example, A3 frequency is 220.00Hz, and B3 frequency is 246.94Hz, so to play a B3 in Arma, we have to play an A3 with a pitch adjustment of 246.94/220.00=1.1224545. So using that trick, we were able to get all the notes we needed, and then, transcribed this music sheet to work with our script. But enough talking ! Here’s the script used in the video, playNote is the “framework” to play notes and can be reused, _odeToJoy is the music sheet transcribed to the playNote format, and pianoSource is the piano object seen in the video.
  8. Hello @Play3r ! Yes that would work ! However you'll have to put [this] if it's in the init field and not _this (note the little "_" and the [ ]) I've also made you a code that will call the script on all the opfor units : TOV_noProne= { params ["_unit"]; while {alive _unit} do { if (behaviour _unit =="COMBAT") then { waitUntil {speed _unit < 1}; _unit setUnitpos "MIDDLE"; waitUntil {speed _unit > 2}; _unit setUnitpos "UP"; } else { _unit setUnitpos "AUTO"; sleep 2; }; }; }; { if (side _x==east) then { [_x] spawn TOV_noProne; }; } forEach allUnits; Just put it in a trigger set to true 🙂 NOTE : I updated the script so it stops when the unit dies. Also I'm not sure how running the script on many units will affect performance. You'll have to try 🙂 But please let me know ! Have fun !
  9. Maybe it's a bit late for an answer @Dj Rolnikbut here's a script that works well, for those who might be interested in the future : [yourUnitName] spawn { params ["_unit"]; while {alive _unit} do { if (behaviour _unit =="COMBAT") then { waitUntil {speed _unit < 1}; _unit setUnitpos "MIDDLE"; waitUntil {speed _unit > 2}; _unit setUnitpos "UP"; } else { _unit setUnitpos "AUTO"; sleep 2; }; }; }; If in COMBAT mode, the unit will take a knee when not moving, and stand up when on the move.
  10. Hi @Alert23 ! I tried to find a solution to use setPitch & Bank together with camPrepareTarget, but I couldn't find a way to... 😢 As a dirty workaround, I added a setDir parameter, if you need to set the bank of the camera, just comment the camPrepareTarget line, and use the combination of setDir and BIS_fnc_setPitchBank instead. Now, let's hope that some SQF guru will find a more elegant solution !
  11. Also it would be great to have an option to disable the little white dot in the center of the screen, or have it disabled by default when the crosshairs are disabled as well.
  12. @BlackbirdSD Well, there are many ways to achieve what you want. I'll explain Killzone_kid version first : In the description.ext, you can define "sound file" in as two "types", as cfgSounds (as you did), or as cfgMusic as Killzone_kid advice you to do. The way you define your "sound file" will classify the file as either sound or music for the Arma engine, and determine what kind of commands you can use to play your "sound file". In fact, defining your file as a cfgMusic (will classify the file as music) and allow you to use playMusic to play your file. Now the cool thing with that command, is that it triggers music Event Handlers, as defined in the biki : In our case, we are interested in using the musicStop event handler, who triggers when a cfgMusic sound is done playing. That way, you should be able to "know" when your song is done playing, and play it again. Here's a ready to use code snippet : playMusic "myMusic"; //To start the music ehID = addMusicEventHandler ["MusicStop", {playMusic "myMusic";}]; //EH that handles the loop //Code to stop the music, uncomment to use /* removeMusicEventHandler ["MusicStop", ehID]; playMusic ""; */ This code however is not MP friendly, as it will only work on the machine the code is run into, you'll have to make sure it is run on all machine if you want all the players too hear the music, and there are many ways to do so. For reference, one of them is to global execute it with remoteExec, and do something in this fashion : { playMusic "myMusic"; //To start the music ehID = addMusicEventHandler ["MusicStop", {playMusic "myMusic";}]; //EH that handles the loop } remoteExec ["bis_fnc_call", 0]; The main limitation of this method however, is that playSound isn't 3D. Which mean, the music will not fade out the further you get from your stereo and will always play at the same volume. Another approach to get the 3D sound capability is to define your song as cfgSound, and use say3D. However since the song is now cfgSound and not cfgMusic, you won't be able to use the musicStop event handler anymore. A workaround is to put your say3D in a loop with a sleep which is as long as the song duration. Note that this is not MP friendly, so you'll have to use the remoteExec trick as well. To get native MP compatibility (so you don't need to remoteExec), you can use playSound3D. Note that you don't need to define your "sound file" in the description.ext to use playSound3D, as you only have to give the path to your song file. Unfortunately, here again you won't be able to use the musicStop event handler, so you'll have to use the sleep trick again. Just note that you'll have to use another trick to get the MP friendly sound file path in MP, just check Jacmac comment in the playSound3D page for a "ready to use" code. I hope that helps ! (I got too lazy to explain methods 2 and 3 in detail, but I'm sure you get the idea 🙂 )
  13. Tova

    Metal Gear Solid Vr-Missions

    Hello @Alert23! That looks very interesting but it seems the steam link you provided is broken 😛 Can we expect the mission to get back online soon ? 🙂 Cheers
  14. Hello ! To give a bit of context, I'd like to emulate the SetDriveOnPath command for infantry units in order to have them navigate inside buildings lacking path/building positions. The idea is to give an array of positions (e.g [[4680.4,6175.85,0.00143909],[4680.3,6170.7,0.00143909]]) and have the AI move in a straight line in between thanks to a switchMove. As of now, this is what I made : infantryDriveOnPath={ params ["_unit","_pathArray"]; _unit disableAI "ANIM"; _unit switchMove "Acts_SupportTeam_Front_Move"; { _direction= _unit getdir _x; while {sleep 0.5; ( _unit distance _x > 1)} do { _unit setDir _direction; } }forEach _pathArray; _unit enableAI "ALL"; _unit switchMove ""; }; The resulting behaviour is satisfying, however the setDir command causes instant rotations/twitching that are very ugly. Any ideas on how I could make smooth direction corrections ? Thanks 🙂
  15. I guess this is a bit late to answer your question, but your issue is still relevant, as camera.sqs is still clunky... So for those who still need a solution in the future, I ended up making a script to output data from Splendid Camera in the Old camera.sqs format : while {true} do { waitUntil { uiSleep 1; not isNull findDisplay 314; }; findDisplay 314 displayAddEventHandler ["KeyUp", { params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"]; if (_key isEqualTo 46 && _ctrl) exitWith { _camParameters=call compile copyFromClipboard; _targetPos=screenToWorld [0.5, 0.5]; _camOutput = Format [" %1 camPrepareTarget %2; %1 camPreparePos %3; %1 camPrepareFOV %4; //setAperture %5; //%1 setDir %8; //[%1, %6, %7] call BIS_fnc_setPitchBank; %1 camCommitPrepared 0; //waitUntil {camCommitted %1}; ", "_camera",_targetPos,_camParameters select 1,_camParameters select 3,_camParameters select 6,_camParameters select 4 select 0,_camParameters select 4 select 1,_camParameters select 2 ]; copyToClipboard _camOutput; }; }]; waitUntil { uiSleep 1; isNull findDisplay 314; }; } You just have to run the script from the debug console, and each time you'll press Ctrl+C it will copy in your clipboard the camera data in the format of the old camera.sqs (with a couple bonus features, commented by default). The output will be in the format : _camera camPrepareTarget [13143.1,8857.96,0]; _camera camPreparePos [13140,8859.02,1.75517]; _camera camPrepareFOV 0.75; //setAperture 0; //_camera setDir 109.302; //[_camera, -28.6765, 28.2684] call BIS_fnc_setPitchBank; _camera camCommitPrepared 0; //waitUntil {camCommitted _camera}; EDIT/NOTE : if you use "camPrepareTarget", you won't be able to setPitchBank anymore... So to achieve your desired effect, comment camPrepareTarget and uncomment the combination of setDir/setPitchBank. (Note that you'll have to delete and recreate a camera if you used camPrepareTarget earlier). It's a dirty and imperfect workaround unfortunately 😕 The script pre-edit for reference :
  16. Well, months later, I didn't do much progress on the subject... I ended up using the "smooth rotation" script from BIS_fnc_scriptedMove, but while it looks decent for units rotating while stopped, it still looks cranky when a unit is rotating while moving (cf video) : Here's the "smooth rotation" code : //procedure for smooth turning _turningProc = { _this spawn { _guy = _this select 0; _wp = _this select 1; _dir = [_guy, _wp] call BIS_fnc_dirTo; if (_dir < 0) then {_dir = 360 + _dir}; _degs = _dir - direction _guy; if (abs _degs > 180) then {_degs = _degs + (360 * (_degs / abs _degs) * (-1))}; _step = _degs / 20; while {(abs _degs > abs _step) && BIS_scriptedMoveEnabled} do { _guy setDir (direction _guy + _step); _degs = _dir - direction _guy; sleep 0.025 }; _guy setDir ([_guy, _wp] call BIS_fnc_dirTo) } }; I also tried your suggestions with OnEachFrame/stacked eventHandler but without any improvement and with the additional drawback that the unit also rotate when you are in the pause menu 😛 Maybe the new Arma updates introduced a way to solve this issue ? Also I know @johnnyboythat you have been working on your own version of the script, maybe were you able to make progress on the matter ?
  17. Thanks you very much @johnnyboy! Say no more ! Here are some showcases ! A convoy is trying to traverse a town, with insurgents shooting from roofs/windows. So to explain what happens in the videos : First video : No one dies, nothing blocks the street. Perfect scenario and the script works flawlessly. Second video : Here the two truck drivers get killed, luckily their vehicles end up not blocking the street. You can then see the AI HMMVW overtaking them and resuming the convoy Third video : It illustrates a limitation of the script and AI driving. Here again, the two truck drivers get killed, but this time, their trucks are blocking the street. Because of Arma 3 AI path-finding limitations, the HMMVW can't calculate a path to continue past them, and gets stuck. Maybe he would have moved eventually, but I didn't run the experiment long enough. Also as a side note, I have noticed that if it is the lead vehicle that gets killed, the convoy always stalls (stops moving toward the waypoint, with n°2 vehicle not taking lead vehicle's role), maybe you have an idea for a fix ? I haven't really tried implementing your suggestion, but I feel normal AI behaviour does that good enough already 🙂 However I noticed a "bug" in limitSpeed behaviour, as only the group leader ends up respecting this limitation, any insight on the matter ? I did some testing with the idea, so here are some on the WIP conclusion : Basically the working principle of my script isn't to "enforce a convoy behaviour" but rather to "recover" vanilla COLUMN formation when it detects a vehicle is stuck. if ((speed vehicle _x < 5) && (_pushThrough || (behaviour _x != "COMBAT"))) then { (vehicle _x) doFollow (leader _convoyGroup); //doFollow command name is misleading, but what it basically does, is order a unit to return to formation, hence unsticking it }; Also once it detects the group is in COMBAT, and if pushThrough is false that "recovery command" isn't run, in practice making the script inactive. Terminating the script properly doesn't changes behaviour in combat. Using a nearTargets to detect end of engagements faster, and restart the script isn't enough, as the units will not mount back in vehicles. I should add an orderGetIn to make them mount back and crack on. Your idea has potential !
  18. Oh my bad @Tankbuster To explain my statement better, the vehicle order is defined by "the hierarchy" of the group, as in group leader is 1st vehicle and so on. I don't know how you're spawning the vehicles of your convoy, but if it's a combination of createVehicle and joinSilent in this fashion : _convoyGroup=createGroup [west,true]; for "_i" from 0 to 9 do { _newVeh="B_MRAP_01_F" createVehicle getMarkerPos "vehSpawner"; createVehicleCrew _newVeh; [_newVeh] joinSilent _convoyGroup; sleep 0.5; }; convoyScript = [_convoyGroup] spawn TOV_fnc_SimpleConvoy; the convoy order will be : <- 1st spawned/joined vehicle <- 2nd spawned/joined vehicle <- 3rd spawned/joined vehicle ... Note that if you want a different order from the "join order", you should use joinAsSilent, as it allows you to specify the "position id in the group". 🙂
  19. @Maff Only if it's one of those heavily monetized servers and I'm getting a 130% share of the profits ! @Devastator_cm I didn't implement it per se, but they have the vanilla Arma reaction to contact (the script don't affect their "Combat Behaviour"). I didn't test it extensively but they seem to push on while shooting if there's no vehicle with units in cargo seats, otherwise, passengers dismount and engage. If a vehicle gets wrecked/badly damaged the group leader will order its passengers to get in other vehicles of the convoy when possible. EDIT : @Devastator_cm After further testing I found the behavior inconsistent, armed vehicles will sometimes stop to engage, or move closer to targets. I added a parameter to force the convoy to push through ambushes (enabled by default) to make behavior more predictable.
  20. @TankbusterVehicle order is the "grouped order" when you placed the vehicles in the editor 🙂 Basically, first placed vehicle will be group leader and is in front vehicle, second placed vehicle is second vehicle and so on... @wogz187 Thank you very much ! I tried to keep it as simple as possible, so it's easy to understand and so there are less things that can go wrong
  21. I've been playing a lot on this map recently, and while it is indeed fantastic for flying, it feels a bit limited once you put boots on the ground. Considering the addition of roads and the large towns/villages of the map, I believe it would make a wonderful playground for infantry if it wasn't for the un-enterable buildings. I really hope @Jove Chiere that you'll consider replacing them with their CUP counterparts, or at least making the map compatible with CUP Core. In fact, I've been having a look at your buildings from ToH Core, and a replacement seems doable since the classname structure is similar. I've made a quick script to illustrate that in-game as a "proof of concept" (cf. video). And here's the script I used : Also please note that the "center" of the buildings is sometimes a bit offset between your models and those from CUP, but considering the "small" amount of different building models, it shouldn't be too hard to adjust them. On an another hand, a full replacement may be performance unfriendly. If you manage to make the map compatible with CUP (so you don't have those black textured buildings in the video), mission makers could just replace buildings on small areas of interest, or do it temporarily when players are close to towns. Anyway thanks for your work on the port ! PS : The script is MP and JIP compatible, and has to be run only on the server. You can replace all buildings on the map with : [[(worldSize / 2), (worldSize / 2), 0], (sqrt 2 * (worldSize / 2))] call TOV_fnc_TohToCupReplacement; It takes 40 seconds to run on my PC 😋.
  22. @Jove ChiereIt seems that your South Asia map got removed from the workshop... I hope that you'll get it back on Steam, and that you're not stopping working on it because of those stupid stories 😓
  23. Hello ! I have an array of objects in the format : [obj_10,obj_1,obj_12,obj_13,obj_14,obj_11,obj_2,obj_3,obj_4,obj_5,obj_6,obj_7,obj_8,obj_9] I would like to sort this array so it becomes : [obj_1,obj_2,obj_3,obj_4,obj_5,obj_6,obj_7,obj_8,obj_9,obj_10,obj_11,obj_12,obj_13,obj_14] Also please note that the array contains objects and not strings ! I tried the sort function on the array, but no luck 😕 I believe the problem arises from alphabetical sorting as obj_11 comes before obj_2. Any ideas on how to get around the issue ? Thanks for the help !
  24. Smart move ! It didn't work as it is, but you just forgot to add a ParseNumber since the third parameter of sortBy has to return a number 🙂 _sorted= [_yourArray, [], {parseNumber ((str _x splitString "_") select 1)}, "ASCEND"] call BIS_fnc_sortBy; Thanks a lot !
  25. Tova

    Tab targeting for AI tank gunners

    Thanks @Beaglefor your answer ! I find it unfortunate that the "Radar" got removed tho 😕 Also for those who might be interested in the future, I made a quick ready-to-use script to emulate that feature. It's binded to the Tab key : tab_radar_EH = (findDisplay 46) displayAddEventHandler ["KeyDown", { params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"]; //hint format["%1", _key]; if (_key!=15) exitWith{}; _unit=player; _gunner= gunner vehicle player; _targetsArray=_unit nearTargets 10000; _targetsArray=_targetsArray apply {[_x select 3, -1*((_x select 0) distance _unit),_x select 4]}; _targetsArray sort false; _nextTarget=[0,'nothing',objNull]; { if ((isNull assignedTarget _gunner) or (_x select 2!=assignedTarget _gunner)) exitWith {_nextTarget=_x;}; } foreach _targetsArray; if (_nextTarget select 0 < 10) then {_nextTarget=objNull} else {_nextTarget=_nextTarget select 2}; _gunner reveal _nextTarget; (_gunner) doWatch _nextTarget; (_gunner) commandTarget _nextTarget; }];