Jump to content

zealot111

Member
  • Content Count

    64
  • Joined

  • Last visited

  • Medals

Everything posted by zealot111

  1. zealot111

    Realistic repair script

    Hitpoints list of the helicopter: ["HitFuel","HitHull","HitEngine","HitAvionics","HitVRotor","HitHRotor","HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitGlass7","HitGlass8","HitGlass9","HitGlass10","HitMissiles","HitRGlass","HitLGlass"] But note, that you can just replace: [_veh,"zlt_fnc_partrepair", _veh] call bis_fnc_MP; call in the zlt_prc_repairvehicle function by the next code [_veh,"zlt_fnc_fullrepair", _veh] call bis_fnc_MP; And the zlt_fnc_vehicledamaged = { private ["_veh","_vehtype","_flag"]; _veh = [_this, 0] call BIS_fnc_param; if (isNil {_veh}) exitWith {false}; _vehtype = typeOf _veh; _flag = false; { _cdmg = _veh getHitPointDamage (_x); if (not isNil {_cdmg} ) then { if (_cdmg > 0.64) exitWith {_flag = true}; }; } forEach zlt_repair_hps; _flag; }; function by the next code: zlt_fnc_vehicledamaged = { private ["_veh","_vehtype","_flag"]; _veh = [_this, 0] call BIS_fnc_param; if (isNil {_veh}) exitWith {false}; _flag = (damage _veh > 0); _flag; }; Then your Field Repair will completely repair each repaired vehicle, even helicopter. Or you may just edit, then field repair will partly fix the helicopter: zlt_repair_hps = ["HitLFWheel","HitLBWheel","HitLMWheel","HitLF2Wheel","HitRFWheel","HitRBWheel","HitRMWheel","HitRF2Wheel" ,"HitEngine", "HitLTrack","HitRTrack"] + ["HitFuel","HitAvionics","HitVRotor","HitHRotor"]; zlt_hardRepairParts = ["HitEngine", "HitLTrack","HitRTrack"] + ["HitFuel","HitAvionics","HitHRotor"]; ---------- Post added at 12:09 ---------- Previous post was at 10:32 ---------- Thanks! 1. Regarding curving neck of the soldier - now there is a bug in the arma 3, while playing some animations units can distort their sceletons. I beleive BIS will fix this someday, anyway I cant do anything with this bug. 2. Healing animations looks very abstract I beleive it fits also for repair script like this. Arma 3 has special ambient repair animation, but I cannot use it in my script because it just doesnt start when I call "switchmove 'anim_name'", maybe it just not intended for player unit. 3. Im going to update script. In the next version time for field repair will depend on vehicle damage level. (Repair trucks will use 3 min. anyway)
  2. zealot111

    Realistic repair script

    Step by step guide: 1. Enter into MP mission editor throught Play->Multiplayer->Host new session-> <<New - Editor >> from Main menu of the game. 2. Place units which you wants 3. Click "Save" button and remember your mission name 4. Look into system folder C:\Users\[Your system user name]\Documents\Arma 3 - Other Profiles\[Your Arma3 profile name]\MPMissions\[Your mission name from p. 3].Stratis (or Altis) (Or Documents\Arma 3 - Other Profiles\[Your Arma3 profile name]\MPMissions\[Your mission name from p. 3].Stratis (or Altis) ) For example for me its: C:\Users\Zealot\Documents\Arma 3 - Other Profiles\[sTELS]Zealot\MPMissions\sdfd.Stratis where sdfd - mission name. This is the folder where all scripts and other mission regarding stuff should be placed. 5. Copy zlt_fieldrepair.sqf into that folder. 6. You should create init.sqf file manually by notepad or other editor, I suggest Notepad++ ( 'init.sqf' - This is "magic" name for script file which will be executed each time on mission start ) 7. Put [] execVM "zlt_fieldrepair.sqf"; string into that file. This code just runs the file with repair script. 8. When you will run your mission in editor or pack mission and run on the server script will be running and working. I have prepared sample mission: http://stels-arma.ucoz.ru/sample.Stratis.zip Just unpack file into beforementioned MPMissions folder.
  3. zealot111

    Realistic repair script

    I have updated the script. You dont need any complicated ways to handle vehicles created by scripts. It works now just "out of the box". Just use '[true] execVM "zlt_fieldrepair.sqf";' from init.sqf if you use repair vehicles created by scripts. If you dont use repair trucks created by scripts just use '[] execVM "zlt_fieldrepair.sqf";'
  4. zealot111

    Realistic repair script

    Updated first thread post with latest version of the script.
  5. zealot111

    Realistic repair script

    Slightly fixed, as it seems that code didnt works in previous variant if (isServer) then { while {true} do { sleep 15.6; { if not (_x getVariable["ZLT_REPAIR1",false]) then { _x setVariable["ZLT_REPAIR1",true] ;[_x] call compile preprocessFileLineNumbers "zlt_fieldrepair.sqf"; };} foreach vehicles; };};
  6. zealot111

    Realistic repair script

    This scripts adds repair action to the all vehicles using addAction command. For all created by the script vehicles you should manually call [_vehicle] call zlt_fnc_addRepairActions; _vehicle is variable with your created by the script vehicle. Or you may just insert this code in your init.sqf which automatically will do this, but sometimes (on heavy loaded MP server) it is not advised...: if (isServer) then { while {true} do { sleep 15.6; { if not (_x getVariable["ZLT_REPAIR1",false]) then { _x setVariable["ZLT_REPAIR1",true] ;[_x] call compile preprocessFileLineNumbers "zlt_fieldrepair.sqf"; };} foreach vehicles; };}; Note, that you should not add [] execVM "zlt_fieldrepair.sqf"; to your init.sqf when using this way.
  7. zealot111

    Realistic repair script

    New version. Fixed minor bugs and added support for repair tracks. Repair truck also fixes vehicles for 3 min., but completely restores them. Repair truck can be used 5 times. To use repair track you should sat into drivers place of the damaged vehicle then look on repair truck and select 'Full repair' in the menu. Any suggestions welcome. // v1e by [sTELS]Zealot // Just add // [] execVM "zlt_fieldrepair.sqf"; #define DEFAULT_REPAIR_LENGTH 180 #define DEFAULT_REPAIR_TRUCK_USES 5 #define STR_FIELD_REPAIR "Field repair" #define STR_CANCEL_ACTION "Cancel action" #define STR_SERIOUS_REPAIR "Full repair" #define STR_REPAIR_CONDITIONS "Bad conditions for repair" #define STR_ANOTHER_ACTION "Another action in progress" #define STR_NEED_TOOLKIT "Need ToolKit in inventory yours or vehicle." #define STR_REPAIR_INTERRUPTED "Repair interrupted" #define STR_REPAIR_FINISHED "Repair finished" #define STR_REPAIR_MSG_STRING "%2 will be repaired in %1 sec" #define STR_REPAIR_TRUCK_DEPLETED "Spare parts depleted in repair truck" #define STR_HELP "Realistic field repair (Ðвтор: Zealot) <br/>Script gives each player ability to repair vehicles. <br/>- Repair lasts for 3 min., it can be interrupted and the continued, time saves.<br/>- Each vehicle could be repaired 1 time for spare parts stored in the vehicle itself.For the next repairs you should have Toolkit in your backpack or in vehicle cargo.<br/>- Field repair fixes only tyres, engine and tracks and only to 'Yellow state'.<br/>- Repair from repair trucks also lasts 3 min. but completely repairs vehicles. Repair truck can be used 5 times, then spare parts in it will be depleted.<br/>- To use repair truck you should sat on the drivers place of the damaged vehicle then look on repair truck and select 'Full repair' in menu.<br/>" #define STR_SCRIPTS_NAME "Scripts" #define STR_SCRIPT_NAME "Field repair" #define STR_PUSH_APC "Push vehicle" private ["_veh"]; _veh = [_this, 0, objNull] call BIS_fnc_param; if (isDedicated) exitWith {}; waitUntil {player == player}; zlt_repair_hps = ["HitLFWheel","HitLBWheel","HitLMWheel","HitLF2Wheel","HitRFWheel","HitRBWheel","HitRMWheel","HitRF2Wheel" ,"HitEngine", "HitLTrack","HitRTrack"]; zlt_hardRepairParts = ["HitEngine", "HitLTrack","HitRTrack"]; zlt_fnc_vehicledamaged = { private ["_veh","_vehtype","_flag"]; _veh = [_this, 0] call BIS_fnc_param; if (isNil {_veh}) exitWith {false}; _vehtype = typeOf _veh; _flag = false; { _cdmg = _veh getHitPointDamage (_x); if (not isNil {_cdmg} ) then { if (_cdmg > 0.64) exitWith {_flag = true}; }; } forEach zlt_repair_hps; _flag; }; zlt_fnc_partrepair = { private "_veh"; _veh = [_this, 0] call BIS_fnc_param; if (isNil {_veh} ) exitWith {}; { _dmg = (_veh getHitPointDamage _x); if (not isNil {_dmg}) then { if ( _dmg > 0.64 ) then { if (_x in zlt_hardRepairParts) then { _veh setHitPointDamage [_x,0.64]; } else { _veh setHitPointDamage [_x,0]; }; }; }; } foreach zlt_repair_hps; }; zlt_fnc_notify = { [ format["<t size='0.75' color='#ffff00'>%1</t>",_this], 0,1,5,0,0,301] spawn bis_fnc_dynamicText; }; zlt_fnc_hastk = { private ["_ret"]; _ret = 0; if ("ToolKit" in (items player)) then {_ret = 1;}; if ("ToolKit" in (itemCargo _veh)) then {_ret = 2;}; if ( (_veh getVariable ["zlt_longrepair_times",0] ) == 0) then {_ret = 3;}; _ret; }; zlt_fnc_removeitemfromcargo = { private ["_veh"]; _item = [_this,0,""] call BIS_fnc_param; _veh = [_this,1] call BIS_fnc_param; _allitems = itemcargo _veh; clearItemCargoGlobal _veh; _allitems = _allitems call BIS_fnc_consolidateArray; _n = [_allitems, _item] call BIS_fnc_findInPairs; _allitems set [_n, [(_allitems select _n) select 0, ((_allitems select _n) select 1) - 1]]; { _veh addItemCargoGlobal [_x select 0, _x select 1 ];} foreach _allitems; }; zlt_prc_repairvehicle = { private ["_veh"]; _veh = (nearestObjects[player, ["LandVehicle","Air","Ship"], 7] select 0); if (isNil {_veh}) exitWith {}; if (zlt_mutexAction) exitWith { STR_ANOTHER_ACTION call zlt_fnc_notify; }; if (not alive player or (player distance _veh) > 7 or (vehicle player != player) or speed _veh > 3) exitWith {STR_REPAIR_CONDITIONS call zlt_fnc_notify;}; _hastk = [] call zlt_fnc_hastk; if ( _hastk == 0 ) exitWith {STR_NEED_TOOLKIT call zlt_fnc_notify;}; _repairFinished = false; zlt_mutexAction = true; _lastPlayerState = animationState player; player playActionNow "medicstartup"; sleep 0.5; _maxlength = _veh getVariable["zlt_longrepair",DEFAULT_REPAIR_LENGTH]; _vehname = getText ( configFile >> "CfgVehicles" >> typeOf(_veh) >> "displayName"); _length = _maxlength; while {alive player and (player distance _veh) < 7 and (vehicle player == player) and speed _veh < 3 and not _repairFinished and zlt_mutexAction and (["medic",animationState player] call BIS_fnc_inString)} do { // diag_log ("ANIM STATE = "+str(animationState player)); (format[sTR_REPAIR_MSG_STRING, _length, _vehname] ) call zlt_fnc_notify; if (_length <= 0) then {_repairFinished = true;}; _length = _length - 1; sleep 1; _hastk = [] call zlt_fnc_hastk; if (_hastk <= 0) exitWith {STR_NEED_TOOLKIT call zlt_fnc_notify; sleep 1.;}; }; if (_repairFinished) then { _hastk = [] call zlt_fnc_hastk; if (_hastk == 0) exitWith {STR_NEED_TOOLKIT call zlt_fnc_notify; sleep 1.;}; STR_REPAIR_FINISHED call zlt_fnc_notify; [_veh,"zlt_fnc_partrepair", _veh] call bis_fnc_MP; if (_hastk == 1) then {player removeItem "ToolKit";} else { ["ToolKit",_veh] call zlt_fnc_removeitemfromcargo;}; _veh setVariable["zlt_longrepair",DEFAULT_REPAIR_LENGTH, true]; _veh setVariable["zlt_longrepair_times", (_veh getVariable ["zlt_longrepair_times",0]) + 1 , true ]; } else { STR_REPAIR_INTERRUPTED call zlt_fnc_notify; _veh setVariable["zlt_longrepair",_length, true]; }; zlt_mutexAction = false; player playActionNow "medicstop"; }; waitUntil {player == player}; zlt_mutexAction = false; zlt_fnc_repair_cond = { private ["_veh","_ret"]; _ret = false; _veh = (nearestObjects[player, ["LandVehicle","Air","Ship"], 7] select 0); if (isNil {_veh}) exitWith {_ret}; _dmged = _veh call zlt_fnc_vehicledamaged; _ret = (alive player and (player distance _veh) < 5 and (vehicle player == player) and speed _veh < 3 and not zlt_mutexAction and _dmged); _ret; }; zlt_fnc_fullrepair = { private "_veh"; _veh = [_this, 0] call BIS_fnc_param; _veh setDamage 0; }; zlt_fnc_heavyRepair = { _truck =_this select 0; //): Object - the object which the action is assigned to _caller =_this select 1; //): Object - the unit that activated the action _veh = vehicle _caller; if (zlt_mutexAction) exitWith { STR_ANOTHER_ACTION call zlt_fnc_notify; }; if (_truck getVariable ["zlt_repair_cargo", 0] <= 0) then { STR_REPAIR_TRUCK_DEPLETED call zlt_fnc_notify; }; if (not alive player or vehicle _caller == _caller or speed _veh > 3 or driver _veh != _caller or _veh distance _truck > 10 ) exitWith {STR_REPAIR_CONDITIONS call zlt_fnc_notify;}; _repairFinished = false; zlt_mutexAction = true; _maxlength = _veh getVariable["zlt_longrepairTruck",DEFAULT_REPAIR_LENGTH]; _vehname = getText ( configFile >> "CfgVehicles" >> typeOf(_veh) >> "displayName"); _length = _maxlength; while { alive player and alive _truck and alive _veh and driver _veh == _caller and speed _veh <= 3 and not _repairFinished and zlt_mutexAction and _veh distance _truck < 10 } do { (format[sTR_REPAIR_MSG_STRING, _length, _vehname] ) call zlt_fnc_notify; if (_length <= 0) then {_repairFinished = true;}; _length = _length - 1; sleep 1; }; if (_repairFinished) then { STR_REPAIR_FINISHED call zlt_fnc_notify; [_veh,"zlt_fnc_fullrepair", _veh] call bis_fnc_MP; _truck setVariable ["zlt_repair_cargo", ( (_truck getVariable ["zlt_repair_cargo", 0] )- (1 / DEFAULT_REPAIR_TRUCK_USES) )] ; _veh setVariable["zlt_longrepairTruck", nil, true]; _veh setVariable["zlt_longrepair_times", (_veh getVariable ["zlt_longrepair_times",0]) + 1 , true ]; } else { STR_REPAIR_INTERRUPTED call zlt_fnc_notify; _veh setVariable["zlt_longrepairTruck",_length, true]; }; zlt_mutexAction = false; }; zlt_pushapc = { private ["_veh","_unit"]; _veh = vehicle player; if (zlt_mutexAction) exitWith {}; zlt_mutexAction = true; sleep 1.; _spd = 3; _dir = direction _veh; _veh setVelocity [(sin _dir)*_spd, (cos _dir)*_spd, 0]; zlt_mutexAction = false; }; zlt_fnc_heavyRepairCOnd = { _truck = _this select 0; _player = _this select 1; _player == (driver (vehicle _player)) and (vehicle _player isKindOf "LandVehicle" or vehicle _player isKindOf "Ship" or vehicle _player isKindOf "Air") and alive _truck and alive _player and not zlt_mutexAction and speed vehicle _player <= 3 and (damage (vehicle _player) != 0); }; zlt_fnc_addRepairActions = { private ["_veh"]; _veh = _this select 0; if (_veh isKindOf "LandVehicle" or _veh isKindOf "Ship" or _veh isKindOf "Air") then { _veh addAction["<t color='#ff0000'>"+STR_FIELD_REPAIR+"</t>", zlt_prc_repairvehicle, [], -1, false, false, '','alive _target and (_target call zlt_fnc_vehicledamaged) and (_this distance _target) < 7 and (vehicle _this == _this) and alive _this and not zlt_mutexAction']; }; if (getRepairCargo _veh > 0) then { _veh setRepairCargo 0; _veh setVariable ["zlt_repair_cargo", 1]; _veh addAction["<t color='#ff0000'>"+STR_SERIOUS_REPAIR+ "</t>", zlt_fnc_heavyRepair, [], -1, false, false, '','[_target, _this] call zlt_fnc_heavyRepairCOnd']; }; if (_veh isKindOf "Wheeled_APC_F") then { _veh addAction ["<t color='#FF9900'>"+STR_PUSH_APC+"</t>",zlt_pushapc,[],5,false,true,"","canMove _target and _this == driver _target and surfaceIsWater getpos _this and abs(speed _target) < 3 and not zlt_mutexAction"]; }; }; if (isNil "zlt_cancelActionId") then { zlt_cancelActionId = player addAction["<t color='#0000ff'>"+STR_CANCEL_ACTION+"</t>", {zlt_mutexAction = false}, [], 10, false, false, '',' zlt_mutexAction ']; player createDiarySubject [sTR_SCRIPTS_NAME,STR_SCRIPTS_NAME]; player createDiaryRecord [sTR_SCRIPTS_NAME,[sTR_SCRIPT_NAME, STR_HELP]]; }; if (isNull _veh) then { { if not (_x getVariable["ZLT_NOREPAIR",false]) then {[_x] call zlt_fnc_addRepairActions};} foreach vehicles; } else { [_veh] call zlt_fnc_addRepairActions; };
  8. I wrote a litle script which generate random frequencies for TaskForce radio. Frequencies guaranteed to be uniq for each squad. Script just places markers on left upper corner of the map on the briefing screen at the start of mission. Those markers text contains frequencies for all friendly squads. (for West and Resistance for example). In the begginng of the mission each unit starts with his sw radio frequency already setup on his radio. Script intented for MP TvT missions. Use: [] execVM "zlt_gen_freqs.sqf"; from init.sqf zlt_gen_freqs.sqf // v.1d by [sTELS]Zealot // Use from init.sqf: // [] execVM "zlt_gen_freqs.sqf"; _markeast = []; _markwest = []; _markres = []; zlt_fnc_createmarkerlocal = { private ["_marker","_pos","_shape","_type","_text","_color","_dir","_brush","_size"]; _marker = [_this, 0, "mrk"] call BIS_fnc_param; _pos = [_this, 1, [0,0]] call BIS_fnc_param; _text = [_this, 2, ""] call BIS_fnc_param; _color = [_this, 3, "ColorOrange"] call BIS_fnc_param; _type = [_this, 4, "mil_dot"] call BIS_fnc_param; _size = [_this, 5, [1,1] ] call BIS_fnc_param; _shape = [_this, 6, "ICON"] call BIS_fnc_param; _dir = [_this, 7, 0] call BIS_fnc_param; _brush = [_this, 8, "Solid"] call BIS_fnc_param; createMarkerLocal[_marker, _pos]; _marker setMarkerShapeLocal _shape; _marker setMarkerTypeLocal _type; _marker setMarkerTextLocal _text; _marker setMarkerColorLocal _color; _marker setMarkerDirLocal _dir; _marker setMarkerBrushlocal _brush; _marker setMarkerSizelocal _size; _marker setMarkerPosLocal _pos; _marker; }; zlt_prc_freq_updmarkers = { _zlt_genfreq_xmap = 0; _zlt_genfreq_ymap = 8000; _zlt_genfreq_deltamap = 250; if (worldName == "Altis") then { _zlt_genfreq_xmap = 1000; _zlt_genfreq_ymap = 30000; _zlt_genfreq_deltamap = 500; }; _zlt_spawnSetSwChannel = { [] spawn { waituntil {sleep 0.5;player call haveSwRadio}; if (not isNil {zlt_genFreq_playerSwChannel}) then { [call activeSwRadio, zlt_genFreq_playerSwChannel ] call setSwFrequency; }; }; }; _zlt_fnc_printfrq = { _val = _this select 1; _group = _this select 0; _side = _this select 2; _txt = format["%1: %2 MHz",_group, _val]; _mcolor = [_side, true] call bis_fnc_sidecolor; [format ["mrk_freq_%1", _zlt_genfreq_ymap], [_zlt_genfreq_xmap, _zlt_genfreq_ymap] , _txt ,_mcolor] call zlt_fnc_createmarkerlocal; _zlt_genfreq_ymap = _zlt_genfreq_ymap - _zlt_genfreq_deltamap; }; if (isDedicated) exitWith {}; waituntil {player == player}; _friends = ([side player] call BIS_fnc_friendlySides) - [civilian]; _friendsids = []; {_friendsids set [count _friendsids, [_x] call BIS_fnc_sideID] } foreach _friends; _playerSideId = _friends find playerSide; _playerGroupId = groupID group player; _lrside = _friends select 0; _mcolor = [side player, true] call bis_fnc_sidecolor; ["mrk_freq_a", [_zlt_genfreq_xmap, _zlt_genfreq_ymap] , "Frequencies:" ,_mcolor] call zlt_fnc_createmarkerlocal; _zlt_genfreq_ymap = _zlt_genfreq_ymap - _zlt_genfreq_deltamap; _lrrecord = ( _this select (_friendsids select 0) ) select 0; [_lrrecord select 0, _lrrecord select 1,side player] call _zlt_fnc_printfrq; for "_x" from 0 to count(_friendsids)-1 do { _radioarr = _this select (_friendsids select _x); for "_y" from 1 to count(_radioarr)-1 do { _carr = _radioarr select _y; if ((_playerSideId == _x) and ([_playerGroupId,_carr select 0] call BIS_fnc_inString)) then { zlt_genFreq_playerSwChannel = str(_carr select 1); [] call _zlt_spawnSetSwChannel; }; [_carr select 0, _carr select 1,_friends select _x] call _zlt_fnc_printfrq; }; }; }; if (not isDedicated) spawn { waitUntil {!isNil "public_frequency_markers"}; public_frequency_markers call zlt_prc_freq_updmarkers; }; _fnc_genfreq = { private ["_state","_num","_isinbl","_l1","_l2"]; _state = _this select 0; if (isNil {zlt_freqblacklist}) then { zlt_freqblacklist = []; }; _num = 0; _l1 = -2; _l2 = 2; _isinbl = true; if (_state == 0) then { _l1 = 32; _l2 = 64; }; if (_state == 1) then { _l1 = 100; _l2 = 400; }; while {_isinbl} do { _num = round (([_l1,_l2] call bis_fnc_randomnum) * 10) / 10 ; if not (_num in zlt_freqblacklist) then { zlt_freqblacklist = zlt_freqblacklist set [count zlt_freqblacklist, _num ]; _isinbl = false; }; }; _num; }; if (not isServer) exitWith {}; _num = [0] call _fnc_genfreq ; _sdv = [2] call _fnc_genfreq ; _markeast set [count _markeast, ["LR", str(_num)+" ("+(if (_sdv >0) then {"+"} else {""})+str(_sdv)+")"]] ; _num = [0] call _fnc_genfreq ; _sdv = [2] call _fnc_genfreq ; _markwest set [count _markwest,["LR", str(_num)+" ("+(if (_sdv >0) then {"+"} else {""})+str(_sdv)+")"]] ; _num = [0] call _fnc_genfreq ; _sdv = [2] call _fnc_genfreq ; _markres set [count _markres, ["LR", str(_num)+" ("+(if (_sdv >0) then {"+"} else {""})+str(_sdv)+")"]] ; { _num = [1] call _fnc_genfreq ; if ((leader _x) in playableUnits) then { switch true do { case (side leader _x == west) : {_markwest set [ count _markwest , [groupID (_x)+"("+name leader _x +")", _num ]];}; case (side leader _x == east) : {_markeast set [ count _markeast , [groupID (_x)+"("+name leader _x +")", _num ]];}; case (side leader _x == resistance) : {_markres set [ count _markres , [groupID (_x)+"("+name leader _x +")", _num ]];}; }; }; } foreach allgroups; public_frequency_markers = [_markeast,_markwest,_markres]; publicVariable "public_frequency_markers";
  9. zealot111

    Realistic repair script

    Latest version: All files integrated into one script. Installation and use greatly simplificated. Now it repairs only wheels, Engine and Tracks. Use: [] execVM "zlt_fieldrepair.sqf"; from init.sqf (Created by script vehicles will not have this ability, only vehicles placed in editor are) zlt_fieldrepair.sqf: // v1c by [sTELS]Zealot // Just add // [] execVM "zlt_fieldrepair.sqf"; #define DEFAULT_REPAIR_LENGTH 180 private ["_veh"]; _veh = [_this, 0, objNull] call BIS_fnc_param; if (isDedicated) exitWith {}; zlt_repair_hps = ["HitLFWheel","HitLBWheel","HitLMWheel","HitLF2Wheel","HitRFWheel","HitRBWheel","HitRMWheel","HitRF2Wheel" ,"HitEngine", "HitLTrack","HitRTrack"]; zlt_hardRepairParts = ["HitEngine", "HitLTrack","HitRTrack"]; zlt_fnc_vehicledamaged = { private ["_veh","_vehtype","_flag"]; _veh = [_this, 0] call BIS_fnc_param; if (isNil {_veh}) exitWith {false}; _vehtype = typeOf _veh; _flag = false; { _cdmg = _veh getHitPointDamage (_x); if (not isNil {_cdmg} ) then { if (_cdmg > 0.64) exitWith {_flag = true}; }; } forEach zlt_repair_hps; _flag; }; zlt_fnc_partrepair = { private "_veh"; _veh = [_this, 0] call BIS_fnc_param; if (isNil {_veh} ) exitWith {}; { _dmg = (_veh getHitPointDamage _x); if (not isNil {_dmg}) then { if ( _dmg > 0.64 ) then { if (_x in zlt_hardRepairParts) then { _veh setHitPointDamage [_x,0.64]; } else { _veh setHitPointDamage [_x,0]; }; }; }; } foreach zlt_repair_hps; }; zlt_fnc_notify = { [ format["<t size='0.75' color='#ffff00'>%1</t>",_this], 0,1,5,0,0,301] spawn bis_fnc_dynamicText; }; zlt_fnc_hastk = { private ["_ret"]; _ret = 0; if ("ToolKit" in (items player)) then {_ret = 1;}; if ("ToolKit" in (itemCargo _veh)) then {_ret = 2;}; if ( (_veh getVariable ["zlt_longrepair_times",0] ) == 0) then {_ret = 3;}; _ret; }; zlt_fnc_removeitemfromcargo = { private ["_veh"]; _item = [_this,0,""] call BIS_fnc_param; _veh = [_this,1] call BIS_fnc_param; _allitems = itemcargo _veh; clearItemCargoGlobal _veh; _allitems = _allitems call BIS_fnc_consolidateArray; _n = [_allitems, _item] call BIS_fnc_findInPairs; _allitems set [_n, [(_allitems select _n) select 0, ((_allitems select _n) select 1) - 1]]; { _veh addItemCargoGlobal [_x select 0, _x select 1 ];} foreach _allitems; }; zlt_prc_repairvehicle = { private ["_veh"]; _veh = (nearestObjects[player, ["LandVehicle","Air","Ship"], 5] select 0); if (isNil {_veh}) exitWith {}; if (zlt_mutexAction) exitWith { "Another action in process." call zlt_fnc_notify; }; if (not alive player or (player distance _veh) > 5 or (vehicle player != player) or speed _veh > 3) exitWith {"Bad conditions for repair." call zlt_fnc_notify;}; _hastk = [] call zlt_fnc_hastk; if ( _hastk == 0 ) exitWith {"Need ToolKit in inventory yours or vehicle." call zlt_fnc_notify;}; _repairFinished = false; zlt_mutexAction = true; _lastPlayerState = animationState player; player playActionNow "medicstartup"; sleep 0.5; _maxlength = _veh getVariable["zlt_longrepair",DEFAULT_REPAIR_LENGTH]; _vehname = getText ( configFile >> "CfgVehicles" >> typeOf(_veh) >> "displayName"); _length = _maxlength; while {alive player and (player distance _veh) < 5 and (vehicle player == player) and speed _veh < 3 and not _repairFinished and zlt_mutexAction and (["medic",animationState player] call BIS_fnc_inString)} do { // diag_log ("ANIM STATE = "+str(animationState player)); (format["%2 will be repaired in %1 Ñек. ", _length, _vehname] ) call zlt_fnc_notify; if (_length <= 0) then {_repairFinished = true;}; _length = _length - 1; sleep 1; _hastk = [] call zlt_fnc_hastk; if (_hastk <= 0) exitWith {"Need ToolKit in inventory yours or vehicle." call zlt_fnc_notify; sleep 1.;}; }; if (_repairFinished) then { _hastk = [] call zlt_fnc_hastk; if (_hastk == 0) exitWith {"Need ToolKit in inventory yours or vehicle." call zlt_fnc_notify; sleep 1.;}; "Repair completed." call zlt_fnc_notify; [_veh,"zlt_fnc_partrepair", _veh] call bis_fnc_MP; if (_hastk == 1) then {player removeItem "ToolKit";} else { ["ToolKit",_veh] call zlt_fnc_removeitemfromcargo;}; _veh setVariable["zlt_longrepair",DEFAULT_REPAIR_LENGTH, true]; _veh setVariable["zlt_longrepair_times", (_veh getVariable ["zlt_longrepair_times",0]) + 1 , true ]; } else { "Repair interrupted." call zlt_fnc_notify; _veh setVariable["zlt_longrepair",_length, true]; }; zlt_mutexAction = false; player playActionNow "medicstop"; }; waitUntil {player == player}; zlt_mutexAction = false; zlt_fnc_repair_cond = { private ["_veh","_ret"]; _ret = false; _veh = (nearestObjects[player, ["LandVehicle","Air","Ship"], 5] select 0); if (isNil {_veh}) exitWith {_ret}; _dmged = _veh call zlt_fnc_vehicledamaged; _ret = (alive player and (player distance _veh) < 5 and (vehicle player == player) and speed _veh < 3 and not zlt_mutexAction and _dmged); _ret; }; zlt_fnc_addRepairActions = { private ["_veh"]; _veh = _this select 0; if (_veh isKindOf "LandVehicle" or _veh isKindOf "Ship" or _veh isKindOf "Air") then { _veh addAction["<t color='#ff0000'>Field repair</t>", zlt_prc_repairvehicle, [], -1, false, false, '','alive _target and (_target call zlt_fnc_vehicledamaged) and (_this distance _target) < 7 and (vehicle _this == _this) and alive _this and not zlt_mutexAction']; _veh addAction["<t color='#0000ff'>Cancel</t>", {zlt_mutexAction = false}, [], 10, false, false, '',' zlt_mutexAction ']; }; }; if (isNull _veh) then { { [_x] call zlt_fnc_addRepairActions} foreach vehicles; } else { [_veh] call zlt_fnc_addRepairActions; };
  10. Hi, All. I just tried code from init.sqf waituntil {sleep 0.5;player call haveSwRadio}; [call activeSwRadio, "101.1" ] call setSwFrequency; works just fine and sets all players' SW radio channels to that value (101.1)
  11. zealot111

    UAVs: Feedback and wishes

    UAV system must allow players to use UAV turret and UAV itself in the same time. Now players can control UAV turret or UAV itself separately but not control them in the same time by diffrent players, it is not fun in big TvT missions.
  12. Thank you very much! Hmm, when I use this script in my coop tvt mission after character death it constantly blinks changing from seagull into spectator. So it doesnt works. rpt file: {_x camSetFov szoom} foreach KEGs_cameras> Error position: <_x camSetFov szoom} foreach KEGs_cameras> Error Undefined variable in expression: _x File C:\Users\Igor\Documents\Arma 3 - Other Profiles\[sTELS]Zealot\mpmissions\wog_122_Hydrae_13.Altis\spectator\specta.sqf, line 581 Error in expression <kon camSetTarget KEGscam_target;
  13. zealot111

    Kill count for co-op

    You may try something like this. I tried this code and it works fine at first glance. init.sqf hc_killedBy = ""; hc_kills = []; if (isServer) then { { _x addMPEventHandler ["MPKilled", {[_this] execVM "onKilled.sqf";}]; } forEach allUnits; }; and onkilled.sqf private ["_rn","_obj","_this"]; fn_getRealName = { _rn = ""; _obj = _this; if (!(isplayer _obj)) then { _rn = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _obj] >> "Displayname"); if(vehicle _obj != _obj) then {_rn = getText (configFile >> "CfgVehicles" >> format["%1 crew", typeof vehicle _obj] >> "Displayname")}; }else{_rn = name _obj}; _rn; }; private ["_text","_x","_this"]; fn_genDiaryText = { _text = ""; if (hc_killedBy != "") then { _text = _text + format ["Killed by: %1 \n",hc_killedBy]; }; _text = _text + "Killed: \n"; { _text = _text + format ["%1 \n",_x]; } foreach hc_kills; _text; }; private ["_victim","_killer","_killerName","_victimName","_txt"]; if (isDedicated) exitWith {}; _victim = (_this select 0) select 0; _killer = (_this select 0) select 1; _killerName = _killer call fn_getRealName; _victimName = _victim call fn_getRealName; if (_victim == player) then { player sideChat format["%1 killed by %2 ",_victimName,_killerName]; hc_killedBy = _killerName; } else { hc_kills = hc_kills + [_victimName]; }; _txt = [] call fn_genDiaryText; hint _txt;
  14. Thanks for sharing this magnificent tool!
×