Jump to content

Grumpy Old Man

Member
  • Content Count

    4313
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Allright, gonna send you a quick demo mission, heh. Cheers
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. Grumpy Old Man

    Anti-Air Vehicle Ranges and Effectiveness

    Titan AA from Cheetah? Sure they can. Left mouse button. Cheers
  8. This. Points 2-10 are only speculation without seeing scripts and/or mission. Point 1 is irrelevant if there's funky stuff running in a while true loop without sleep (or similar). "Lagging" tasks and units not being placed inside vehicles sounds like there's something off. Try it without mods and see if the issue persists. Cheers
  9. Grumpy Old Man

    make an array with all buildings

    No way to grab this from the config, as far as I know. Try this: GOM_fnc_buildingsWithPositions = []; GOM_fnc_grabAllBuildingPositions = { _initTime = diag_tickTime; _allHouses = "configName _x isKindOf 'HouseBase'" configClasses (configFile >> "CfgVehicles") apply {configName _x}; _allHouses resize 50;//just for testing, delete this line if you want to check all houses 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 _house}; deleteVehicle _house; }; copyToClipboard str GOM_fnc_buildingsWithPositions; systemchat format ["Data evaluated in %1s.",diag_tickTime - _initTime]; }; [] call GOM_fnc_grabAllBuildingPositions; Be aware this will take forever for around 900 vanilla buildings. If anyone else knows a way to grab building positions from config would be great to know... Edit: Run this once to get all valid buildings that have more than 3 positions, the array of building classnames will be stored in the clipboard, simply paste it to a file and define it as an array for later in game use. Cheers
  10. Grumpy Old Man

    make an array with all buildings

    Well all houses/buildings are vehicles, so you need to filter CfgVehicles accordingly: _allHouses = "configName _x isKindOf 'House'" configClasses (configFile >> "CfgVehicles"); You need to filter for either "House" or "Building", since one of them has positions, the other has not. You can also filter current objects on the map, in case you run with mods and don't want to spawn a mosque in Chernarus. Cheers
  11. Grumpy Old Man

    make an array with all buildings

    What are you trying to do? If you want to access building positions just use the buildingPos command, way faster than storing all buildings and positions in an array, if that's what you want to do. Cheers
  12. Grumpy Old Man

    HELICOPTER EXFILTRATION - HOW DOES THIS WORK?

    Solution without triggers: 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 = [_chopper,_projectile] spawn { params ["_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 } } }] }; //to run the function: [player,chopper] spawn GOM_fnc_chopperPickup; Using waypoints can be funky sometimes, doing this with a simple script snippet is a bit more convenient. This will allow the player to mark the landingzone of the chopper by throwing a smoke grenade, chopper will land and wait for the player to board it with engines on, then will move to [0,0,0] once the player is in it, you can add your own position or whatever. Cheers
  13. Grumpy Old Man

    Earplugs in multiplayer

    You can also put this into one addAction: GOM_earplugID = player addAction ["Earplugs Off",{ _plugState = missionNamespace getVariable ["GOM_fnc_plugState",false]; 1 fadeSound ([1,0.15] select _plugState); player setUserActionText [GOM_earplugID, ["Earplugs On","Earplugs Off"] select _plugState]; missionNamespace setVariable ["GOM_fnc_plugState",!_plugState]; },0,1,false,false,"","_target isEqualTo _this"]; Also I wouldn't use soundVolume for checks, since the returned value will not gradually change over time, it will immediately take the value set by fadeSound, no matter the time parameter. Cheers
  14. Another thing to add to the systemchats all over the place mentioned by @TeTeT, I usually put in a function that's used to hand out debug info to either hint, systemchat and/or .rpt. Can be called from any function since it's initialized via preInit and has useful parameters: GOM_fnc_debugging = true; GOM_fnc_Debug = { params["_override","_output","_message"]; if (GOM_fnc_debugging OR _override) then { if (1 in _output) then {systemchat _message}; if (2 in _output) then {hintSilent _message}; if (3 in _output) then {diag_log _message}; }; }; //this way you can enable debug messages like this: _localDebugging = true; [_localDebugging,[1,3],format ["Error in %1",_fileName]] call GOM_fnc_Debug; //will print the error in filename message in systemchat and .rpt log if GOM_fnc_debugging is set to true GOM_fnc_debugging = false; [_localDebugging,[1,3],format ["Error in %1",_fileName]] call GOM_fnc_Debug; //will print the error in filename message in systemchat and .rpt log only if the local debugging flag is set to true Just made this out of memory, the real function is a bit too intertwined with other stuff from my library but should give anyone a better idea on useful debugging stuff. Pretty much the backbone and mandatory for medium+ sized projects. Cheers
  15. Grumpy Old Man

    the "addactions" do not stack

    Forum can be funky sometimes, especially when multitabbing and writing in various tabs at once (and even 2+ browser instances). Had posts end up in other threads at least 2 times. Cheers
  16. Been there, on my own stuff. Involved various functions spread all over the place. Wasn't much of a problem when working on it, coming back to this mess after a 6 month break on the other hand made me just start from scratch again, heh. Cheers
  17. I usually keep stuff split by functionality/content as much as possible. Stuff that should be tweaked goes to a separate file into mission root for ease of access, like multipliers for enemy units, customizable parameters etc. data related stuff also goes to a separate file inside /script/GOM/something, like unit loadouts, arrays of positions etc. Then I put everything that's CPU intensive into pre/postInit calls where possible. Helps keeping things in order, especially when you reach a total of 150+ .sqf files, heh. That's about it. Cheers
  18. Grumpy Old Man

    Need Help To Prevent Spamming Moves

    Here's how you can do a simple time based lockout: test addEventHandler ["Firednear", {[_this select 0] call Frog_Roll}]; Frog_Roll = { params ["_target","_shooter"]; _lockoutTime = 5; _lastLockout = _target getVariable ["GOM_fnc_lockout",-_lockoutTime];//so it returns -5 as default, initially enabling the roll if (time < _lastLockout + _lockoutTime) exitWith {false}; //at this point the last lockout was more than 5 seconds ago, so we save the current lockout time on the unit, then roll _target setVariable ["GOM_fnc_lockout",time,true]; _rolls = selectRandom ["amovppnemstpsraswrfldnon_amovppnemevaslowwrfldr","amovppnemstpsraswrfldnon_amovppnemevaslowwrfldl"]; _target switchmove "amovppnemstpsraswrfldnon_amovppnemevaslowwrfldr"; }; Pretty straightforward, heh. Cheers
  19. @HazJ how are you running the setVariable one for 0.0007ms? Do I really need to upgrade my CPU already? Heh... Cheers
  20. Just for the curious: missionNamespace setVariable ["abc", 123];//0.001ms call compile format ["%1 = %2", "abc", 123];//0.0025ms Performance loss is kinda given. Some other reason for not using call compile format, in terms of sending code via network, though a bit unrelated to this topic. Cheers
  21. Grumpy Old Man

    Detect server shutdown

    Like @pierremgi stated, waiting for an escape keydown event might be the most fitting solution. Alternatively you could make it so players can only save gear at specific locations/objects, though that might not be suited depending on mission type. Cheers
  22. Grumpy Old Man

    Detect server shutdown

    Try getClientState, works on dedicated as well. Cheers
  23. Grumpy Old Man

    What's wrong with Triggers

    It's not, the in command doesn't care about upper/lower case, case sensitivity is only needed for comparing strings: "test" in ["Test","TEST"];//false "Test" in ["Test","TEST"];//true In the example made by the thread author there's no case sensitivity involved: (player in thisList) || (heli_1 in thisList) || (heli_4 in thisList) //same as (pLaYeR in thisList) || (hElI_1 in thisList) || (HeLi_4 in thisList) Cheers
  24. Grumpy Old Man

    How to use setVehicleVarName?

    No need for remoteExec addAction in SP, should be fine. Cheers
  25. Grumpy Old Man

    How to use setVehicleVarName?

    That's handled inside the executed code by addAction, which receives parameters on its own: GOM_fnc_respawnBoat = { params ["_oldBoat","_respawnedBoat"];//these parameters are passed by the respawn module _respawnedBoat addAction ["All into the boat",{ params ["_target", "_caller", "_actionId", "_arguments"];//these parameters are passed by the addAction /* _target will be the boat object, _caller the player who activated the action */ }]; }; Something like this. You'd probably need to remoteExec the addAction so that every player can see the action in MP. Cheers
×