Jump to content

serena

Member
  • Content Count

    335
  • Joined

  • Last visited

  • Medals

Everything posted by serena

  1. serena

    Tying a trigger to a date

    Checking trigger conditions and unscheduled environment in which it is running apparently gives some strong guarantees of timely execution :/ It is a pity that we can not do something like this: setThreadPriority "REALTIME" :) P.S. Another funny moment: when the game performance falls so much that the scripts stop working, the last thing you think about is: "why is the sleeping script that is supposed to launch the spawn of the super-invasion force, fires 5 seconds later?" XDD
  2. serena

    Tying a trigger to a date

    Technically this can happen. The question is, how likely is it practically and how much will the gap be. I regularly use this approach and it always works perfectly. Maybe you're right, and I'll once face such a problem :)
  3. serena

    Tying a trigger to a date

    Ehh, you're right. Trigger condition is checked every 0.5 sec, waitUntil condition is every 0.0166 sec - 60 times per second. :) For task that is solved in this particular case, there is not much difference, the thread will wake up exactly after 100500.000 seconds or after 100500.001 seconds. Right? Why?
  4. serena

    Tying a trigger to a date

    When you do this game will check this condition 60 times each second until condition not satisfied. You can also create thread sleeping until date/time you want: SleepUntilDate = { sleep (60 * 60 * 24 * 365 * (dateToNumber _this - dateToNumber date) / timeMultiplier)}; // Usage: [2035,5,28,13,37] call SleepUntilDate;
  5. serena

    sleep vs uiSleep

    Dialogs defined with enableSimulation = 0 blocks game simulation until closed. If you need your script to continue working in such cases use uiSleep. In other cases sleep is the right choice.
  6. waitUntil {time > 0}; private _tsp = player createSimpleTask ["Parent"]; private _tsc = player createSimpleTask ["Child", _tsp]; player addAction ["Complete Parent Task", { params ["_trg", "_clr", "_aid", "_arg"]; _trg removeAction _aid; _arg setTaskState "Succeeded" }, _tsp]; player addAction ["Complete Child Task", { params ["_trg", "_clr", "_aid", "_arg"]; _trg removeAction _aid; _arg setTaskState "Succeeded" }, _tsc]; Sample mission (VR map, two actions to complete parent and child task) - just tested and works fine
  7. Briefly: use BIS_fnc_taskCreate to create tasks and BIS_fnc_taskSetState to update and everything will work.
  8. Problems can appear when trying to access such function remotely or asynchronously
  9. Variables with names beginning with an underscore are local. Local variables exist only in the scope where they are defined. More information: #Local_Variables
  10. Updated to killzone_kid variant: CivilianKillers = []; if (isServer) then { addMissionEventHandler ["EntityKilled", { params ["_vct", "_klr"]; if (_vct isKindOf "CAManBase" and {side group _vct isEqualTo CIVILIAN}) then { private _dta = CivilianKillers; private _rec = {if (_x select 0 isEqualTo _klr) exitWith {_x}} forEach _dta; if (isNil {_rec}) then {_rec = [_klr, 1]; _dta pushBack _rec} else {_rec set [1, (_rec select 1) + 1]} } }]; }; Sample mission
  11. Sample mission: link (VR map, all code in init.sqf script, use Start Shot Timer action)
  12. // handle unit fired event unit addEventHandler ["Fired", {/*code inside braces executed each time unit fires*/}]; // command pauses executing script for given period in seconds sleep 10; // command generate random number between 0 and given value random 100; https://community.bistudio.com/wiki/addEventHandler https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired https://community.bistudio.com/wiki/sleep https://community.bistudio.com/wiki/random
  13. 30 degrees forward: // 30 degrees forward: -30 call {arrow setVectorDirAndUp [[0, cos _this, sin _this], [0, 0, 1]]}; // 30 degrees back: 30 call {arrow setVectorDirAndUp [[0, cos _this, sin _this], [0, 0, 1]]};
  14. The simpler - the better, I think: // init.sqf CivilianKillers = []; if (isServer) then { { if (side _x == CIVILIAN) then { _x addEventHandler ["Killed", { params ["_vct", "_klr"]; private _dta = CivilianKillers; private _rec = {if (_x select 0 isEqualTo _klr) exitWith {_x}} forEach _dta; if (isNil {_rec}) then {_rec = [_klr, 1]; _dta pushBack _rec} else {_rec set [1, (_rec select 1) + 1]} }] } } foreach allUnits; }; player addAction ["List Civilian Killers", { { _x params ["_unt", "_cnt"]; systemChat format ["%1 killed %2 civilian(s)", _unt, _cnt] } forEach CivilianKillers }]; player addAction ["Count Killed Civilians", { private _cnt = 0; {_cnt = _cnt + (_x select 1)} forEach CivilianKillers; systemChat format ["Civilians killed: %1", _cnt] }]; Sample mission: link
  15. serena

    inputAction

    private _active = {inputAction _x > 0} count ["ReloadMagazine", "Throw", "MiniMap"] > 0; * measurements have shown that the shortest variant is also the fastest
  16. serena

    basic script help

    Try this: // in group leader init field _tmp = (group this) execVM "myscript.sqf"; // in myscript.sqf file { _x setUnitPos "UP"; //_x disableAI "FSM"; // if you uncomment this line then units probably wont move _x disableAI "Cover"; _x disableAi "SUPPRESION"; } forEach units _this; _this setSpeedMode "FUll"; while {{alive _x} count units _this > 0} do { sleep 5; _this setCombatMode "BLUE"; sleep 5; _this setCombatMode "RED"; };
  17. I'll look at you guys when BI officially announces that they are working on a brand new engine for Arma IV with superphysics for attached objects. P.S. About editing. Interior interaction script in my signature allow to move and stack objects. Сan be useful.
  18. serena

    Sleep on module

    Using trigger: // in trigger activation condition time > TIME_SINCE_GAME_BEGIN_IN_SECONDS Using script: [] spawn { sleep TIME_INTERVAL_IN_SECONDS; // do what you want here }; https://community.bistudio.com/wiki/time https://community.bistudio.com/wiki/sleep
  19. Undeceived, why so hopeless? The chance to meet a dinosaur is pretty good, 50/50: either meet or not XD
  20. Undeceived, what is the chance to meet a dinosaur on the street? XD
  21. If you do not know which way to go any direction is correct XD If it's convenient for you and does not worsen performance of the game, then why not?
  22. private _id = player addAction ["Action A3", OnActionA3]; player setUserActionText [_id, "Some Action", "<t color='#ff0000'>Background-----------------</t><br/>Multiline<br/>Multiline<br/>Multiline<br/>. . .", "<t color='#00ff00'>-----------------Foreground</t>"];
  23. Working sample: link (Virtual reality map, all code inside init.sqf) Actions map: A1 -> A2 -> A3 B1 -> B2
  24. 1. Select all groups where side = WEST and distance to marker < 100m private _groups = allGroups select {side _x == WEST and {leader _x distance getMarkerPos "_marker" < 100}}; 2. Delete units and groups: {{deleteVehicle _x} forEach units _x; deleteGroup _x} forEach _groups; 3. All together: {{deleteVehicle _x} forEach units _x; deleteGroup _x} forEach (allGroups select {side _x == WEST and {leader _x distance getMarkerPos "_marker" < 100}}); * code fixed * test mission: link
×