Jump to content

Grumpy Old Man

Member
  • Content Count

    4333
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. 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
  2. Grumpy Old Man

    Why doesn't this code work?

    {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
  3. Grumpy Old Man

    Open/Lock doors from container

    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
  4. 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
  5. Quick? That happened 4 years ago, how about that? Heh... Cheers
  6. Here's what I was using back in the days. Cheers
  7. 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
  8. 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
  9. Grumpy Old Man

    Open/Close Bargate solution !

    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
  10. Grumpy Old Man

    A way to "Spawn" Trigger?

    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
  11. Grumpy Old Man

    A way to "Spawn" Trigger?

    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
  12. Grumpy Old Man

    Group icons on map

    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
  13. Grumpy Old Man

    Group icons on map

    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
  14. Grumpy Old Man

    Open/Close Bargate solution !

    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
  15. 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
  16. Grumpy Old Man

    Helicopter tactics and technology

    Considering arma, I'd say it's: Head dive onto the enemy and pull up when altitude < 25m. Cheers
  17. Grumpy Old Man

    Diary record "focus"

    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
  18. Grumpy Old Man

    Random Mortar Script?

    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
  19. Grumpy Old Man

    Counting when interacted with

    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
  20. Grumpy Old Man

    Diary record "focus"

    Have you tried using BIS_fnc_selectDiarySubject? Cheers
  21. Grumpy Old Man

    Random Flight Paths

    Posted an alternative method using markers in the other topic, the more the merrier, heh. Cheers
  22. Grumpy Old Man

    Randomized Plane Paths

    Alternatively you could work with markers as seen in the link below: Cheers
  23. Grumpy Old Man

    Counting when interacted with

    No need to individually set variables if you simply want to return a default value: cursorTarget getVariable ['isFound', nil] isEqualTo false This will not work since you can't compare nil to bool However when first setting the following: box1 setVariable ["isFound", false, true]; will make the isEqualTo false check unnecessary and most likely confusing when you can simply check for this: cursorTarget getVariable ['isFound', false] isEqualTo false Again, no need to set any variable when you can simply check for a default value. You can also remove the distance check in the addAction condition and handle it from the addAction radius parameter #10. On top of that it always pays off to save variables on objects, in this case the player (boxesFound), so you'll have an easier time porting this to MP if needed. Depending on how you want to detect the interaction you can do this with addAction or, as @Larrow suggested, via ContainerOpened EH. Cheers
  24. Grumpy Old Man

    Orientation Callouts Completely Broken

    Thing is, sometimes the direction is correct, but not all the time. Cardinal directions seem to work 50% of the time, while relative directions like "front" or "back" seem to be wrong all the time. Looks like there's a +180° offset in there somewhere. Just played the combined arms showcase, got hostiles reported 100m behind me, so basically where I came from... Cheers
  25. Grumpy Old Man

    General Discussion (dev branch)

    Combined Arms Showcase is almost unplayable with default Veteran difficulty. If you're anywhere near the marshal you'll get your rear handed to you from the 40mms impacting 3-5 times every 0.3 seconds until the tires pop. If you stay at distance and make it past that point (has never been an issue in the past) your entire team gets wiped out by opfor units that seem to take way more hits than default editor placed units, heavily subjective though. Opfor seems not to have any issues advancing, while blufor seem to be heavily fatigued having to sprint for 1 minute (looks like speedMode "FULL" to me). The fact that enemy spotting still remains broken and your teammates report contacts to your rear when, in fact, they're in front of you doesn't really help either. Cheers
×