-
Content Count
4333 -
Joined
-
Last visited
-
Medals
Everything posted by Grumpy Old Man
-
Countdown Timer on screen
Grumpy Old Man replied to hellstorm77's topic in ARMA 3 - MISSION EDITING & SCRIPTING
For color you might use something like this: //function: TAG_fnc_coloredCountdownHint = { _color = "#45f442";//green _timeLeft = TAG_fnc_countdownEndTime - time; if (_timeLeft < 16) then {_color = "#eef441";};//yellow if (_timeLeft < 6) then {_color = "#ff0000";};//red if (_timeLeft < 0) exitWith { //exit and remove eventhandler while politely closing the door removeMissionEventhandler ["EachFrame",_thisEventHandler]; hintSilent parseText format ["<t color='%1'>--- Time is up! ---</t>",_color]; }; hintSilent parseText format ["Time Left:<br/><t color='%1'>--- %2 ---</t>", _color, [(_timeLeft/3600),"HH:MM:SS"] call BIS_fnc_timetostring]; }; //calling the function: _duration = 20; TAG_fnc_countdownEndTime = time + _duration; addMissionEventHandler ["EachFrame",{[] call TAG_fnc_coloredCountdownHint}]; Cheers -
Can't make AI airstrike on trigger
Grumpy Old Man replied to GreenXp's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Some folks might be better off to learn how to learn. Cheers -
Can't make AI airstrike on trigger
Grumpy Old Man replied to GreenXp's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What's stopping you from learning how to run third party scripts? There's at most 3-4 ways to run any third party script, it's not like you're going to waste multiple months on learning how to do it. In most cases (including the one linked by @beno_83au) there are instructions hiding in plain sight. Cheers -
LoadOut Per Steam Uniqe ID
Grumpy Old Man replied to Yuval gazit's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What did you try so far? Cheers -
scripts Clear Roads Script - Optimization Required
Grumpy Old Man replied to Lemonwired's topic in ARMA 3 - MISSION EDITING & SCRIPTING
It's similar in function and faster but not in outcome, + returns the resulting array while append modifies the first array without returning anything on its own: _arr = [1,2,3] + [4,5,6] systemChat str _arr;//prints [1,2,3,4,5,6] _arr = [1,2,3] append [4,5,6] systemChat str _arr;//prints nothing _arr1 = [1,2,3]; _arr = _arr1 append [4,5,6]; systemChat str _arr1;//prints [1,2,3,4,5,6] In the case of the snippet above it's not needed to store any of the retrieved roads and objects in an array, so I used apply to simply hide all objects returned from the respective commands. Apply also doesn't run on an empty array, in case a road doesn't have any nearby objects this could throw errors needing another if check. You can do an isKindOf check (only needed for nearObjects) to exclude infantry objects from being removed: params [ ["_centerPos", getPosATL player], ["_roadRadius", 100], ["_objectRadius", 10] ]; _centerPos nearRoads _roadRadius apply { (getPos _x nearObjects _objectRadius select {!(typeOf _x isKindOf "Man")}) apply {hideObjectGlobal _x}; nearestTerrainObjects [getPos _x, [], _objectRadius] apply {hideObjectGlobal _x}; }; Cheers -
Machine learning / AI projects using ArmA?
Grumpy Old Man replied to specialsmith's topic in ARMA 3 - GENERAL
Most likely because they're tailored towards the preferred gameplay of those communities. Folks who tend to play in squads of 10-15 units would require a different type of AI than public servers with 50+ players. Doubt anything else going on, since you really can't mess with AI brain on an engine level. Cheers -
scripts Clear Roads Script - Optimization Required
Grumpy Old Man replied to Lemonwired's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Worst case is that the scripts you put into the eachFrame EH will run on the next frame. At 60fps this means it can take up to 16.67ms until the snippet is actually run. Compare that to the 0.33ms runtime of the snippet above, doubt "call" delays this in any order of significance. Cheers -
scripts Clear Roads Script - Optimization Required
Grumpy Old Man replied to Lemonwired's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Doubt this will work, since append doesn't return anything. Why not just a simple call? Got any numbers on that to compare eachFrame+instant removal / call / execVM? Anyway I doubt the time until the snippet is being executed is relevant here, since the snippet itself takes quite a while to finish. Testing this (fixed to make it work): params [ ["_pos", player], ["_radius", 100], ["_radius2", 10] ]; _roadList= getpos _pos nearroads _radius; _notobjects = []; for "_i" from 0 to (count _roadList) do { _objs = getpos (_roadList select _i) nearObjects _radius2; {hideObjectGlobal _x} foreach _objs; _terrObjs = nearestTerrainObjects [getPos (_roadList select _i), [], _radius2]; {hideObjectGlobal _x} foreach _terrObjs; }; //Result: //0.669565 ms The culprit here is that you neither need the for loop (no _i is needed), nor the assignment of all roads and nearby objects to variables, and also can skip the additional forEach loop to hide objects, and condense all operations down to as few as possible: params [ ["_centerPos", getPosATL player], ["_roadRadius", 100], ["_objectRadius", 10] ]; _centerPos nearRoads _roadRadius apply { getPos _x nearObjects _objectRadius apply {hideObjectGlobal _x}; nearestTerrainObjects [getPos _x, [], _objectRadius] apply {hideObjectGlobal _x}; }; //Result: //0.330003 ms This works in less than half the duration of the previous snippet. Tested on Altis, Lakka at [12345.4,15669.5,0.00154877]. To further increase speed you could use map center as _centerPos, check all roads on the entire map and run this as custom function from CfgFunctions during preInit. Doubt you'll notice a wait of more than 1-2 seconds once upon mission start. Cheers -
Working EOD Talon Bot?
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
A 20min long MLRS 230mm rocket barrage should get rid of all mines in the area. Cheers- 1 reply
-
- 2
-
scripts Clear Roads Script - Optimization Required
Grumpy Old Man replied to Lemonwired's topic in ARMA 3 - MISSION EDITING & SCRIPTING
And the benefit from doing so will be what exactly? Cheers -
General Discussion (dev branch)
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
Thought I'd never see the day... Those new commands look interesting. Cheers -
Add action if item is in inventory
Grumpy Old Man replied to Dj Rolnik's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Those if then else statements are redundant, since you already check the (binary) outcome in the if condition, you can simply use it as the setVariable value. You can condense it down to this: player addEventHandler ["Put", { params ["_unit", "_container", "_item"]; _unit setVariable ['ABC_hasSpecificKit', (backpack _unit isKindof "tfw_ilbe_a_gr") && {"tfw_rf3080Item" in (items _unit + assignedItems _unit)}]; } ]; player addEventHandler ["Take", { params ["_unit", "_container", "_item"]; _unit setVariable ['ABC_hasSpecificKit', (backpack _unit isKindof "tfw_ilbe_a_gr") && {"tfw_rf3080Item" in (items _unit + assignedItems _unit)}]; } ]; Cheers -
Limit player's vehicle speed
Grumpy Old Man replied to MechSlayer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Something like this: vehicle player setmass getmass vehicle player * 100 Cheers- 1 reply
-
- 1
-
Problems trying to replace nearobjects with nearentities
Grumpy Old Man replied to ofp_f3d3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Best way would be to add a fired eventhandler to all arty guns on the map, ammo check inside to exclude commander hmg/gmg turrets and put all valid arty shell into a global array. Then filter the array and display only those projectiles via markers/draws on the map that meet certain criteria (above 1km altitude / vertical velocity < 0 / etc.) and remove null elements every n seconds. Cheers -
math Match numbers place increase
Grumpy Old Man replied to NumbNutsJunior's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Had to read the first post at least 5 times and still don't quite get it. The example also doesn't make sense since 10000+25000 != 25000. Do you want to increase the step size after a certain value has been reached? Could be like this: _output = []; _max = 500000; _steps = [2500,25000,250000]; _increaseAt = [0,10000,100000]; _current = 0; _increase = 0; while {_current < _max} do { if (_increaseAT find _current > -1) then {_increase = _steps#(_increaseAt find _current)}; _current = _current + _increase; _output pushBack _current; }; hintSilent str _output; copyToClipboard str _output; //prints: [2500,5000,7500,10000,35000,60000,85000,110000,135000,160000,185000,210000,235000,260000,285000,310000,335000,360000,385000,410000,435000,460000,485000,510000] Cheers -
Help - Post parajump: AI detach from group if distant from player
Grumpy Old Man replied to pappagoat's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Check the syntax of isTouchingGround, you got the order wrong, should be isTouchingGround _x. Cheers -
Help - Post parajump: AI detach from group if distant from player
Grumpy Old Man replied to pappagoat's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well did you take a look at the link I posted? Cheers -
Buffing up the chopper for an arcadish mission
Grumpy Old Man replied to Hellrot's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well you could kick out any units that were inside: heli addEventHandler ["Killed", { params ["_heli"]; {moveOut _x; _x allowDamage true} forEach crew _heli; }]; Cheers -
Buffing up the chopper for an arcadish mission
Grumpy Old Man replied to Hellrot's topic in ARMA 3 - MISSION EDITING & SCRIPTING
To make all crew invincible upon boarding a vehicle: yourVehicle addEventHandler ["GetIn", { params ["_vehicle", "_role", "_unit", "_turret"]; _unit allowDamage false; }]; yourVehicle addEventHandler ["GetOut", { params ["_vehicle", "_role", "_unit", "_turret"]; _unit allowDamage true; }]; This will reduce damage by 90%, if total damage will be above 0.9 then the incoming damage is reduced to 0: //chopper receives only 10% of incoming damage and will get a damage of 0.9 at max yourVehicle addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; _return = _damage * 0.1; if (damage _unit + _return > 0.9) then {_return = 0}; _return }]; Note that for some reason the chopper will explode, no matter what, if the rotor is touching the ground. Cheers -
CRV-6e Bobcat use in mine/ied clearing
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Shouldn't take any, at least last time I tried. You need to drive slowly over the mine with the plow lowered, is a bit wonky with keyboard, but using a HOTAS or other analog axis for acceleration it's smooth as a 2A46 125mm barrel. Use this to lower the plow if there isn't already an implemented way of doing so: vehicle player animatesource ["moveplow", 1]; Cheers -
CRV-6e Bobcat use in mine/ied clearing
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Lower the plow and drive slowly over the mines. Cheers -
Helicopter Rotor script interaction
Grumpy Old Man replied to Devastator_cm's topic in ARMA 3 - MISSION EDITING & SCRIPTING
No way other than faking it with a spawned chopper, since all relevant rotorLIB script commands are getters only, at least last time I tried, this is the snippet I used to make a chopper spool up for 5s then take off: _test = [] spawn { _chopper = chopper; _chopper engineOn true; sleep 5; _chopperType = typeOf _chopper; _pos = getPosATL _chopper; _dir = getDir _chopper; _newChopper = createVehicle [_chopperType, [0,0,500], [], 0, "FLY"]; _chopper setposatl [0,0,5000];//remove chopper to prevent explosions before setposing the other to its position {_chopper deleteVehicleCrew _x} forEach crew _chopper; deleteVehicle _chopper; _newChopper allowDamage false; _newChopper setDir _dir; _newChopper setPosATL _pos; createVehicleCrew _newChopper; driver _newChopper move [0,0,0]; _newChopper allowDamage true; }; With 5 seconds it already looks wonky, no way having it take off within a second will look believable (unless it's needed for out of sight take-off, shouldn't matter then). Other than that no way to reduce a choppers spool up time. Cheers -
Helicopter Rotor script interaction
Grumpy Old Man replied to Devastator_cm's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Just spawn it mid-air with "FLY" parameter then setPosATL on the ground, should do the trick. Cheers -
Help - Post parajump: AI detach from group if distant from player
Grumpy Old Man replied to pappagoat's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If you're not sharing the errors you're getting it's unlikely this forum will solve them. To find possible causes for errors it's always worth it to visit the wiki entries for the respective script commands you're using *hint hint*. Especially if you're not too sure you've got the syntax right. Cheers -
Don't do stuff like that, it's terrible practice and nonsensical. It's hard to tell at first glance what you're trying to check. You can simply condense it down to !_RestrainedQuery And that's it. Also naming convention could be better since the variable name doesn't really tell you anything about the contents of a variable. If it's a bool you can use something like _isRestrained or similar. To make an animation play only when needed use animationState or an animation eventhandler, not a waitUntil loop that's getting executed on every frame. Cheers