Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////
- /// INSTANT LOADING
- /// Version: 4
- /// Author: Morten a.k.a. MulleDK19 ©
- /////
- /// This is a workaround for a bug causing the entire game world to be reloaded if certain blufor weapons are used.
- /////
- /////
- /// Usage:
- /// The script takes one optional parameter, which is whether to black out while it performs its job. The parameter defaults to true. Use one of the following:
- /// execVM "instant_loading.sqf";
- /// true execVM "instant_loading.sqf";
- /// false execVM "instant_loading.sqf";
- /////
- private ["_blackOut", "_weapon", "_weaponItems", "_getUnitInfo", "_unitInfo", "_unit"];
- if (!isNil "_this") then
- {
- _blackOut = _this;
- };
- if (isNil "_blackOut") then
- {
- _blackOut = true;
- };
- if (_blackOut) then
- {
- titleText ["", "BLACK FADED"];
- };
- if (isServer || !isMultiplayer) then
- {
- _unitInfos = [];
- {
- if (side _x == blufor) then
- {
- _unit = _x;
- _weapon = primaryWeapon _unit;
- _weaponItems = primaryWeaponItems _unit;
- _unit removeWeapon _weapon;
- _unitInfos = _unitInfos + [[_x, _weapon, _weaponItems]];
- };
- } forEach allUnits;
- IL_UnitInfos = _unitInfos;
- if (isMultiplayer) then
- {
- publicVariable "IL_UnitInfos";
- };
- }
- else
- {
- {
- _unit = _x;
- if (side _x == blufor) then
- {
- _x removeWeapon primaryWeapon _x;
- };
- } forEach allUnits;
- };
- waitUntil { !isNil "IL_UnitInfos" };
- sleep (if (isMultiplayer) then { 3 } else { 0.5 });
- IL_fnc_getUnitInfo =
- {
- private ["_unit", "_unitInfo"];
- _unit = _this;
- {
- scopeName "loop1";
- if (_x select 0 == _unit) then
- {
- _unitInfo = _x;
- breakOut "loop1";
- };
- } forEach IL_UnitInfos;
- _unitInfo;
- };
- {
- if (side _x == blufor) then
- {
- _unit = _x;
- _unitInfo = _unit call IL_fnc_getUnitInfo;
- _weapon = _unitInfo select 1;
- _weaponItems = _unitInfo select 2;
- _unit addWeapon _weapon;
- _unit selectWeapon _weapon;
- {
- if (_x != "") then
- {
- _unit addPrimaryWeaponItem _x;
- };
- } forEach _weaponItems;
- reload _unit;
- };
- } forEach allUnits;
- IL_UnitInfos = nil;
- if (!isMultiplayer) then
- {
- setAccTime 8;
- sleep 5;
- setAccTime 1;
- }
- else
- {
- sleep 5;
- };
- if (_blackOut) then
- {
- titleText ["", "BLACK IN"];
- };
- /// INSTANT LOADING
- //////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement