Jump to content

Grumpy Old Man

Member
  • Content Count

    4333
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. Well what do you know, this command even exists since 1.36... Cheers
  2. Wiki has some examples, also note that it's not actually eye direction rather than head direction, as stated in KKs comment. Cheers
  3. To get an array from a config you'd need to use the proper command. getArray will return an array from the selected config entry, though not what you need in this case. You just need to iterate over all cfg entries within the desired hierarchy. Could look like this: _fn = []; _cfg = (configfile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "FirstNames"); for "_i" from 0 to ((count _cfg) - 1) do { _fn pushBack getText (_cfg select _i); }; _fn //returns ["Alfie","Benjamin","Callum"... etc. Cheers
  4. Grumpy Old Man

    Fetch position from array and remove it

    Something like this could do: Markerarray = ["1","2","3","4","5","6","7","8","9","10"]; Markerarray = Markerarray call BIS_fnc_arrayShuffle; for "_i" from 0 to 3 do{ private ["_grp01","_unit"]; _grp01 = createGroup [east, true]; _unit = _grp01 createUnit [selectRandom ["uns_men_VC_mainforce_AS1","uns_men_VC_mainforce_HMG"], getMarkerPos (Markerarray # _i), [], 350, "FORM"]; }; Note your typo in private which I corrected, simply shuffle the array and iterate through the shuffled marker array to spawn units on the randomized markers. You also need to start the for loop at 0 for the first array index to work. Cheers
  5. Grumpy Old Man

    forEach, count or apply

    Unless you're actually running into performance issues I wouldn't worry too much about it. Just use the commands for their intended purpose, if you need an index to work with, use forEach, for array manipulation use apply, etc. To put it into perspective, considering a frame runtime of 16.6667ms at 60Hz, if one command is 0.01ms faster than another, it's still only a difference of 0.059% of the frames runtime. Would hurt as much as throwing away 60 cents if you got a grand in your wallet. Cheers
  6. Grumpy Old Man

    Restricting Dismissed Waypoint

    You could use something simple as this: TAG_fnc_wander = { params ["_unit",["_centerPos",[]],"_distance","_minWait","_midWait","_maxWait"]; if (_centerPos isEqualTo []) then {_centerPos = getPosATL _unit}; while {alive _unit} do { _unit doMove (_centerPos getPos [random _distance,random 360]); waitUntil {unitReady _unit}; sleep random [_minWait,_midWait,_maxWait]; }; }; _wander = [this,[],25,3,8,15] spawn TAG_fnc_wander Can modify it and should get you started. You can replace the while loop condition with a global variable handled by a trigger, to abort the wandering behavior. Cheers
  7. This is bound to be exploited by players, since uiSleep continues even when the game is paused. Depending on what you do with your addAction (restore health/thirst etc.) this would allow players to consume something, pause the game, freezing the entire simulation including AI etc, still uiSleep continues to run, making the entire duration of the effect meaningless in terms of gameplay. Better use regular sleep there, if that's what you intend to do. Also I wouldn't use sleep within an addAction, even if it's possible, can open a can of worms pretty quickly once your addActions get a bit more complex. You can pass all objects related to the addAction towards your aqua.sqf and handle all sleep and variable related stuff from there on, prevents unnecessary clutter. Cheers
  8. Two commonly used methods, a time based lockout that displays a text based on timeout state: //time based lockout player addAction ["Drink",{ params ["_object","_caller","_ID"]; _timeOut = _object getVariable ["TAG_fnc_timeOut",0]; if (time < _timeOut) exitWith {hint "You drank recently"}; hint "You drink"; _object setVariable ["TAG_fnc_timeOut",time + 10];//only allows drinking every 10s }]; And the second one which hides the action until the timeout is up (10s for both examples). //hide action during timeout player addAction ["Drink",{ params ["_object","_caller","_ID"]; hint "You drink"; _object setVariable ["TAG_fnc_timeOut",time + 10];//only allows drinking every 10s },nil,1.5,true,true,"","_this getVariable ['TAG_fnc_timeOut',0] < time"]; Should get you started. Cheers
  9. I guess the F18 will unfold the wings automatically when the engine is started? What specific mod do you mean? Cheers
  10. Weird, most folks I know (including myself) usually have trouble reading emotions out of plain text, especially if it's from people you haven't personally met before. That's what smilies are for. Cheers
  11. Grumpy Old Man

    Option to Toggle Flag

    init.sqf will run for every player that joins, stuff like that is better kept in event scripts that fit the scope/functionality. All depends on what you want and what gamemode it should be in (SP, local hosted MP, ded. MP), which is usually best stated in the first post. For MP (should also work on dedi with JIP) it could look like this: //initServer.sqf _flagsTankRange1 = [yourFlag1,yourFlag2,yourFlag3]; missionNamespace setVariable ["TAG_fnc_flagsTankRange1",_flagsTankRange1,true]; { [_x,"\A3\Data_F\Flags\Flag_green_CO.paa"] remoteExec ["setFlagTexture",_x]; } forEach TAG_fnc_flagsTankRange1; //initPlayerLocal.sqf { _ID = _x addAction ["Use Tank Range",{ params ["_object","_caller","_ID"]; _state = _object getVariable ["TAG_fnc_flagState",false]; _texts = ["Clear Tank Range","Use Tank Range"]; _textures = ["\A3\Data_F\Flags\Flag_red_CO.paa","\A3\Data_F\Flags\Flag_green_CO.paa"]; { [_x,(_textures select _state)] remoteExec ["setFlagTexture",_x]; _x setUserActionText[_ID,_texts select _state]; _x setVariable ["TAG_fnc_flagState",!_state,true]; } forEach TAG_fnc_flagsTankRange1; },[],1,true,true,"","_target distance2D _this < 3"]; } forEach TAG_fnc_flagsTankRange1; No guarantees though, quickly butchered this one together, should work fine at first glance, heh. Cheers
  12. Grumpy Old Man

    Option to Toggle Flag

    No need to bump stuff in these forums, at least not within a reasonable 48h, it's moving slow but stuff usually doesn't go unanswered. For MP setFlagTexture has global effect, as long as the command is executed where the flag is local, a remoteExec comes in handy for this: _flags = [yourFlag1,yourFlag2,yourFlag3]; { _x setVariable ["TAG_fnc_flags",_flags,true]; _ID = _x addAction ["Use Tank Range",{ params ["_object","_caller","_ID"]; _state = _object getVariable ["TAG_fnc_flagState",false]; _texts = ["Clear Tank Range","Use Tank Range"]; _textures = ["\A3\Data_F\Flags\Flag_red_CO.paa","\A3\Data_F\Flags\Flag_green_CO.paa"]; _flags = _object getVariable ["TAG_fnc_flags",[]]; { [_x,(_textures select _state)] remoteExec ["setFlagTexture",_x]; _x setUserActionText[_ID,_texts select _state]; _x setVariable ["TAG_fnc_flagState",!_state,true]; } forEach _flags; },[],1,true,true,"","_target distance2D _this < 3"]; [_x,"\A3\Data_F\Flags\Flag_green_CO.paa"] remoteExec ["setFlagTexture",_x]; } forEach _flags; Also changes textures and action names accordingly. Cheers
  13. Grumpy Old Man

    Option to Toggle Flag

    Something as simple as this might do: _flag = yourFlag; _flag setFlagTexture "\A3\Data_F\Flags\Flag_green_CO.paa"; _ID = _flag addAction ["Use Tank Range",{ params ["_object","_caller","_ID"]; _state = _object getVariable ["TAG_fnc_flagState",false]; _texts = ["Clear Tank Range","Use Tank Range"]; _textures = ["\A3\Data_F\Flags\Flag_red_CO.paa","\A3\Data_F\Flags\Flag_green_CO.paa"]; _object setFlagTexture (_textures select _state); _object setUserActionText[_ID,_texts select _state]; _object setVariable ["TAG_fnc_flagState",!_state]; },[],1,true,true,"","_target distance2D _this < 3"]; Cheers
  14. Aaaand I crashed arma. Got a bit too carried away, heh. Gonna give it another run on the weekend. Edit: Theoretical maximum might be 83 considering visual bounding box diameter of 9.53448m for the aforementioned truck and no buildings in the way, doubt it's possible to place more than 40, heh. Using a circle packing algorithm that is, most likely more efficient to grab a rectangle packer. Cheers
  15. Grumpy Old Man

    Spawn 700 units

    Maybe he mistook units with credits or similar. Or his usage of units is different, if you fire 6k units per second... hmmmm. Cheers
  16. Grumpy Old Man

    How to find an even handler's code?

    Eventhandlers return an ID, which increases with each EH of the same type that has been added. You can track that, if you don't 0 = everything, heh. Simply put, save the EH ID on the object, then when appropriate add another "test" EH of the same type, if the returned ID is yours +1 remove the "test" EH and your last EH should still be the valid one. Bit wonky but can't think of a better solution, since there's no EH for EH addition/removal, might be handy. Cheers
  17. Might be, not sure though, if a member of a group dies the group doesn't instantly reflect that, depending on line of sight etc, so a groups status will only update once in a while or if they witness a units death directly. Can be sped up using the "report status" radio command when in the same group. Same could be the case for the group leader, if no one saw him die it might take a while until a new one will take command. Would be more reliable to check via object array than using the group, like so: _toCheck = units TAG_grp_someGroup; { _x setVariable ["TAG_arr_toCheck",_toCheck]; _x addEventhandler ["Killed",{ params ["_killed"]; _toCheck = _killed getVariable ["TAG_arr_toCheck",[]]; if (count (_toCheck select {alive _x}) isEqualTo 0) then { hint "Everyone dead!"; } }]; } forEach _toCheck; Cheers
  18. Killed eventhandler on every unit of the group. Cheers
  19. Grumpy Old Man

    'Dammaged' EH stops firing.

    Bracket error in the very first line. Check out some editors that support .sqf syntax highlighting. Cheers
  20. Grumpy Old Man

    [SOLVED] Unit command to land&unload

    Get Out and Eject actions won't show when the vehicle is locked, something like that: H1 setVehicleLock "LOCKED"; Then to force the chopper to land you need to order the groups that you want to disembark to do so, like this: wp setWaypointStatements ["true", "H1 setVehicleLock 'UNLOCKED';units Squad_1 allowGetIn false"]; Cheers
  21. If it's a given that there will always be a certain amount of units that will engage the player I'd just spawn them as regular soldier units in the first place. Cheers
  22. I still have it, but as stated above, it's probably better to rewrite it from scratch than having to rip it out of the framework and trying to get it running, since it relies on quite a few functions from my own library (map evaluation etc.) Cheers
  23. Grumpy Old Man

    waitUntil Bool

    Waituntil requires a boolean at the end. Your example is weird, since you only return a boolean to the waitUntils scope if it's true: waituntil { if (count list _bzc > 1) then {true}}; when you could simply use: waituntil {count list _bzc > 1}; instead. Cheers
  24. Grumpy Old Man

    How to create dead flat bush?

    Might be difficult to achieve, since, if I recall right, bushes and grass will un-flatten over time. For an initial flattening simply spawn an invisible vehicle over the bush, should work as long as it's not a simple object. Cheers
  25. Grumpy Old Man

    Diary Record subheadings

    The vanilla diary doesn't seem to support more layers than you already discovered. For stuff like this it's most likely easier to set up your own dialog that does what you want. Cheers
×