Jump to content

serena

Member
  • Content Count

    335
  • Joined

  • Last visited

  • Medals

Everything posted by serena

  1. serena

    beginer scripting help

    Based on Grumpy Old Man variant: waitUntil {time > 0}; private _target = BOB; private _runner = jim; private _begger = greg; while {true} do { if (!alive _target) exitWith { hint "bob is dead"; _runner globalchat "bob is dead good job"; _runner doMove (position player); sleep 3; hint "jim is a traitor"; }; if (!alive _runner) exitWith { hint "jim is dead"; sleep 3; _begger globalchat "please have mercy"; }; if (!alive _begger) exitWith { _begger globalchat "Nooooooooo"; hint "good job"; }; sleep 1; // important pause };
  2. serena

    beginer scripting help

    I see two problems: Code of your script can executing before BOB, jim and greg variables gets initialized. In most cases you need for delay at begin of init.sqf Your code executes once, while you need to check for conditions continously all the time (as GrumpyOldMan already found above) //delay in init.sqf waitUntil {time > 0}; // other code here
  3. When you walk into area overlapped by three different markers my code returns smallest marker you're in
  4. Not "any", first marker unit in from array of markers ordered from smallest to biggest by area :))
  5. Yes, you're right. Code above will return the first marker unit is in, from markers array ordered by marker area, and this is exactly what he needs. // return marker name or empty string if unit outside of any marker SmallestMarkerUnitIsIn = { {if (_this inArea _x) exitWith {_x}; ""} forEach allMapMarkersOrderedByArea}; // Usage: private _marker = player call SmallestMarkerUnitIsIn;
  6. // in init.sqf waitUntil {time > 0}; player linkItem "ItemGPS"; sleep 0.75; hintC "Open your GPS"; // marker area function MarkerArea = { switch (markerShape _this) do { case "RECTANGLE": {getMarkerSize _this params ["_msw", "_msh"]; _msw * _msh}; case "ELLIPSE": {getMarkerSize _this params ["_msw", "_msh"]; _msw * _msh * 0.25 * pi}; default {0} } }; // create list of all markers ordered by area allMapMarkersOrderedByArea = [allMapMarkers,[],{_x call MarkerArea},"ASCEND"] call BIS_fnc_sortBy; // poll smallest marker with player and log in system chat while {true} do { private _smallestMarker = {if (player inArea _x) exitWith {_x}; ""} forEach allMapMarkersOrderedByArea; systemChat ("Player inside marker: " + _smallestMarker); sleep 1; }; Demo mission: link
  7. serena

    beginer scripting help

    We have to guess the answers to these questions? Where do you put this code? How do you run this code? Which errors occur during execution?
  8. // disabe automatic target popup globally nopop = true; // popup target manualy (0 - up, 1 - down) _target animate["terc", 0]; // check target popup state (0 - up, 1 - down) private _state = _target animationPhase "Terc"; // target individual settings [DEV. VERSION ONLY!] _target setVariable ["nopop", true]; _target setVariable ["popDelay", 10]; // handle target hit event _target addEventHandler ["Hit", { systemChat format ["Target %1 hit by unit %2", _this select 0, _this select 1]}]; Did we not have the same thread just recently?
  9. Are you sure that: Your gear have been saved before you disconnect (commands are executed properly and profile namespace contains saved data) Saved data extracted and applied when you resume mission (commands are executed properly and profile namespace contains saved data)
  10. // save loadout profileNamespace setVariable ["PlayerLoadout", getUnitLoadout player]; // restore loadout profileNamespace getVariable "PlayerLoadout" call {player setUnitLoadout _this}; // reset loadout profileNamespace setVariable ["PlayerLoadout", nil];
  11. * it is not working code but only the concept while {true} do { sleep 1; { private _time = _vehicle getVariable "AbandonedAt"; if (VEHICLE_ABANDONED_CONDITION) then { if (isNil "_time") then {_vehicle setVariable ["AbandonedAt", time]} else { if (time - _time > ABANDONED_VHICLE_RESPAWN_DELAY) then { _vehicle setVariable ["AbandonedAt", nil]; // -------------------------- // put your respawn code here // -------------------------- } } } else { if (not isNil "_time") then { _vehicle setVariable ["AbandonedAt", nil]} } } forEach allMyVehicles; };
  12. // init.sqf waitUntil {time > 0}; player addAction ["Spawn BMP", { private _veh = createVehicle ["O_APC_Wheeled_02_rcws_F",getMarkerPos "X1",[],0,"NONE"]; createVehicleCrew _veh; private _grp = group commander _veh; private _wpp = _grp addWaypoint [getMarkerPos "X1a", 0]; _wpp setWaypointType "MOVE"; _wpp setWaypointSpeed "LIMITED"; _wpp setWaypointBehaviour "SAFE"; }]; Sample mission: Link BIS_fnc_initVehicleCrew seems broken in my client.
  13. https://community.bistudio.com/wiki/User_Interface_Editor_(Arma_3) https://community.bistudio.com/wiki/Dialog_Control https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control https://community.bistudio.com/wiki/User_Interface_Event_Handlers
  14. Very simple, just two steps: Create custom inventory dialog Handle player gear opening event, where replace default dialog with your own
  15. When you look inside Ravage or any other true dynamic scenario, you find mission file absolutely empty - only player unit and number of markers / modules. Using mission editor waypoints and triggers you can create simple scenarios. To create a dynamic sandbox scenarios, there is only one way: scripting, scripting, scripting...
  16. // So private _multiarray = ["A", "B", "C"] apply {private _pre = _x; [1, 2, 3] apply {_pre + "_" + str _x}}; // Or private _multiarray = ["A", "B", "C"] apply {private _pre = _x; [1, 2, 3] apply {format ["%1_%2", _pre, _x]}}; // Result: // [["A_1","A_2","A_3"],["B_1","B_2","B_3"],["C_1","C_2","C_3"]] // Selecting private _chosen = _multiarray apply {selectRandom _x}; // Result: // ["A_3","B_1","C_2"]
  17. BIS_fnc_baseWeapon = { private _class = _this param [0,"",[""]]; private _cfg = configFile >> "cfgWeapons" >> _class; if !(isClass _cfg) exitWith { if (_class != "") then {["Class '%1' not found in CfgWeapons", _class] call BIS_fnc_error}; _class }; private _base = getText (_cfg >> "baseWeapon"); if (isClass (configFile >> "cfgWeapons" >> _base)) exitWith {_base}; private _return = _class; { if (count (_x >> "linkeditems") == 0) exitwith {_return = configname _x;}; } foreach (_cfg call BIS_fnc_returnParents); _return; };
  18. systemChat ("arifle_MX_khk_F" call Bis_fnc_BaseWeapon); systemChat ("arifle_SPAR_01_GL_blk_F" call Bis_fnc_BaseWeapon); // Output: // arifle_MX_khk_F // arifle_SPAR_01_GL_blk_F My function is working properly. Did I do something wrong?
  19. https://community.bistudio.com/wiki/BIS_fnc_baseWeapon
  20. darkxess, what is the prize to those who supposed to guess weapons from that "unstoppable" 30% ?
  21. serena

    CQB Training

    Try define variable: nopop = true Then, to popup target manually: _target animate["terc", 0] To get all mission targets: AllMissionObjects "TargetBase"
  22. serena

    while loop

    I absolutely agree with killzone_kid. The right choice of variable name - the main key to success! XD
  23. serena

    while loop

    Also interesting information about initialization order and executing environment: Initialization_Order
  24. In end game trigger activation condition: {alive _x and {side _x == EAST}} count entities "Tank" < 1 * side and number of alive entities you can replace as you want
  25. KeyFunctions = [//dik //shift //ctrl //alt [[23, true, false, false], "YOURSCRIPT1"], // I + Shift [[23, false, true, false], "YOURSCRIPT2"], // I + Ctrl [[22, false, false, false], "YOURSCRIPT3"]];// U while {isNull(findDisplay 46)} do {sleep 0}; (findDisplay 46) displayAddEventHandler ["KeyDown", { private _kpd = _this select [1, 4]; {_x params ["_key", "_scr"]; if (_key isEqualTo _kpd) exitWith {execVM _scr; true}; false; } forEach KeyFunctions; }];
×