-
Content Count
335 -
Joined
-
Last visited
-
Medals
Everything posted by serena
-
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 };
-
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
-
Determine smallest of multiple marker areas unit is inside of.
serena replied to doc. caliban's topic in ARMA 3 - MISSION EDITING & SCRIPTING
When you walk into area overlapped by three different markers my code returns smallest marker you're in -
Determine smallest of multiple marker areas unit is inside of.
serena replied to doc. caliban's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Not "any", first marker unit in from array of markers ordered from smallest to biggest by area :)) -
Determine smallest of multiple marker areas unit is inside of.
serena replied to doc. caliban's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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; -
Determine smallest of multiple marker areas unit is inside of.
serena replied to doc. caliban's topic in ARMA 3 - MISSION EDITING & SCRIPTING
// 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 -
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?
-
Controlling Pop up Targets and Counting Accuracy
serena replied to McIntire's topic in ARMA 3 - MISSION EDITING & SCRIPTING
// 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? -
Caching a variable for mission restart?
serena replied to Midnighters's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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) -
Caching a variable for mission restart?
serena replied to Midnighters's topic in ARMA 3 - MISSION EDITING & SCRIPTING
// save loadout profileNamespace setVariable ["PlayerLoadout", getUnitLoadout player]; // restore loadout profileNamespace getVariable "PlayerLoadout" call {player setUnitLoadout _this}; // reset loadout profileNamespace setVariable ["PlayerLoadout", nil]; -
Abandoned Vehicle to respawn in time not meters
serena replied to darkxess's topic in ARMA 3 - MISSION EDITING & SCRIPTING
* 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; }; -
Adding waypoint to a scripted vehicle
serena replied to joa666's topic in ARMA 3 - MISSION EDITING & SCRIPTING
// 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. -
How To Make A Custom Player Inverntory
serena replied to thoops99's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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 -
How To Make A Custom Player Inverntory
serena replied to thoops99's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Very simple, just two steps: Create custom inventory dialog Handle player gear opening event, where replace default dialog with your own -
Working on an 'open world' insurgent mission
serena replied to owmyeye's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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... -
// 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"]
-
What is a foolproof way to drop all inventory from a player in a backpack ?
serena replied to celludriel's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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; }; -
What is a foolproof way to drop all inventory from a player in a backpack ?
serena replied to celludriel's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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? -
What is a foolproof way to drop all inventory from a player in a backpack ?
serena replied to celludriel's topic in ARMA 3 - MISSION EDITING & SCRIPTING
https://community.bistudio.com/wiki/BIS_fnc_baseWeapon -
Base Protection Script help!
serena replied to darkxess's topic in ARMA 3 - MISSION EDITING & SCRIPTING
darkxess, what is the prize to those who supposed to guess weapons from that "unstoppable" 30% ? -
Try define variable: nopop = true Then, to popup target manually: _target animate["terc", 0] To get all mission targets: AllMissionObjects "TargetBase"
-
I absolutely agree with killzone_kid. The right choice of variable name - the main key to success! XD
-
Also interesting information about initialization order and executing environment: Initialization_Order
-
End trigger messed up by loose infantry
serena replied to pooroldspike's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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 -
[Release] Keyhandler with modificators
serena replied to MasterPuffin's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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; }];- 10 replies
-
- 1
-
- scripting
- keyhandler
-
(and 1 more)
Tagged with: