Jump to content

Grumpy Old Man

Member
  • Content Count

    4277
  • Joined

  • Last visited

  • Medals

Community Reputation

3339 Excellent

About Grumpy Old Man

  • Rank
    Second Lieutenant

core_pfieldgroups_3

  • Occupation
    Audio Engineer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Grumpy Old Man

    Detect open windows

    You could do with lineIntersect and check every building position, similar to example 2 in a post I made: Other than that if it's for vanilla buildings on maps like takistan then you could go through all buildings and add them manually to an array, shouldn't take too long. Cheers
  2. Just don't forget to post a solution if you found one, though the example on the wiki should be close enough, heh. Cheers
  3. Well you could use drawIcon on map display (12 ctrl 51 as seen on the wiki I guess?). Cheers
  4. The post you're quoting is from @Larrow though, I didn't even post in this thread, heh. Cheers
  5. Why the excessive use of private? You could approach it like this: //init.sqf or where you think fits best TAG_fnc_occupiedPositions = []; TAG_fnc_availablePositions = []; _allBuildings = nearestObjects [_markerpos,["building"],100]; _allBuildings apply {TAG_fnc_availablePositions append (_x buildingPos -1)}; //when spawning a unit if !(TAG_fnc_availablePositions isEqualTo []) then { _posIndex = round random count TAG_fnc_availablePositions - 1; _pos = TAG_fnc_availablePositions # _posIndex; _unit = createGroup east createUnit [typeOf player,_pos]; TAG_fnc_occupiedPositions pushBack (TAG_fnc_availablePositions deleteAt _posIndex);//move position to occupied array _unit setVariable ["TAG_fnc_spawnPosID",_posIndex]; _unit addEventHandler ["Killed",{ params ["_unit"]; _posIndex = _unit getVariable ["TAG_fnc_spawnPosID",-1]; TAG_fnc_availablePositions pushBack (TAG_fnc_occupiedPositions deleteAt _posIndex); diag_log format ["Unit died - Clearing position index %1",_posIndex]; }]; } else { diag_log "Cancelled AI spawn - no more available positions" }; Not tested and just quickly typed, should work though, adjust as you seem fit. This will allow to only spawn one unit per position and locks the position until the unit has died. Should get you started. Cheers
  6. While nearEntities is pretty fast and checks a sphere this will only work if the units are stationary on the building positions. You could have 2 arrays, one holding all positions, and another one holding all occupied positions. When you spawn a unit you can check if the position is already occupied, if not spawn a unit there and put the position into the occupied array. You can free occupied positions either by a killed eventHandler or after a certain time, plenty of ways to go about this. Cheers
  7. Grumpy Old Man

    Scripted Takecover for ai.

    Setting the behavior to "STEALTH" should do just that. Cheers
  8. Ah, I see. Well you can always have an array of all mortar units and go from there, like so: //inside mortar group team leader or whatever you seem fit TAG_fnc_mortarUnits = units group this; //initPlayerLocal.sqf or similar player addAction ["Mortars rearm!",{ params ["_object","_caller","_ID"]; _needRearm = TAG_fnc_mortarUnits select {/*your rearm condition*/}; hint format ["Mortars need rearm:\n\n%1",_needRearm]; { //rearm stuff here } forEach _needRearm; }, [], 1, true, true, "", "_target == _this and count (TAG_fnc_mortarUnits select {/*your rearm condition*/}) > 0"]; This action will only be visible if at least one unit from the mortar array matches the filter condition and execute the rearm code on all units in need of rearming. Adjust rearm code and condition as needed, should get you started. Cheers
  9. Well you can have one action on every unit, that adds units to an array and then another action that does something with all units in that array, if I understood your intentions correctly. Cheers
  10. Grumpy Old Man

    show script error

    You're still getting script errors? Cheers
  11. Sure, local to each client and passes player object, as you stated in your second post. If you need to pass player object to the server you can always use initPlayerLocal.sqf with remoteExec. Be more specific about what you want to achieve, maybe initPlayerServer will work better, the notion that "initPlayerServer.sqf should be avoided" which you quoted is not a general statement and related to a specific use case of CfgRemoteExec. Cheers
  12. Why not use initPlayerLocal.sqf? Cheers
  13. Grumpy Old Man

    [Release] GOM - Aircraft Loadout V1.35

    Just did some more testing of the damage stuff: onEachFrame { _veh = test; _part1 = getAllHitPointsDamage _veh # 2; _part2 = getAllHitPointsDamage _veh #2 findIf {_x > 0}; _part3 = getAllHitPointsDamage _veh #2 # (0 max (getAllHitPointsDamage _veh #2 findIf {_x > 0})); hintSilent format ["Hitpoints Damage:\n%1\n\nHitpoint Index:\n%2\n\nReturned Damage:\n%3\n\nVehicle Damage:\n%4",_part1,_part2,_part3,damage _veh]; } This can be used to test certain vehicles for damage, returning a hitpoints damage values array, the index of a damaged hitpoint (-1 if not found), the damage amount of the first found damaged hitpoint (0 if nothing is damaged) and the vehicle damage (which for some reason will return 0 even if a vehicle has some damaged hitpoints). So to return if ANY part of a vehicle has been damaged, the _part3 variable will do, like so: //line 1025 in scripts\GOM\functions\GOM_fnc_aircraftLoadoutInit.sqf _curDamage = getAllHitPointsDamage _veh #2 # (0 max (getAllHitPointsDamage _veh #2 findIf {_x > 0})); This should work, unless there's something odd at play, maybe some .rpt logs might provide further info if it still doesn't work. Cheers
  14. Grumpy Old Man

    [Release] GOM - Aircraft Loadout V1.35

    Could be, the snippet I posted should return any damage on any hitparts of the vehicle, so not sure why it's not working, would be worth investigating further if vanilla vehicles are also affected. Nice, I like it, keeps the center of the screen free to observe, heh. Cheers
  15. Grumpy Old Man

    [Release] GOM - Aircraft Loadout V1.35

    Seems odd, getAllHitPointsDamage returns all data needed, unless there's something off with the vehicle (mod I assume?). Can you try with a vanilla chopper and see if it's the same issue? Cheers
×