-
Content Count
4333 -
Joined
-
Last visited
-
Medals
Everything posted by Grumpy Old Man
-
Teleport to Vehicle anyone?
Grumpy Old Man replied to saddle's topic in ARMA 3 - MISSION EDITING & SCRIPTING
One of todays rare super powers, next to common sense. Cheers -
Using "sleep" - How to account for low FPS?
Grumpy Old Man replied to Leopard20's topic in ARMA 3 - MISSION EDITING & SCRIPTING
How about tackling the scripts that are causing that fps drop in the first place? Cheers -
General Discussion (dev branch)
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
If arma 4 will be to arma 3 what arma 3 was to arma 2, I'd not get my hopes up. Cheers -
Not an engine limitation, more like dev limitation. Given the rather new script commands setShotParents and forgetTarget, you can easily circumvent/reproduce this issue. Let a mortar (named mortar) fire at a tank (named angara), set the shot owner to the player, as soon as the round hits and you start moving/are clearly visually spottable by the tank, you're toast. This also works if the tank has no line of sight, as soon as he gets hit by the round, he knows where you are for some weird reason. mortar doartilleryfire [getposatl angara,currentmagazine this,1]; mortar addEventHandler ["Fired",{ params ["_arty"]; _projectile = _this # 6; _projectile setShotParents [vehicle player,player]; {deletevehicle _x} forEach [gunner _arty,_arty]; hintSilent "Mortar shot fired, owner set to player"; }]; Shouldn't require too much tinkering to make the tank forget about a unit he shouldn't know anything about in the first place, seeing how the threads about AI and AI driving barely get any attention nowadays I doubt this will be fixed in A3s remaining life cycle. The total lack of authentic reaction time of AI doesn't help either. Cheers
- 5179 replies
-
- 8
-
- branch
- development
-
(and 1 more)
Tagged with:
-
Hint not showing up
Grumpy Old Man replied to mercerqc's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Try your snippet in an empty mission just with the h1 named chopper, it works. Looks like the error is someplace else. Cheers -
Hint not showing up
Grumpy Old Man replied to mercerqc's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You don't necessarily need closing semicolons before a closing bracket. The snippet should work fine as is, are you sure there's a chopper named h1 on the map? Is this in MP or SP or dedicated? Cheers -
On HIT Explode (script help)
Grumpy Old Man replied to Alert23's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well this snippet only works for all civilian units, you need to adjust it to work for other objects. For canisters, place those gas canisters in the editor, name them gascan1, gascan2 etc: _gasCans = [gascan1,gascan2,gascan3];//put your objects in here { _x addEventHandler ["Hit",{ params ["_unit"]; _unit removeEventHandler ["Hit",_thisEventHandler]; _bomb = "APERSMine_Range_Ammo" createVehicle (_unit modelToWorld [0,0,0]); _bomb setDamage 1; }]; } forEach _gasCans; Cheers -
[HELP] SCRIPT AI VISIBLE WITH THERMAL NVG ONLY
Grumpy Old Man replied to ricoarma's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Count is faster, if you don't need to use _forEachIndex, count will be the faster solution (if you absolutely have to squeeze out every performance you can get). Thing is, sunOrMoon at 0.5 isn't anywhere close to dawn/dusk, it returns 1 during the day and still returns 1 when it's almost pitch black (most likely also depends on a maps lat/long config). Having a dummy unit and checking if it's currently using NVGs is a better way to check for darkness. Whatever looks better, I guess. How often it is checked can be neglected, since the entire check inside the EH runs for 0.0194ms (less than 0.1% of a frame) in this case: TAG_fnc_spoopy = (allUnits + vehicles) select {_x getVariable ["GOM_fnc_spoopy",false]}; addMissionEventHandler ["EachFrame",{ if (currentVisionMode player isEqualTo 2) exitWith { {_x hideObject false} count TAG_fnc_spoopy; }; {_x hideObject true} count TAG_fnc_spoopy; }]; When spawning units mid mission simply add them to the TAG_fnc_spoopy array via pushBack or whatever. Cheers -
[HELP] SCRIPT AI VISIBLE WITH THERMAL NVG ONLY
Grumpy Old Man replied to ricoarma's topic in ARMA 3 - MISSION EDITING & SCRIPTING
BIS_fnc_addStackedEventHandler is obsolete, since the addMissionEventHandler command completely replaces it (take a look at the function in the function viewer). Don't forget this only runs once each frame, having 100 units and 30 "invisible" ones makes the forEach loop run for 0.0225ms on my rig. Using count decreases this number to 0.018ms. In my example above, a bigger performance gain would be to put all "invisible" units in a global array, if you don't spawn new units that should be also "invisible", probably what you meant with the array and public variable. _spoopy = (allUnits + vehicles) select {_x getVariable ["GOM_fnc_spoopy",false]}; if (currentVisionMode player isEqualTo 2) exitWith { {_x hideObject false} forEach _spoopy; }; {_x hideObject true} forEach _spoopy; //runs for 0.147951ms //init.sqf: TAG_fnc_spoopy = (allUnits + vehicles) select {_x getVariable ["GOM_fnc_spoopy",false]}; //inside EH: if (currentVisionMode player isEqualTo 2) exitWith { {_x hideObject false} forEach TAG_fnc_spoopy; }; {_x hideObject true} forEach TAG_fnc_spoopy; //runs for 0.024ms, ~6x as fast Cheers -
[HELP] SCRIPT AI VISIBLE WITH THERMAL NVG ONLY
Grumpy Old Man replied to ricoarma's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Not sure why you're using sunOrMoon, but using a loop with 0.5s sleep for every single unit won't really yield good results, since it can take at most 1 second to hide the unit. Using an eachFrame EH for something as timing critical as this is basically a no brainer. Also using while true loops is bad practice, even when used as a quick example only. To make units invisible without using thermals one could use this: this setVariable ["GOM_fnc_spoopy",true]; in the units init field. Then inside initPlayerLocal.sqf of the mission root folder put this: addMissionEventHandler ["EachFrame",{ _spoopy = (allUnits + vehicles) select {_x getVariable ["GOM_fnc_spoopy",false]}; if (currentVisionMode player isEqualTo 2) exitWith { {_x hideObject false} forEach _spoopy; }; {_x hideObject true} forEach _spoopy; }]; This way you'll get the desired effect for each player individually. Cheers -
AI Vehicle chase issue
Grumpy Old Man replied to Ponzu.'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well you give them the move command to the players current position, which will always be off. Give the AI vehicle a move command with an estimated position where the player will be, considering the players current speed after a certain time. Quick simplistic example that will make chasing AI try to stay 5m to the right and 25m ahead of the hunted vehicles predicted position considering speed and heading: TAG_fnc_chase = { params ["_hunter","_hunted"]; _chasePositions = [[-5,0,0],[5,0,0]]; _prediction = 5;//will predict hunted position for n seconds considering its speed while {alive _hunter AND alive _hunted} do { _distance = speed _hunted * 0.277778 * _prediction; _predictedPos = (_hunted modelToWorldVisual [5,25,0]) getPos [_distance,getDirVisual _hunted]; _hunter domove _predictedPos; sleep 0.11; }; }; _chase = [hunter,hunted] spawn TAG_fnc_chase; Just keep in mind that a simple 180° turn will outmaneuver the AI, nothing anyone beside BI can do anything about. Cheers -
Random position random unit AI respawn script
Grumpy Old Man replied to Cockheaven's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Most comfortable way would be to grab all map markers with a certain keyword, "shai" in your case: _markers = allMapMarkers select {toUpper _x find "SHAI" >= 0}; _side = east; _myunitarray = ["C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Man_Polo_1_F","C_Man_Casual_1_F","C_Man_Shorts_1_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F"]; _spawnedGroups = []; { _grp = [getmarkerpos _x, _side, [selectRandom _myunitarray],[],[],[],[],[],180] call BIS_Fnc_spawnGroup; _spawnedGroups pushBack _grp;//in case you want to access all spawned groups {_x disableAI "PATH"} forEach units _grp; } forEach _markers; _spawnedGroups This will look for all markers containing "shai" (not case sensitive), so you can easily copy paste more markers without having to rename a single one. Then a random unit will be spawned on each marker, disabling AI path, so the unit will stay put while still able to turn around, change stance and fire at enemies. Cheers -
DPI is actually very important, especially if you use scopes and longer distance engagements are your thing. Best bet would be a mouse that can switch dpi on the fly with a single button (I'm using the Logitech G502). Since you can rest your weapon in arma having variable dpi is something not to be underestimated. In the following video I'm switching between 7500 dpi and 200 dpi for aiming. @20 seconds Cheers
-
Adding and deleting Event Handlers multiple times - is it bad?
Grumpy Old Man replied to Leopard20's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well if you're in control when this display is being created/closed, why the need for an eachFrame EH in the first place? A simple isNull findDisplay (~0.0007ms) check shouldn't have any visible impact on performance, even when checking on every frame (16.6667 ms @60fps). Cheers -
Disable the option for opening the backpacks of others (inventory) when they are alive
Grumpy Old Man replied to GEORGE FLOROS GR's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Try it without mods in vanilla, worked last time I checked. You shouldn't even see the inventory screen pop up. Cheers -
[Release] GOM - Aircraft Loadout V1.35
Grumpy Old Man replied to Grumpy Old Man's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You could set it to the vanilla value of 1*10^12 (yes, that's a trillion, a 1 with 12 zeroes, or 1.000.000.000.000), which is 1000000000000 for most support vehicles, technically infinite. Cheers -
[Release] GOM - Aircraft Loadout V1.35
Grumpy Old Man replied to Grumpy Old Man's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You can set the amount of repair/refuel/reammo cargo with certain functions, as mentioned in the first post, just open the spoilers. Cheers -
Custom side chat of life server
Grumpy Old Man replied to IGS Karma's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hard to tell without any examples or screenshots. You can always make your own chat channels though. About paying for scripts: don't. Cheers- 3 replies
-
- 1
-
- life server
- custom
-
(and 1 more)
Tagged with:
-
General Discussion (dev branch)
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
You can't claim that mechanical engineering is done, if you don't know what's yet to be discovered and how it will affect all of those fields that are intertwined in mechanical engineering. Has been the case ever since. Folks in the 1600s would never have thought that we'd land on the moon someday, be able to clone our pets, or have fridges that can order food for us via voice control, it was way out of their scope. But enough derailing here, heh. Cheers -
General Discussion (dev branch)
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
16 years can be enough to go from launching satellites into low earth orbit to sending astronauts to the moon. 16 years can be enough to go from inventing the WWW (1989) to having robot vacuum cleaners (2002). Don't underestimate time. Cheers -
error storing an array of terrain objects
Grumpy Old Man replied to b3lx's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I don't get what you're trying to do. You define terrain objects, filter them and have those objects stored in an array. Storing the array of objects inside a file contradicts your statement of wanting to randomize these objects in the first place. As @Larrow stated, doing it via postInit should eliminate most performance issues. Alternatively you could run BIS_fnc_objectVar on every object and save that as an array instead (if this actually works on terrain objects). Cheers -
Mk 45 Hammer as NGS needs the artillery computer
Grumpy Old Man replied to goose4291's topic in ARMA 3 - DEVELOPMENT BRANCH
I was talking about the in game model, as has been the point of discussion by the topic author until the thread derailed into comparing the current gun in game to its real life counterpart. 20° elevation (as the in game model had, last time I checked) would make classical high angle fire (which the AI is currently using) impossible. Cheers -
Ambient Light Source
Grumpy Old Man replied to TPM_Aus's topic in ARMA 3 - MISSION EDITING & SCRIPTING
As stated in my previous post, goofed around some more and added a simple FM sine function so the lights will now periodically begin to pulse, values can be adjusted as you seem fit. Should be pretty self explanatory with the comments. Looks pretty trippy, adding some particle effects to it like some fog dripping down from the treetops could be a next step, depending on how you want it to look like. _referencePos = getPosATL player; _trees = nearestTerrainObjects [_referencePos, ["Tree"], 25]; //filter trees to only get one tree every 7m because something something arma dynamic lights _finalTrees = []; while {count _trees > 0} do { _rndTree = selectRandom _trees; _trees = _trees select {_x distance2d _rndTree >= 7}; _finalTrees pushback _rndTree; }; _colorIntensity = 0.3;//play around with this, with multiple light sources this value should be kept rather low GOM_fnc_treeLights = []; { _lightAmbient = [_colorIntensity, 0, _colorIntensity];//tweak here _pos = getposATL _x; _light = "#lightpoint" createVehicleLocal _pos; _light setLightBrightness 0.75; _light setLightAmbient _lightAmbient; _light setLightColor _lightAmbient; _light setLightDayLight true; _light setLightUseFlare false; _light setLightFlareSize 5; _light setLightFlareMaxDistance 500; _light setLightAttenuation [2,4,4,0,9,10]; GOM_fnc_treeLights pushBack [_light,_lightAmbient]; } forEach _finalTrees; //fade colors over time GOM_fnc_changeColors = { params ["_light","_currentColor","_colors","_duration"]; _color = selectRandom _colors; _currentColor params ["_initR","_initG","_initB"]; _color params ["_targetR","_targetG","_targetB"]; _endTime = time + random [_duration / 2,_duration,_duration * 2]; _initTime = time; _finalColor = []; waitUntil { _finalColor = [ linearConversion [_initTime,_endTime,time,_initR,_targetR,true], linearConversion [_initTime,_endTime,time,_initG,_targetG,true], linearConversion [_initTime,_endTime,time,_initB,_targetB,true] ]; _light setLightAmbient _finalColor; time > _endTime };//pretty fluid for slow color transitions _recursionisonehelluvadrug = [_light,_finalColor,_colors,_duration] spawn GOM_fnc_changeColors; }; _colors = [[0.5,0,0.5],[0.3,0,0.3],[0,0.3,0],[0.3,0,0],[0,0,0.3]];//add or adjust the colors that will be used { _x params ["_light","_color"]; _change = [_light,_color,_colors,10] spawn GOM_fnc_changeColors;//color will change over the duration from 5 to 20 seconds randomly } forEach GOM_fnc_treeLights; GOM_fnc_2dWalker = { params ["_input","_change","_minValue","_maxValue"]; (_input + selectRandom [_change,- _change]) min _maxValue max _minValue;//stole this from a c++ project of mine }; GOM_fnc_sine = { params ["_amplitude","_frequency","_phase"]; _amplitude * sin (2*3.14159265359*_frequency*time+_phase); }; //this handles the color changing for every individual tree addmissionEventhandler ["EachFrame",{ //simple pulsating effect of all lights _globalModulation = 1.15;//will pulse with 15% intensity GOM_globalFrequency = ([_globalModulation,2.5,0] call GOM_fnc_sine) + _globalModulation; { if (diag_frameno % 2 == 0) then { _x params ["_light","_lightAmbient"]; _lightAmbient params ["_r","_g","_b"]; _new = [ [_r,0.005,0.1,0.76] call GOM_fnc_2dWalker, 0, [_b,0.005,0.1,0.76] call GOM_fnc_2dWalker ]; _light setLightAmbient _new; _light setLightColor _new; _x set [1,_new]; }; } forEach GOM_fnc_treeLights; }]; //this handles pulsating effect of every tree { _x params ["_light"]; //randomize pulsating parameters _frequency = 2 + random 2; _pulsate = [_light,_frequency] spawn { params ["_light","_frequency"]; _maxBright = 0.3; _second = false; waitUntil { _sine = ([_maxBright,(_frequency / 2) * GOM_globalFrequency,0] call GOM_fnc_sine) + (_frequency / 2); _light setLightBrightness _sine; if (round _sine isEqualTo 0 AND _second) then {_reset = true;_frequency = 2 + random 10}; !alive _light }; }; } forEach GOM_fnc_treeLights; Cheers -
Fun with Mortar Projectiles
Grumpy Old Man replied to madrussian's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Easiest approach would be to add all mortar shells to a global array and check on every frame if Z velocity is negative and n meters above ground. This could work out: //init.sqf or wherever you seem fit GOM_fnc_artyShells = []; //mortar init or other way to add the spawned shell to the array this addEventHandler ["Fired",{GOM_fnc_artyShells pushBack (_this#6)}]; addMissionEventHandler ["EachFrame",{ { if (velocity _x # 2 < 0 AND getPosATL _x # 2 < 50) then { hintSilent format ["Deleting %1\nVelocity: %2\nATL: %3",_x,velocity _x,getPosATL _x]; deleteVehicle _x; GOM_fnc_artyShells deleteAt _forEachIndex; }; } forEach GOM_fnc_artyShells; }]; Cheers -
nearObjects for weapons
Grumpy Old Man replied to Armanda551's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_obj = "AssaultRifle"; (_obj isEqualTo "AssaultRifle" || _obj isEqualTo "SniperRifle" || _obj isEqualTo "HandGun" || _obj isEqualTo "MachineGun"|| _obj isEqualTo "MissleLauncher") //best case, first condition matches: 0.0018ms _obj = "AssaultRifle"; (_obj in ["AssaultRifle","SniperRifle","HandGun","MachineGun","MissleLauncher"]) //0.001ms, roughly twice as fast Also you could pull weaponholders from the vehicles array, they're automatically stored in there. No need to use nearestObjects unless I'm missing something. nearestObjects [ player, [ "WeaponHolder", "WeaponHolderSimulated" ], worldSize ] //1.1507ms with 80 weaponholders in VR map (vehicles select {_x isKindOf "WeaponHolderSimulated" OR {_x isKindOf "WeaponHolder"}}) //0.0804ms with 80 weaponholders in VR map I also believe that any weapon holder created from killed units is a simulated one, so no need to retrieve the regular "WeaponHolder". Cheers