Jump to content

serena

Member
  • Content Count

    335
  • Joined

  • Last visited

  • Medals

Everything posted by serena

  1. 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 _key = _this select [1, 4]; private _scr = {if (_x select 0 isEqualTo _key) exitWith {_x select 1}} forEach KeyFunctions; if (isNil {_scr}) then {false} else {execVM _scr; true} }];
  2. while {isNull(findDisplay 46)} do {sleep 0}; (findDisplay 46) displaySetEventHandler ["KeyDown","call OnKeyDown"]; 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 OnKeyDown = { private _key = _this select [1, 4]; private _scr = {if (_x select 0 isEqualTo _key) exitWith {_x select 1}} forEach KeyFunctions; if (isNil {_scr}) then {false} else {execVM _scr; true} };
  3. To do it manually you can look at allDeadMen and hideBody commands
  4. https://community.bistudio.com/wiki/Description.ext#corpseManagerMode
  5. serena

    while loop

    I can say only one thing: init.sqf is executed in scheduled environment. Nothing else. :)
  6. One small elaboration: (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfAssault")
  7. As described here: BIS_fnc_spawnGroup , third argument can be (character details - Can be three different types): a list of character types (Array), an amount of characters to spawn (Number) or a CfgGroups entry (Config) So, configfile >> "CfgGroups" >> "West" >> "BLU_F" >> something lost from here >> "BUS_InfAssault" is legal argument, and your code will work fine with this syntax
  8. serena

    while loop

    @killzone_kid, Grumpy Old Man says: As example in the init.sqf: // init.sqf (it is important!) SchedulerTest = {systemchat format ["CanSuspend: %1",canSuspend]}; _nonscheduled = [] call SchedulerTest; //false _scheduled = [] spawn SchedulerTest; //true _scheduled = [] spawn {_totallyscheduled = [] call SchedulerTest}; //true // Output: // CanSuspend: true // CanSuspend: true // CanSuspend: true I did something wrong?
  9. @JoeyCare, forEach instruction iterates over elements of array and, for each element executes your commands inside curly braces with element value in _x variable // This code {SayHello _x} forEach ["PrivateRyan", "CaptainMiller", "JoeyCare"]; // Equals to: // step 1: _x = "PrivateRyan"; SayHello _x; // step 2: _x = "CaptainMiller"; SayHello _x; // step 3: _x = "JoeyCare"; SayHello _x; // step 4: end
  10. @dreadpirate _grp = [_spawnpos, EAST, (configfile >> ""CfgGroups"" >> ""East"" >> ""OPF_F"" >> ""infantry"" >> ""OIA_InfTeam""),[],[],[0.25,0.4]] call BIS_fnc_spawnGroup; Arma3_2017-02-26_22-38-34.rpt 23:10:05 Error in expression < [getpos player, EAST, (configfile >> ""CfgGroups"" >> ""East"" >> ""OPF_F"" >> > 23:10:05 Error position: <CfgGroups"" >> ""East"" >> ""OPF_F"" >> > 23:10:05 Error Missing ) 23:10:05 Error in expression < [getpos player, EAST, (configfile >> ""CfgGroups"" >> ""East"" >> ""OPF_F"" >> > 23:10:05 Error position: <CfgGroups"" >> ""East"" >> ""OPF_F"" >> > 23:10:05 Error Missing )
  11. It is because _x variable you trying to use is not initialized.
  12. serena

    while loop

    @BlacKnightBK, your question can be simplified to: what the difference between the scheduled and non-scheduled environments. In scheduled environment you can execute continuously running scripts, use sleep / waitUntil commands, and scheduler take care of your script is working in parallel with other and each fairly received his portion of CPU performance. In non-scheduled environment executing script can not be interrupted or put to sleep. Continuously running script just freeze your game and cause an error. So, scripts executing in non-scheduled environment should be short and quick. @Grumpy Old Man, init.sqf executed in scheduled environment. So, all three calls return "Can Suspend: True"
  13. Tankbuster, you're right. Individual unit rotating is ambigous in most cases. Just tested this code, all works fine: // init.sqf player addAction ["Spawn Team", { mygroup = [player modelToWorld [0,25,0], WEST, 5] call BIS_fnc_spawnGroup; player removeAction (_this select 2); player addAction ["Set Formation North", {mygroup setFormDir 0}]; player addAction ["Set Formation East", {mygroup setFormDir 90}]; player addAction ["Set Formation South", {mygroup setFormDir 180}]; player addAction ["Set Formation West", {mygroup setFormDir 270}]; }]; Sample mission: link
  14. // fixed last line {_x setDir 45} forEach (units _group);
  15. Nice error reporting. You just need to replace three dots with actual arguments from here and then everything will work fine :)
  16. PheNux Cam, first line of code in my sample is abstract, it is introduced only to show how to "_group" variable initialized. private _group = [...] call BIS_fnc_spawnGroup; // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abstract part, replace with your own code
  17. Something like: // spawn group (abstract line, replace with your own) private _group = [...] call BIS_fnc_spawnGroup; // order group to face 45' _group setFormDir 45; // rotate each unit of group {_x setDir 45} forEach (units _group); * fixed
  18. This command is applicable to unit/group only, but you trying to apply it to coordinate array. Why you never read description of the commands before using them?
  19. EquipUnitWithCustomWeapons = { params ["_unit", "_weapons"]; { private _weapon = nil; { if (_forEachIndex > 0) then {_unit addWeaponItem [_weapon, _x]} else {_weapon = _x; _unit addWeaponGlobal _weapon} } forEach _x } forEach _weapons }; // Add custom pistol and rifle [player, [ ["arifle_MX_GL_F", "muzzle_snds_H","acc_pointer_IR","optic_Arco",["30Rnd_65x39_caseless_mag"],["1Rnd_HE_Grenade_shell"]], ["hgun_Pistol_heavy_01_F","muzzle_snds_acp","optic_MRD",["11Rnd_45ACP_Mag",11]]]] call EquipUnitWithCustomWeapons;
  20. Two array allocations, array comparsion and copy operations in one line: _wep_items = _x - [_gun]
  21. This simple function equip unit with custom fitted weapon, loaded with specified magazines with default or custom ammo count: EquipUnitWithCustomWeapon = { params ["_unit", "_weapon", "_parts"]; _unit addWeaponGlobal _weapon; { _unit addWeaponItem [_weapon, _x] } forEach _parts; }; // Usage: [player, "arifle_MX_GL_F", ["muzzle_snds_H","acc_pointer_IR","optic_Arco",["30Rnd_65x39_caseless_mag",30],["1Rnd_HE_Grenade_shell",1]]] call EquipUnitWithCustomWeapon; * count of ammo in magazine - optional
  22. //_namesound = gettext(configfile >> "CfgWeapons" >> _gun >> "nameSound"); //if ((_namesound == "rifle") or (_namesound == "mgun")) then {_type = "r"}; //if ((_namesound == "aalauncher") or (_namesound == "atlauncher")) then {_type = "s"}; //if (_namesound == "Pistol") then {_type = "h"}; GetWeaponType = { //-1 - unknown, 0 - primary, 1 - handgun, 2 - secondary, 3 - binocular [1, 2, 4, 4096] find getNumber (configFile >> "CfgWeapons" >> _this >> "Type") }; // Usage: private _weaponType = "MySuperHeavyMachineGun" call GetWeaponType; //if ((_myitem != "") && (_type == "r")) then {_myunit addPrimaryWeaponItem _myitem}; //if ((_myitem != "") && (_type == "s")) then {_myunit addSecondaryWeaponItem _myitem}; //if ((_myitem != "") && (_type == "h")) then {_myunit addHandgunItem _myitem}; unit addWeaponItem [weaponName, itemName] unit addWeaponItem [weaponName, [itemName, ammoCount, muzzleName]]
  23. Tricky way: create dummy unit (invisible / no simulation) -> add weapon with attachments -> put weapon to the box -> delete unit
  24. serena

    Problem with Random Select

    Not necessary replace, you can also extend: // 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"]]; private _itd = [ "ItemCompass", "ToolKit", "Binocular"]; { if (local _x and {not isNil {_x getVariable _vrn}}) then { selectRandom _wpd params ["_wpn", "_amm"]; _x addWeaponCargoGlobal [_wpn, 1]; _x addMagazineCargoGlobal [_amm, 5]; _x addItemCargoGlobal [selectRandom _itd, 1]; _x setVariable [_vrn, nil, true] } } forEach entities "" }; * code fixed
×