-
Content Count
335 -
Joined
-
Last visited
-
Medals
Everything posted by serena
-
Problem with Random Select
serena replied to FireStormHD's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Sorry, my fault. It is because calling code executes before target function get initialized. This code fixes problem: // in init.sqf if (true) then { private _vrn = "AddWeaponWithAmmo"; private _wpd = [ ["hlc_rifle_RU556", "hlc_30rnd_556x45_EPR"], ["hlc_rifle_G36E1", "hlc_30rnd_556x45_EPR_G36"], ["hlc_rifle_awcovert_BL", "hlc_5rnd_300WM_FMJ_AWM"]]; { if (local _x and {not isNil {_x getVariable _vrn}}) then { selectRandom _wpd params ["_wpn", "_amm"]; _x addWeaponCargoGlobal [_wpn, 1]; _x addMagazineCargoGlobal [_amm, 5]; _x setVariable [_vrn, nil, true] } } forEach entities "" }; // in cargo box init field this setVariable ["AddWeaponWithAmmo", true] * code tested, all works as expected -
Problem with Random Select
serena replied to FireStormHD's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Based on killzone_kid code: // in init.sqf AddRandomWeaponWithAmmo = { if (local _this) then { if (isNil {WeaponsTable395867}) then { WeaponsTable395867 = [ ["hlc_rifle_RU556", "hlc_30rnd_556x45_EPR"], ["hlc_rifle_G36E1", "hlc_30rnd_556x45_EPR_G36"], ["hlc_rifle_awcovert_BL", "hlc_5rnd_300WM_FMJ_AWM"]]}; (selectRandom WeaponsTable395867) params ["_weapon", "_ammo"]; _this addWeaponCargoGlobal [_weapon, 1]; _this addMagazineCargoGlobal [_ammo, 5]; }; }; // in cargo box init field this call AddRandomWeaponWithAmmo; * error fixed -
Problem with Random Select
serena replied to FireStormHD's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Look at the selectRandom command: private _randomElement = selectRandom ["A", "B", "C"]; -
player addAction ["Jump Forward 1km", {player setPos (player getPos [1000, getDir player])}];
-
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You're right, it somehow works, and thank heavens for that. Not our job to understand the varieties of sturgeon freshness (C) -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
For me it is there all terrible like a death, does not matter formatted or not. Anyway, it is clear from the code: updating state of parent task entails cyclic update task state of each children. And no magic behind :) -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
copyToClipboard str BIS_fnc_taskCreate // then BIS_fnc_taskSetState, BIS_fnc_setTask, BIS_fnc_setTaskLocal, BIS_fnc_taskVar -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is how to BIS_fnc_SetTaskState updates children state: // ... { // ... { [_x,nil,nil,nil,_state,nil,false] call bis_fnc_setTask; }; } foreach _children; -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
It is original formatting: But problem is not in bad format. Problem is whole API include all BIS_fnc_TaskXXX functions is just a trash :) -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Guys, what you think about this code: _prevData = []; for "_index" from 0 to 11 do { _prevData pushBack ( (if ((missionNamespace getVariable [format["%1.%2",_taskVar,_index], ["","",[],[],[objNull,false],-1,"","","","CREATED","Default",false] select _index]) isEqualType []) then {+(missionNamespace getVariable [format["%1.%2",_taskVar,_index], ["","",[],[],[objNull,false],-1,"","","","CREATED","Default",false] select _index])} else {(missionNamespace getVariable [format["%1.%2",_taskVar,_index], ["","",[],[],[objNull,false],-1,"","","","CREATED","Default",false] select _index])}));}; And do you want to know where this code from? -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Because at the moment it is the game behavior. It makes sense to create a ticket to correct this behavior in the next patch. -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you, Larrow. I need to be corrected in previous post: the only reason to use isEqualTo, when comparing numbers, is slightly better performance. It is important :) -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The only reason to use isEqualTo (* in case we comparing numbers) - slightly better performance. Test results: Code Cycles Time 0 == 0 10000 0.0018 ms 0 == 1 10000 0.0019 ms 0 isEqualTo 0 10000 0.0014 ms 0 isEqualTo 1 10000 0.0015 ms -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Where I can read about different behavior between isEqualTo and == in multiplayer, or it is just a rumors? -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
To be very clear, I just want to indicate the fact that this statement is not true: "it doesn't work because you forgot semicolons and a few other things". And this is not true too: "You also need to use isEqualTo instead of ==". And the fact that this code works. It is quite another matter if someone likes a semicolon everywhere where it can be put - this is a matter of taste. But tastes differ :) -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Just created mission with two markers, named: rand_ally1 and rand_ally2. Then in debug console: {if (_x find "rand_ally" == 0) then {_x setMarkerAlpha 0}} forEach allMapMarkers; // markers disappeared {if (_x find "rand_ally" == 0) then {_x setMarkerAlpha 1}} forEach allMapMarkers; // markers visible again What's wrong? UPD: Experimented with tasks. Making parent task "succeeded" manually does not change states of child tasks. -
scripted child tasks do not end with parent
serena replied to stuguy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Lou_Montana note from biki page says: Succeeding parent task will automatically succeed childs, whatever their taskState was set to. (I.E. If a task is set as a child to another, it will be completed when its parent is complete.. no matter if the child task really was or not) If nothing helps, as temporary workaround, you can create trigger with activation statement: taskState "Find Michael Connors" == "Succeeded", where manually finalize child tasks. Also, // Try replace // "rand_ally1" setMarkerAlpha 1; // "rand_ally2" setMarkerAlpha 1; // ... // "rand_allyN" setMarkerAlpha 1; // With: {if (_x find "rand_ally" == 0) then {_x setMarkerAlpha 1}} forEach allMapMarkers; -
waitUntil not working with multiple conditions
serena replied to BlacKnightBK's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Sorry guys, I could not resist XD -
waitUntil not working with multiple conditions
serena replied to BlacKnightBK's topic in ARMA 3 - MISSION EDITING & SCRIPTING
In our case throw is a right choice, because we do not want to repair something. We need to instantly kill broken script, before it can damage something else, and inform user about error. Right. Script corrected to reflect this. -
waitUntil not working with multiple conditions
serena replied to BlacKnightBK's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Since we can not expect that someone will use try/catch in entry points, it is better simply to remove throw command. Updated: code in init.sqf: ABC = 2; XYZ = switch (ABC) do { case 1: {"Hello"}; case 2: {"World"}; default {throw "Error!!!"}; }; // Result: XYZ = "World", no errors ABC = 3; XYZ = switch (ABC) do { case 1: {"Hello"}; case 2: {"World"}; default {throw "Error!!!"}; }; //Result: XYZ = nil, script terminated with error message: 16:46:02 Error Unhandled exception: "Error!!!" And this is what we need - script termination with a clear error message. -
waitUntil not working with multiple conditions
serena replied to BlacKnightBK's topic in ARMA 3 - MISSION EDITING & SCRIPTING
How to replace copy-paste with primitive logic and make your code shorter: SpawnGroupAndBoardVehicle = { params ["_vehicle", "_location", "_side", "_unitTypes", "_unitSeats"]; private _group = createGroup _side; { private _class = switch (_x) do { case "SQUADLEADER": {"O_Soldier_TL_F"}; case "RIFLEMAN": {"O_Soldier_F"}; case "ENGINEER": {"O_engineer_F"}; case "MEDIC": {"O_medic_F"}; default {throw (format ["Unknown unit type: %1", _x])}; }; [_group, _class, _location, _x] call YI_fnc_spawnAiUnit; } forEach _unitTypes; { private _seat = _unitSeats param [_forEachIndex, "CARGO"]; switch (_seat) do { case "DRIVER": {_x moveinDriver _vehicle}; case "GUNNER": {_x moveinGunner _vehicle}; case "COMMANDER": {_x moveinCommander _vehicle}; case "CARGO": {_x moveinCargo _vehicle}; default {throw (format ["Unknown unit seat: %1", _seat])}; } } forEach (units _group); _group; }; //==============Tigris private _tigSquad = [_tigris, _spawnLoc, EAST, ["SQUADLEADER","RIFLEMAN","ENGINEER"], ["COMMANDER", "GUNNER", "DRIVER"]] call SpawnGroupAndBoardVehicle; //==============Marid private _mSquad = [_marid, _spawnLoc, EAST, ["SQUADLEADER", "MEDIC", "ENGINEER","RIFLEMAN","RIFLEMAN","RIFLEMAN","RIFLEMAN","RIFLEMAN","RIFLEMAN","RIFLEMAN","RIFLEMAN"], ["COMMANDER", "CARGO", "CARGO", "GUNNER", "DRIVER"]] call SpawnGroupAndBoardVehicle; * code is not debugged * fixed switch default behavior, thanks killzone_kid -
Basic Arty Script (work in progress)
serena replied to reggaeman007jah's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If you're going to abuse copy-paste - hair grow on your palms XD private _origin = [05115, 04940]; private _count = 0; while {_count < 10} do { private _bomb = _ord createVehicle (_origin getPos [_count * 10.0, _azimuth]); _count = _count + 1; sleep _gap; }; -
You can use this as starting point: // Parameters: Position, Scale, Enabled, Text CreateDisplayControl = { params ["_pos", "_scl", "_enb", "_txt"]; disableSerialization; private _ctl = (findDisplay 46) ctrlCreate ["RscStructuredText", -1]; //_ctl ctrlAddEventHandler ["MouseButtonDown", Fn_Mnu_OnClickItem]; _ctl ctrlSetStructuredText (parseText format [ "<img align='center' size='%2' color='%1' image='%3'/><br/><t align='center' size='%2' color='%1' shadow='2' shadowColor='#0000ff' shadowOffset='0.06'>%4</t>", ["#66ffffff", "#ffffffff"] select _enb, 1, "Libs\Menu\dot.paa", _txt]); _ctl ctrlSetPosition _pos; _ctl ctrlSetScale _scl; _ctl ctrlEnable _enb; _ctl ctrlCommit 0; _ctl }; // Usage: // private _control = [[0.4, 0.5, 0.2, 0.15], 1.0, true, "Hello, World!"] call CreateDisplayControl;
-
Variable is String Expected Array
serena replied to Theassassinzz's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Who not just: tz_util_isAdmin = { (getPlayerUID player) in uidListA}; Or, even: private _playerIsAdmin = (getPlayerUID player) in uidListA; -
Class names in activation conditions.
serena replied to Ivanoff.N's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Copy-paste from https://community.bistudio.com/wiki/typeOf if (typeOf vehicle player == "B_Heli_Light_01_armed_F") then {hint "Player is in AH-9 Pawnee"};- 5 replies
-
- classname
- specific vehicle
-
(and 1 more)
Tagged with: