Jump to content

Grumpy Old Man

Member
  • Content Count

    4333
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. Grumpy Old Man

    Delete specific item from weaponholder

    Not possible if you want to delete a specific one, as far as I know the first matching item inside the weaponholder will be deleted. So if you want to delete the third FAK out of ten, it will actually delete the first one. Cheers
  2. Here's a quick mortar snippet that's pretty versatile: //place markers and name them after which mortars you want there: //a marker named "spawnmortar01_east" will spawn an east side mortar at the marker position //init.sqf or wherever you seem fit GOM_fnc_mortarAutoReveal = { params ["_mortar"]; while {alive _mortar AND canFire _mortar AND count crew _mortar > 0} do { _enemySides = side _mortar call BIS_fnc_enemySides; _mag = currentMagazine _mortar; _nearby = (getposatl _mortar nearEntities 4000) select {side _mortar knowsAbout _x > 0 AND side _x in _enemySides AND _mortar getArtilleryETA [getposatl _x,_mag] > 0 AND getPosATL _x inRangeOfArtillery [[_mortar], _mag]}; //no enemies found which are in range and have a firing solution, skip and wait if (count _nearby > 0) then { //it's not really needed to reveal enemies to the mortar if you want the mortar to only fire an exact number of rounds, otherwise they will keep firing until the target is dead /* { effectiveCommander _mortar reveal [_x,4]; } forEach _nearby; */ //fire on a random target then look again _rounds = 4; (effectiveCommander _mortar) commandArtilleryFire [(getPosATL (selectRandom _nearby)),_mag,_rounds]; systemchat format ["%1 targets: %2",effectivecommander _mortar,count _nearby]; sleep _rounds * 6;//give enough time to fire all rounds, then start over }; sleep (3 + random 3); }; }; GOM_fnc_spawnMortars = { params ["_side",["_debug",true]]; _sides = [west,east,resistance]; if !(_side in _sides) exitWith {systemChat "Wrong side parameter"}; _mortarTypes = ["B_Mortar_01_F","O_Mortar_01_F","I_Mortar_01_F"]; _mortar = _mortarTypes select (_sides find _side); _markers = allMapMarkers select {toUpper _x find toUpper str _side >= 0};//for east this returns all markers containing "east" in the name _mortars = []; if (_debug) then {systemchat format ["Spawning %1 mortars: %2",_side,_markers]}; { _mortarSpawn = _mortar createVehicle getMarkerPos _x; createVehicleCrew _mortarSpawn; _mortars pushBack _mortarSpawn; } forEach _markers; {[_x] spawn GOM_fnc_mortarAutoReveal} forEach _mortars; if (_debug) then {systemchat format ["Spawn finished: %1",_mortars]}; }; //now when you want to spawn the mortars simply do this: _spawn = [east] call GOM_fnc_spawnMortars; Simply place markers on the map where you want mortars to spawn, name them mortarMarker_east01, mortarMarker_east02, etc. Then call the function as shown above, this will automatically spawn one mortar per marker and make it fire at random targets that are within range and hostile. Works simultaneously for all three main sides. Cheers
  3. Grumpy Old Man

    arma3 is so sick

    We comparing played time again? Cheers
  4. Grumpy Old Man

    88th Clan

    Why not just drop them a hint? Nothing on their page looks like they even know what that number/icon combination means anyway. To clarify the icon, 8 stands for the eighth number in the alphabet, being h. Doubt hh means anything in spanish. Cheers
  5. Try adding checks in case BIS_fnc_findSafePos doesn't return anything usable (can return default map safe positions that can be mid-air etc). Other than that replace BIS_fnc_findSafePos with a simple getPos alternate syntax. There's no need to use the BIS function for waypoint positions, since waypoints get cancelled when they're not reachable. Cheers
  6. Grumpy Old Man

    Dynamic Draw on Map With EH

    You can do all that from inside the eachFrame eventhandler. It's always good to have a single EH that does stuff for every aircraft, instead of having an EH for every aircraft: //bad: { addMissionEventHandler ["EachFrame",{ //do stuff }]; } forEach (vehicles select {typeof _x isKindOf "Air"}); //good: addMissionEventHandler ["EachFrame",{ { //do stuff } forEach (vehicles select {typeof _x isKindOf "Air"}); }]; Just as an example, but you'll catch my drift. So to draw a polygon for each aircraft you can simply do this: //initPlayerLocal.sqf: GOM_fnc_getPilotPolygon = { params ["_vehicle"]; [[_vehicle modelToWorldVisual [-10,0,0],_vehicle modelToWorldVisual [10,0,0],_vehicle modelToWorldVisual [-250,500,0],_vehicle modelToWorldVisual [250,500,0]],[0,0,1,1]] }; findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",{ { (_this#0) drawPolygon ([_x] call GOM_fnc_getPilotPolygon); } forEach (vehicles select {typeOf _x isKindOf "Air"}); }]; Getting pretty solid 60fps with ~20 aircraft. Cheers
  7. Grumpy Old Man

    Dynamic Draw on Map With EH

    Have a banana: Cheers
  8. Grumpy Old Man

    Dynamic Draw on Map With EH

    Broadcasting an eachframe event to every player of a side is a terrible idea. Imagine having 10 players receiving this command, the server has to push out 600 remoteExecs per second at 60fps... Why not just run the function from initPlayerLocal.sqf? This way you can be sure every client is running it locally without stressing out the server. Also the proper syntax of remoteExec requires the script command to be in quotation marks, as seen on the wiki. Cheers
  9. Grumpy Old Man

    When is Arma not Arma???

    So that's where they went! Cheers
  10. Grumpy Old Man

    make an array with all buildings

    @pierremgi this could work on recent maps, just consider takistan where rarely any building has doors while still having positions. I'm sure @dlegion wants something different. 18000 buildings? There's only 900+ unique buildings with positions in vanilla a3. You can also try to grab the snippet above, put it in a function of your own function library and call it from preInit, should increase processing times significantly (this goes for any function that should be run only once and is very CPU intensive). Did it right now along with a comparison: Function: //getBuildingsWithPositions.sqf in mission root, adjust positions parameter to find houses with at least given number of positions GOM_fnc_buildingsWithPositions = []; _initTime = diag_tickTime; _allHouses = "configName _x isKindOf 'HouseBase'" configClasses (configFile >> "CfgVehicles") apply {configName _x}; systemChat str count _allHouses; _allHouses apply { _house = _x createVehicle [0,0,0]; _positions = _house buildingPos -1; if (count _positions >= 4) then {GOM_fnc_buildingsWithPositions pushBack _x}; deleteVehicle _house; }; copyToClipboard str ([format ["Data evaluated in %1s. Found %2 valid buildings",diag_tickTime - _initTime,count GOM_fnc_buildingsWithPositions]] + GOM_fnc_buildingsWithPositions); description.ext class CfgFunctions { class GOM { class preInit { class getBuildingsWithPositions{file = "getBuildingsWithPositions.sqf";postInit = 1}; } } } Tests: During mission runtime: "Data evaluated in 68.312s. Found 322 valid buildings" preInit: "Data evaluated in 65.945s. Found 322 valid buildings" postInit: "Data evaluated in 2.651s. Found 322 valid buildings" For some reason running this during postInit is happening at ludicrous speed, you can test it for yourself in this demo mission, simply change preInit to postInit in the description.ext and paste the results to a file. Running this from postInit shouldn't be noticeable at all, so that should work fine and would even take into account mod buildings etc. List of all vanilla buildings with at least 4 positions: Cheers
  11. Grumpy Old Man

    What is your AI settings?

    I don't have any converted values, just goofed around with it a bit after the change, couldn't get any results that are close to before the change. A setUnitRecoilCoefficient above +2 also can force the unit to reacquire aim. Cheers
  12. Grumpy Old Man

    Proper Bulletcam

    You could add an additional fired EH to slow down time until the projectile gets removed, like this: player addEventHandler ["Fired",{ _sleep = _this#6 spawn { setAccTime 0.05; waitUntil {!alive _this}; sleep 2; setAccTime 1; }]; Cheers
  13. Grumpy Old Man

    Weapons won't fire from water

    That's the depth I can fire from, seems reasonable considering the water has no effect on the weapon other than preventing to fire it if it's partially submerged. Cheers
  14. Grumpy Old Man

    Proper Bulletcam

    You'd need to update every bullet model on the server and broadcast it to every client on every frame. (rough approximation) Now imagine 2-3 folks firing miniguns for a minute... You can use setAccTime to influence game speed. Cheers
  15. Grumpy Old Man

    Proper Bulletcam

    You could give BIS_fnc_diagBulletCam a try and adapt its code. You won't see bullets though, since they don't have a model, besides arty shells/rockets. Cheers
  16. Grumpy Old Man

    What is your AI settings?

    Had 4-5 presets for AI, ranging from untrained over rookie/guerilla to elite, while not being too accurate and give nice prolonged firefights that could drag on and lead to pretty tense situations. Since the "AI refactoring" back in august 2017 I couldn't really reach those values even a conversion table from old to new was provided, maybe there was more involved since the difficulty AI sliders are also somewhat broken. These were the (no longer working) values I was using, maybe you can go from there: Cheers
  17. Alternatively you could put this inside the init field of one unit from each group, no markers needed and pretty random: _fobObject = YourFOB;//some named object from your FOB as reference _rndPos = _fobObject getPos [3000,random 360]; {_x setPos _rndPos} forEach units this;//will set every unit inside this units group 3000m from the FOB in a random direction Cheers
  18. Simple solution would be to leave the editor settings to default and place 5-10 markers around the FOB at the wanted distance, and group every opfor squad leader to every marker, so they can spawn on any connected marker randomly upon mission start. Cheers
  19. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Allright, I know what happened, a mistake on my part, I forgot to pass the _unit variable to the spawned scope inside the fired eventhandler. When I tried it it simply worked because I was using "player" instead of "_unit" inside that scope, go figure... This is how the function should look like: GOM_fnc_chopperPickup = { params ["_unit","_chopper"]; _unit setVariable ["GOM_fnc_pickUpChopper",_chopper]; waitUntil {time > 1};//put your condition in here to make the chopper move towards the player _chopper move (_unit getPos [50 + random 50,random 360]);//this will move the chopper near the player within 50-100m waitUntil {_chopper distance2d _unit < 300}; //now the player can throw a smoke to mark the landing area hintC "Throw smoke to mark landing area!"; _unit addEventHandler ["Fired",{ params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; if (toUpper _ammo find "SMOKE" >= 0) then { _unit removeEventHandler ["Fired",_thisEventhandler]; hint "Smoke out!"; _chopper = _unit getVariable ["GOM_fnc_pickUpChopper",objNull]; _wait = [_unit,_chopper,_projectile] spawn {//forgot the _unit here, heh params ["_unit","_chopper","_projectile"]; waitUntil {vectorMagnitude velocityModelSpace _projectile < 0.01}; hintC "The Chopper will land now!"; //spawn landing pad at smoke position and make chopper land _pad = "Land_HelipadEmpty_F" createVehicle getPosATL _projectile; _pad setPosATL getPosATL _projectile;//just in case... doStop _chopper; _chopper land "GET IN"; waitUntil {_unit in crew _chopper}; //cancel the landing _chopper land "NONE"; _chopper move getPosATL _chopper; sleep 5; _chopper move [0,0,0];//position where the chopper should move to } } }] }; Demo mission. Cheers
  20. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Allright, gonna send you a quick demo mission, heh. Cheers
  21. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Ouch, a few things: init.sqf is automatically run by the game upon mission start, no need to run it again. In the triggers onAct field simply put: [SomeSoldier,EvacChopper] spawn GOM_fnc_chopperPickup; I recommend to further look into some scripting guides to make things more clear: Mr Murray for Arma, worth its weight in gold and still valid. Kylanias page with loads of examples and KKs glorious page for more advanced users. Cheers
  22. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Getting this as well, for some reason the editor automatically converts every called function and adds a call on its own. As to your example, so you have the function inside init.sqf? Then there should be no local variable in global space error from the trigger. Not really sure from your description. Cheers
  23. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Make sure the marker names are identical both on the marker itself and in the script. Since in your post you wrote MyMarker01 and MyMarker1 and be aware that strings (stuff between quotation marks) is case sensitive. Also you don't need to change _unit and no need to change the function at all, since it's just a variable holding the object passed into the function. Change the objects you pass into the function: //player unit named SomeSoldier //chopper named EvacChopper [SomeSoldier,EvacChopper] spawn GOM_fnc_chopperPickup; That's all there is to it. Posting a screenshot can be as simple as: Hit print screen go to imgur.com click on new post ctrl+v paste the image link to the forum Cheers
  24. As far as I know the files are installed on every client, no matter if you own the DLC or not. Imagine the headaches this would cause, heh. Cheers
  25. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    You can put the first part, which defines the function into init.sqf or wherever you seem fit. Then you can call it anytime in game from a trigger, another script, or debug console like this: [player,chopper] spawn GOM_fnc_chopperPickup; Then the function will wait for the condition to happen, the first waitUntil line, if you don't need this and want the chopper to immediately head towards the player simply delete this line: waitUntil {time > 1};//put your condition in here to make the chopper move towards the player No need to delete comments, since they're ignored by the engine. For a position you can place a marker, name it and use getMarkerPos, or place an object, name it and use getPos: _chopper move getMarkerPos "MyMarker01"; //or _chopper move getPos flagFOB01; Cheers
×