-
Content Count
4313 -
Joined
-
Last visited
-
Medals
Everything posted by Grumpy Old Man
-
[SOLVED] Addaction run once
Grumpy Old Man replied to anfo's topic in ARMA 3 - MISSION EDITING & SCRIPTING
In the script parameter. Cheers -
[SOLVED] Addaction run once
Grumpy Old Man replied to anfo's topic in ARMA 3 - MISSION EDITING & SCRIPTING
With multiple actions on the same object this could lead to unwanted removal of actions added by other scripts/addOns. Cheers -
[SOLVED] Addaction run once
Grumpy Old Man replied to anfo's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Inside the addAction: _this#0 removeAction _this#2 Cheers -
Draw circle on terrain in script
Grumpy Old Man replied to JB47394's topic in ARMA 3 - MISSION EDITING & SCRIPTING
For using proper math you'd use something like this: _centerPos = getPosATL player; _centerPos params ["_centerPosX","_centerPosY"]; _distance = 20; _angle = 2;//will place objects every 2° for "_i" from 0 to (360-_angle) step _angle do { "Sign_Arrow_F" createVehicle [_distance*cos(_i) + _centerPosX,_distance*sin(_i) + _centerPosY]; }; Basic formula to get positions of a circle. Cheers -
spawn spawning a icon om map thru trigger
Grumpy Old Man replied to Play3r's topic in ARMA 3 - MISSION EDITING & SCRIPTING
On a sidenote, you can look at script commands sorted by functionality: Go to the Scripting Commands page Click Scripting Commands by Functionality Click Command Group: Markers All there in plain text. Cheers -
Any official info on backwards compatability of ENFUSION engine and Arma 3 content?
Grumpy Old Man replied to xon2's topic in ARMA 3 - GENERAL
Thought there were zombies in dayz? Cheers- 14 replies
-
Point out a building to players at distance through optics
Grumpy Old Man replied to Tankbuster's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Pretty much this. Working with grids should be pretty mandatory in a game like this, I usually prefer to hand out target locations like that. 8 digit grid should be precise enough for buildings, though I usually prefer to flatten the approximate 4 digit grid area with a 15 minute barrage of 230mm MLRS. Here's some functions to convert position to 6/8/10 digit grid and 6/8/10 digit grid to map position: GOM_fnc_gridToPos = { params ["_grid"]; _count = count _grid; _banana = _count / 2; _multis = [1,10,100]; _counts = [10,8,6]; _multi = _multis select (_counts find _count); _posX = (parseNumber (_grid select [0,_banana])) * _multi; _posY = (parseNumber (_grid select [_banana,_banana + _banana])) * _multi; [_posX,_posY,0] }; GOM_fnc_posToGrid = { params ["_pos",["_gridSize",6,[0]]]; _divisors = [100,10,1]; _gridSizes = [6,8,10]; _divisor = _divisors select (_gridSizes find _gridSize); _gridResolution = _gridSize / 2; _pos params ["_posX","_posY"]; _posX = str round floor (_posX / _divisor); _posY = str round floor (_posY / _divisor); while {count _posX < _gridResolution} do { _posX = "0" + _posX; }; while {count _posY < _gridResolution} do { _posY = "0" + _posY; }; _posX + _posY }; Cheers -
Why doesn't this code work?
Grumpy Old Man replied to Thorimus's topic in ARMA 3 - MISSION EDITING & SCRIPTING
{if (side = civilian) Can't work. Side requires an argument, check the syntax. The equal sign assigns a value to a variable, you need double equal signs for a comparison (==) or isEqualTo. Cheers -
Open/Lock doors from container
Grumpy Old Man replied to Purzel's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Animations using animate command won't animate when called from init field, since the init field of objects is called before the mission begins. Add a spawn and a sleep, should usually do the trick. Cheers -
A trigger that is activated only by a specific unit seeing a side
Grumpy Old Man replied to pognivet's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Something like this could do: //init.sqf GOM_fnc_unitKnowsAboutSide = { params ["_unit","_side",["_range",viewDistance]]; count (_unit nearTargets _range select {_x#2 isEqualTo _side}) > 0; }; //simple loop to test: _loop = [civ,west] spawn { waitUntil { hintSilent format ["Waiting for %1 targets...",_this#1]; _this call GOM_fnc_unitKnowsAboutSide }; hintSilent format ["%1 target found!",_this#1]; }; //to check from trigger: [yourCiv,west] call GOM_fnc_unitKnowsAboutSide The check is extremely fast, probably better to ditch the function (adds quite some overhead) and just use the count nearTargets line to match your needs. Cheers- 1 reply
-
- 2
-
-
-
Sweeping camera from one point to another and back
Grumpy Old Man replied to Purzel's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Quick? That happened 4 years ago, how about that? Heh... Cheers -
Sweeping camera from one point to another and back
Grumpy Old Man replied to Purzel's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Here's what I was using back in the days. Cheers -
Automatic Spawning Mortor team that fires?
Grumpy Old Man replied to Grim5667's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Your example shouldn't run in the first place, the function definitions have the prefix GOM, then later down the line you changed it to GRM, so there's that. The # command is greedy or whatever's the term, so an additional bracket is needed: _targetPos = (effectiveCommander _mortar targetKnowledge (selectRandom _nearby))#6; (effectiveCommander _mortar) commandArtilleryFire [_targetPos,_mag,_rounds]; Cheers -
Automatic Spawning Mortor team that fires?
Grumpy Old Man replied to Grim5667's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What do you mean with "almost"? Your question was: Does exactly what you asked for. You can adjust the condition and other stuff as you seem fit. Currently they're firing as long as anyone on their side knows about the target: side _mortar knowsAbout _x > 0 You can increase the number from 0 up to 4, which means they will only fire if you've recently revealed yourself (it's a bit more complicated but that about sums it up). Also you could use targetKnowledge (parameter 7) to fire on the position the enemy last saw you at: //replace this line: (effectiveCommander _mortar) commandArtilleryFire [(getPosATL (selectRandom _nearby)),_mag,_rounds]; //with the following: _targetPos = (effectiveCommander _mortar targetKnowledge (selectRandom _nearby)#6); (effectiveCommander _mortar) commandArtilleryFire [_targetPos,_mag,_rounds]; Cheers -
Open/Close Bargate solution !
Grumpy Old Man replied to pokertour's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Not sure what you want, you can't lock the bargate with a key, the setVariable option you mentioned only works on building doors from what I know. Your only way would be to bruteforce the bargate closed if no blufor is nearby, if that's what you want: _gateStuff = [gate] SPAWN { params ["_gate"]; while {alive _gate} do { //small delay before closing the gate again sleep 5; waitUntil { _gate animate ["Door_1_rot", 0]; count (_gate nearEntities 8 select {side _x isEqualTo west}) > 0 }; _gate animate ["Door_1_rot", 1]; waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) == 0}; _gate animate ["Door_1_rot", 0]; }; }; Cheers -
A way to "Spawn" Trigger?
Grumpy Old Man replied to fin_soldier's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Depending on trigger activations this might not work since a trigger automatically deactivates once its condition is no longer met. Given the example of both triggers being activated by blufor units, as soon as no blufor unit is inside the trigger1 area, the trigger will deactivate and triggerActivated trigger1 returns false. Works like a toggle, in the case of the thread starter a switch like behavior is needed. Cheers -
A way to "Spawn" Trigger?
Grumpy Old Man replied to fin_soldier's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You can do this very easily, trigger1 onAct field: missionNamespace setVariable ["GOM_fnc_switch1",true] In trigger2 condition field: this AND missionNamespace getVariable ["GOM_fnc_switch1",false] Cheers -
Well you'd have to find a way to call those functions anyway, so there's no way around using a script in the first place. I guess HC modules simply go through the config, no idea how to access group icons otherwise, group icons are defined via cfgGroupIcons. Cheers
-
Quickly threw this one together: findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " _display = _this#0; { _icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon'); _display drawIcon [ _icon, [0,0,1,1], getPosVisual _x, 24, 24, getDirVisual _x, name _x, 1, 0.03, 'TahomaB', 'right' ]; _display drawLine [ getPosVisual _x, getPosVisual leader _x, [0,0,1,1] ]; } forEach allUnits; { _offSet = [50,50,0]; _iconPos = getPosVisual leader _x vectorAdd _offSet; _icon = getText (configfile >> 'cfgGroupIcons' >> _x getVariable ['GOM_fnc_groupIcon','b_inf'] >> 'icon'); _grpInfoText = _x getVariable ['GOM_fnc_groupInfoText','Unnamed']; _display drawIcon [ _icon, [1,1,1,1], _iconPos, 24, 24, 0, _grpInfoText, 1, 0.03, 'TahomaB', 'left' ]; _display drawLine [ _iconPos, getPosVisual leader _x, [0,0,1,1] ]; } forEach allGroups; "]; This will draw all units as icons, lines from each unit to its group leader and a designated group icon with customizable offset with another line connecting it to the respective group leader. You can add custom info per group like this: group this setVariable ["GOM_fnc_groupInfoText","1st Airborne"];//some random text you want group this setVariable ["GOM_fnc_groupIcon","b_air"];//has to be valid icon class from configfile >> "cfgGroupIcons", defaults to "b_inf" Cheers
-
Open/Close Bargate solution !
Grumpy Old Man replied to pokertour's topic in ARMA 3 - MISSION EDITING & SCRIPTING
playerSide will be different on every client, just use nearEntities to filter for west units: _gateStuff = [gate] SPAWN { params ["_gate"]; while {alive _gate} do { waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) > 0}; _gate animate ["Door_1_rot", 1]; waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) == 0}; _gate animate ["Door_1_rot", 0]; }; }; Cheers -
USS Freedom: AI won't board a chopper?
Grumpy Old Man replied to zagor64bz's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hopefully the next iteration will bring improvement in that area, though I'll still be skeptical and won't buy it depending on how AI turns out in the first place. Seeing how walkable moving objects are done in a plethora of games from 10 years ago should leave anyone positive. Cheers -
Considering arma, I'd say it's: Head dive onto the enemy and pull up when altitude < 25m. Cheers
-
There doesn't seem to be such a command. Might be worth giving the development branch a shot, having the ability to influence which record is shown per default really should be a given. Cheers
-
Random Mortar Script?
Grumpy Old Man replied to Reid236's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Here's a bit of a beefed up version of ambient arty impacts: //init.sqf GOM_fnc_spawnArtyShells = { params ["_impactCenter","_shellAmount","_shellType","_delayBetweenShells"]; for "_i" from 1 to _shellAmount do { _rndPos = _impactCenter getPos [random [0,50,0],random 360]; _rndPos set [2,500]; _shell = _shellType createVehicle _rndPos; _shell setPosASL _rndPos; _shell setVectorDirAndUp [[0,0,-1],[0,0.8,0]]; _shell setVelocityModelSpace [0,0,-70]; sleep _delayBetweenShells; }; }; GOM_fnc_ambientArty = { params ["_centerObject","_shellType","_minDistance","_maxDistance",["_delayBetweenShells",1.5],["_delayBetweenRounds",15],["_simultaneousRounds",1],["_minShellAmount",2],["_maxShellAmount",6]]; GOM_fnc_ambientArtyEnabled = true; while {GOM_fnc_ambientArtyEnabled} do { for "_i" from 1 to _simultaneousRounds do { _impactCenter = _centerObject getPos [_minDistance + random _maxDistance,random 360]; _shellAmount = _minShellAmount + round random _maxShellAmount; _spawn = [_impactCenter,_shellAmount,_shellType,_delayBetweenShells] spawn GOM_fnc_spawnArtyShells; waitUntil {scriptDone _spawn}; sleep _delayBetweenRounds; } }; }; //to call it: _centerObject = player;//center object of bombing _shellType = "Sh_82mm_AMOS";//bomb type _minDist = 150;//minimum impact distance to center _maxDist = 1500;//max impact distance to center _delayBetweenShells = 2;//seconds between single shells _delayBetweenRounds = 10;//seconds between rounds _simultaneousRounds = 4;//number of bombings at the same time _minShellAmount = 2;//minimum number of shells per bombing _maxShellAmount = 6;//max number of shells per bombing _bomb = [_centerObject,_shellType,_minDist,_maxDist,_delayBetweenShells,_delayBetweenRounds,_simultaneousRounds,_minShellAmount,_maxShellAmount] spawn GOM_fnc_ambientArty; To make the arty stop simply set GOM_fnc_ambientArtyEnabled to false. Cheers -
Counting when interacted with
Grumpy Old Man replied to ClickGamingNZ's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Basically what glorious @Larrow posted. Also good practice to keep things simple, like his suggestion of changing notFound to isFound to prevent double negatives from confusing you when debugging. These things tend to be hard to follow through and to get a grasp at first glance: //bad notDoSomething = true; if (!notDoSomething) then { //do something }; //good doSomething = false; if (doSomething) then { //do something }; Cheers