Jump to content

Tory Xiao

Member
  • Content Count

    52
  • Joined

  • Last visited

  • Medals

Everything posted by Tory Xiao

  1. I'm using this shellTracker.sqf to track fired shells. This script updates the position of the shell with "while {alive _projectile} do", however rocket shells seems to be "dead" when the rocket engine were burnt out, so the last position of rockets is always hundreds of meters away from the actual impact point. How do I fix that?
  2. I tried 3den Enhanced mod but it only provides the function of copying the array of positions and classname of each component in the composition, no rotation info
  3. But it seems still only 1 rotation gets copied not the whole array
  4. Are there any ready-made scripts that delete far away idle AI units to reduce the server load? Much appreciated!
  5. is this the first reforger post on this forum?
  6. I'm trying to edit the autorun script from [Release] Auto Run Script I want to set the keys that interrupt auto running to be only Shift, Tab, W, A, S, and D, but it seems that only Shift and WASD work. Any idea why? initPlayerLocal.sqf: //-------------------------AUTORUN------------------------------------- if (hasInterface) then{ waitUntil {!isNull findDisplay 46}; (findDisplay 46) displayAddEventHandler ["KeyDown", { if (_this select 1 == (actionKeys 'uavView') select 0) then { if (isNil "AR_active") then {AR_active = false}; if (AR_active) exitWith {AR_active = false}; if (!isNull objectParent player) exitWith {}; if (surfaceIsWater (getPos player)) exitWith {}; _legdamage = player getHit "legs"; AR_active = true; AR_weapon = currentWeapon player; AR_animation = switch (true) do { case (AR_weapon isEqualTo ""): {"AmovPercMevaSnonWnonDf"}; case (AR_weapon isEqualTo (handgunWeapon player)): {"AmovPercMevaSlowWpstDf"}; case (AR_weapon isEqualTo (primaryWeapon player)): {"AmovPercMevaSlowWrflDf"}; case (AR_weapon isEqualTo (secondaryWeapon player)): {"AmovPercMevaSlowWlnrDf"}; }; player addEventHandler ["AnimDone", { if ((!AR_active) || {!((currentWeapon player) isEqualTo AR_weapon)} || {!isNull objectParent player} || {surfaceIsWater (getPos player)} || {_this select 1 == AR_animation && speed (vehicle player) <= 0}) exitWith { player removeEventHandler ["AnimDone", _thisEventHandler]; AR_active = false; AR_weapon = nil; AR_animation = nil; }; player playMoveNow AR_animation; }]; player playMoveNow AR_animation; }; }]; // Stop running (uavView = Tab) (findDisplay 46) displayAddEventHandler ["KeyDown", { if ((_this select 1 == (actionKeys 'MoveForward') select 0) || (_this select 1 == (actionKeys 'vehicleTurbo') select 0) || (_this select 1 == (actionKeys 'uavView') select 0) || (_this select 1 == (actionKeys 'MoveBack') select 0) || (_this select 1 == (actionKeys 'TurnRight') select 0) || (_this select 1 == (actionKeys 'TurnLeft') select 0)) then { if (AR_active) then {AR_active = false}; }; }]; };
  7. I'm trying to add hitmarkers to my escape mission, but there are so many scripts that handle spawning AI infantry units, so I'll have to search every creatUnit and add _unit addMPEventHandler ["MPHit",{call Eventhandler_fnc_MPHit}]; after it. Is there any way to add eventhandler once for all of them?
  8. No respawn for players. In my mission once a player is down he became invincible, and respawn button is disabled, he can only wait for teammates to revive or rejoin the server Thanks a lot! I'll try the script
  9. Tory Xiao

    [Release] Auto Run Script

    Have anyone figured out how to add autorun script to mission files?
  10. I found this intersect scanner in A3W mission files server\functions\fn_boundingBoxReal.sqf: // Here is the intersect scanner, which is used in the editor. The resulting array is copied into the clipboard. 0 spawn { _precision = 0.1; comment "change this for higher/lower precision"; _lineColor1 = [0,1,0,1]; _lineColor2 = [1,0,0,1]; _parentClasses = [ "ReammoBox_F", "Truck_F", "Tank_F", "Car_F", "Ship_F", "Air", "All" ]; _vehClasses = [ ["Box_NATO_Wps_F", "Box_NATO_Wps_F"], ["Box_NATO_WpsSpecial_F", "Box_NATO_WpsSpecial_F"], ["Box_NATO_Ammo_F", "Box_NATO_Ammo_F"], ["Box_NATO_AmmoOrd_F", "Box_NATO_AmmoOrd_F"], ["Box_NATO_Grenades_F", "Box_NATO_Grenades_F"], ["Box_NATO_Support_F", "Box_NATO_Support_F"], ["Box_NATO_WpsLaunch_F", "Box_NATO_WpsLaunch_F"], ["Box_NATO_AmmoVeh_F", "Box_NATO_AmmoVeh_F"], ["Box_East_Wps_F", "Box_East_Wps_F"], ["Box_East_WpsSpecial_F", "Box_East_WpsSpecial_F"], ["Box_East_Ammo_F", "Box_East_Ammo_F"], ["Box_East_AmmoOrd_F", "Box_East_AmmoOrd_F"], ["Box_East_Grenades_F", "Box_East_Grenades_F"], ["Box_East_Support_F", "Box_East_Support_F"], ["Box_East_WpsLaunch_F", "Box_East_WpsLaunch_F"], ["Box_East_AmmoVeh_F", "Box_East_AmmoVeh_F"], ["Box_IND_Wps_F", "Box_IND_Wps_F"], ["Box_IND_WpsSpecial_F", "Box_IND_WpsSpecial_F"], ["Box_IND_Ammo_F", "Box_IND_Ammo_F"], ["Box_IND_AmmoOrd_F", "Box_IND_AmmoOrd_F"], ["Box_IND_Grenades_F", "Box_IND_Grenades_F"], ["Box_IND_Support_F", "Box_IND_Support_F"], ["Box_IND_WpsLaunch_F", "Box_IND_WpsLaunch_F"], ["Box_IND_AmmoVeh_F", "Box_IND_AmmoVeh_F"], ["Box_FIA_Support_F", "Box_FIA_Support_F"], ["B_supplyCrate_F", "B_supplyCrate_F"], ["C_supplyCrate_F", "C_supplyCrate_F"], ["C_Van_01_box_F", "Van_01_box_base_F"], ["C_Van_01_fuel_F", "Van_01_fuel_base_F"], ["C_Van_01_transport_F", "Van_01_base_F"], ["C_Van_02_vehicle_F", "Van_02_base_F"], ["B_Truck_01_ammo_F", "B_Truck_01_ammo_F"], ["B_Truck_01_box_F", "B_Truck_01_box_F"], ["B_Truck_01_fuel_F", "B_Truck_01_fuel_F"], ["B_Truck_01_medical_F", "B_Truck_01_medical_F"], ["B_Truck_01_Repair_F", "B_Truck_01_Repair_F"], ["B_Truck_01_mover_F", "B_Truck_01_mover_F"], ["B_Truck_01_covered_F", "Truck_01_base_F"], ["O_Truck_02_ammo_F", "O_Truck_02_ammo_F"], ["O_Truck_02_medical_F", "O_Truck_02_medical_F"], ["O_Truck_02_box_F", "O_Truck_02_box_F"], ["O_Truck_02_fuel_F", "O_Truck_02_fuel_F"], ["I_Truck_02_ammo_F", "I_Truck_02_ammo_F"], ["I_Truck_02_medical_F", "I_Truck_02_medical_F"], ["I_Truck_02_box_F", "I_Truck_02_box_F"], ["I_Truck_02_fuel_F", "I_Truck_02_fuel_F"], ["I_Truck_02_MRL_F", "Truck_02_MRL_base_F"], ["I_Truck_02_covered_F", "Truck_02_base_F"], ["O_Truck_03_ammo_F", "O_Truck_03_ammo_F"], ["O_Truck_03_device_F", "O_Truck_03_device_F"], ["O_Truck_03_fuel_F", "O_Truck_03_fuel_F"], ["O_Truck_03_medical_F", "O_Truck_03_medical_F"], ["O_Truck_03_repair_F", "O_Truck_03_repair_F"], ["O_Truck_03_covered_F", "Truck_03_base_F"], ["I_LT_01_AT_F", "LT_01_AT_base_F"], ["I_LT_01_AA_F", "LT_01_AA_base_F"], ["I_LT_01_cannon_F", "LT_01_cannon_base_F"], ["I_LT_01_scout_F", "LT_01_base_F"], ["B_APC_Tracked_01_AA_F", "B_APC_Tracked_01_AA_F"], ["B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_CRV_F"], ["B_APC_Tracked_01_rcws_F", "APC_Tracked_01_base_F"], ["O_APC_Tracked_02_AA_F", "O_APC_Tracked_02_AA_F"], ["O_APC_Tracked_02_cannon_F", "APC_Tracked_02_base_F"], ["I_APC_tracked_03_cannon_F", "APC_Tracked_03_base_F"], ["B_MBT_01_arty_F", "MBT_01_arty_base_F"], ["B_MBT_01_mlrs_F", "MBT_01_mlrs_base_F"], ["B_MBT_01_TUSK_F", "B_MBT_01_TUSK_F"], ["B_MBT_01_cannon_F", "MBT_01_base_F"], ["O_MBT_02_arty_F", "MBT_02_arty_base_F"], ["O_MBT_02_cannon_F", "MBT_02_base_F"], ["I_MBT_03_cannon_F", "MBT_03_base_F"], ["O_MBT_04_command_F", "MBT_04_command_base_F"], ["O_MBT_04_cannon_F", "MBT_04_base_F"], ["C_Kart_01_F", "Kart_01_Base_F"], ["C_Quadbike_01_F", "Quadbike_01_base_F"], ["C_Hatchback_01_F", "Hatchback_01_base_F"], ["B_G_Offroad_01_armed_F", "Offroad_01_armed_base_F"], ["C_Offroad_01_repair_F", "Offroad_01_repair_base_F"], ["C_Offroad_01_F", "Offroad_01_base_F"], ["I_C_Offroad_02_AT_F", "Offroad_02_AT_base_F"], ["I_C_Offroad_02_LMG_F", "Offroad_02_LMG_base_F"], ["C_Offroad_02_unarmed_F", "Offroad_02_base_F"], ["C_SUV_01_F", "SUV_01_base_F"], ["B_UGV_01_rcws_F", "UGV_01_rcws_base_F"], ["B_UGV_01_F", "UGV_01_base_F"], ["B_T_LSV_01_AT_F", "LSV_01_AT_base_F"], ["B_T_LSV_01_armed_F", "LSV_01_armed_base_F"], ["B_T_LSV_01_unarmed_F", "LSV_01_base_F"], ["O_T_LSV_02_AT_F", "LSV_02_AT_base_F"], ["O_T_LSV_02_armed_F", "LSV_02_armed_base_F"], ["O_T_LSV_02_unarmed_F", "LSV_02_base_F"], ["B_MRAP_01_gmg_F", "MRAP_01_gmg_base_F"], ["B_MRAP_01_F", "MRAP_01_base_F"], ["O_MRAP_02_hmg_F", "MRAP_02_hmg_base_F"], ["O_MRAP_02_F", "MRAP_02_base_F"], ["I_MRAP_03_hmg_F", "MRAP_03_hmg_base_F"], ["I_MRAP_03_F", "MRAP_03_base_F"], ["B_APC_Wheeled_01_cannon_F", "APC_Wheeled_01_base_F"], ["O_APC_Wheeled_02_rcws_v2_F", "APC_Wheeled_02_base_F"], ["I_APC_Wheeled_03_cannon_F", "APC_Wheeled_03_base_F"], ["B_AFV_Wheeled_01_up_cannon_F", "AFV_Wheeled_01_up_base_F"], ["B_AFV_Wheeled_01_cannon_F", "AFV_Wheeled_01_base_F"], ["B_SDV_01_F", "SDV_01_base_F"], ["C_Scooter_Transport_01_F", "Scooter_Transport_01_base_F"], ["C_Rubberboat", "Rubber_duck_base_F"], ["C_Boat_Civil_01_F", "Boat_Civil_01_base_F"], ["C_Boat_Transport_02_F", "Boat_Transport_02_base_F"], ["B_Boat_Armed_01_minigun_F", "Boat_Armed_01_base_F"], ["C_Heli_Light_01_civil_F", "Heli_Light_01_civil_base_F"], ["B_Heli_Light_01_armed_F", "Heli_Light_01_base_F"], ["O_Heli_Light_02_F", "Heli_Light_02_base_F"], ["I_Heli_light_03_F", "Heli_light_03_base_F"], ["B_Heli_Transport_01_F", "Heli_Transport_01_base_F"], ["I_Heli_Transport_02_F", "Heli_Transport_02_base_F"], ["B_Heli_Transport_03_F", "Heli_Transport_03_base_F"], ["O_Heli_Transport_04_box_F", "Heli_Transport_04_base_F"], ["B_Heli_Attack_01_F", "Heli_Attack_01_base_F"], ["O_Heli_Attack_02_F", "Heli_Attack_02_base_F"], ["C_Plane_Civil_01_F", "Plane_Civil_01_base_F"], ["B_Plane_Fighter_01_F", "Plane_Fighter_01_Base_F"], ["O_Plane_Fighter_02_F", "Plane_Fighter_02_Base_F"], ["I_Plane_Fighter_03_CAS_F", "Plane_Fighter_03_base_F"], ["I_Plane_Fighter_04_F","Plane_Fighter_04_Base_F"], ["B_Plane_CAS_01_F", "Plane_CAS_01_base_F"], ["O_Plane_CAS_02_F", "Plane_CAS_02_base_F"], ["B_T_VTOL_01_armed_F", "VTOL_01_base_F"], ["O_T_VTOL_02_infantry_F", "VTOL_02_base_F"], ["B_UAV_01_F", "UAV_01_base_F"], ["B_UAV_02_CAS_F", "UAV_02_base_F"], ["B_T_UAV_03_F", "UAV_03_base_F"], ["O_T_UAV_04_CAS_F", "UAV_04_base_F"], ["B_UAV_05_F", "UAV_05_Base_F"], ["C_IDAP_UAV_06_antimine_F", "UAV_06_antimine_base_F"], ["B_UAV_06_F", "UAV_06_base_F"] ]; comment "this is to take into account heli rotors"; _extraOffsets = [ ["Heli_Light_01_base_F", [[0,0,0],[0,0.4,0]]], ["Heli_Transport_03_base_F", [[0,0,0],[0,2.2,0]]] ]; _classesBBox = []; { _classesBBox pushBack [_x, []] } forEach _parentClasses; _pos = getPosATL player; _pos set [1, (_pos select 1) + 15]; _pos set [2, (_pos select 2) + 5]; _dir = getDir player; _dir = _dir + 270; { _class = _x select 0; _kind = _x select 1; _vehicle = createVehicle [_class, _pos, [], 0, "None"]; { _vehicle animate [configName _x, 0, true]; } forEach configProperties [configFile >> "CfgVehicles" >> _class >> "AnimationSources", "(configName _x) select [0,4] == 'hide'"]; { _vehicle animate [configName _x, 1, true]; } forEach configProperties [configFile >> "CfgVehicles" >> _class >> "AnimationSources", "(configName _x) select [0,4] == 'show'"]; _vehicle setDir _dir; _vehicle enableSimulation false; _minBBox = (boundingBox _vehicle) select 0; _maxBBox = (boundingBox _vehicle) select 1; _minX = floor (_minBBox select 0); _minY = floor (_minBBox select 1); _minZ = floor (_minBBox select 2); _maxX = ceil (_maxBBox select 0); _maxY = ceil (_maxBBox select 1); _maxZ = ceil (_maxBBox select 2); _minXreal = _maxX; _minYreal = _maxY; _minZreal = _maxZ; _maxXreal = _minX; _maxYreal = _minY; _maxZreal = _minZ; comment "intersect is used as a backup because lineIntersects doesn't detect some heli blades, 'GEOM' option is the most accurate for those"; _found = { lineIntersects [ATLtoASL _pos1, ATLtoASL _pos2] || {count ([_vehicle, "GEOM"] intersect [_pos1, _pos2]) > 0} }; for "_X" from _minX to _maxX step _precision do { for "_Y" from _minY to _maxY step _precision do { _pos1 = _vehicle modelToWorld [_X, _Y, _minZ]; _pos2 = _vehicle modelToWorld [_X, _Y, _maxZ]; if (call _found) then { if (_X < _minXreal) then { _minXreal = _X - _precision }; if (_X >= _maxXreal) then { _maxXreal = _X + _precision }; if (_Y < _minYreal) then { _minYreal = _Y - _precision }; if (_Y >= _maxYreal) then { _maxYreal = _Y + _precision }; drawLine3D [_pos1, _pos2, _lineColor2]; } else { drawLine3D [_pos1, _pos2, _lineColor1]; }; }; }; for "_Y" from _minY to _maxY step _precision do { for "_Z" from _minZ to _maxZ step _precision do { _pos1 = _vehicle modelToWorld [_minX, _Y, _Z]; _pos2 = _vehicle modelToWorld [_maxX, _Y, _Z]; if (call _found) then { if (_Y < _minYreal) then { _minYreal = _Y - _precision }; if (_Y >= _maxYreal) then { _maxYreal = _Y + _precision }; if (_Z < _minZreal) then { _minZreal = _Z - _precision }; if (_Z >= _maxZreal) then { _maxZreal = _Z + _precision }; drawLine3D [_pos1, _pos2, _lineColor2]; } else { drawLine3D [_pos1, _pos2, _lineColor1]; }; }; }; for "_Z" from _minZ to _maxZ step _precision do { for "_X" from _minX to _maxX step _precision do { _pos1 = _vehicle modelToWorld [_X, _minY, _Z]; _pos2 = _vehicle modelToWorld [_X, _maxY, _Z]; if (call _found) then { if (_X < _minXreal) then { _minXreal = _X - _precision }; if (_X >= _maxXreal) then { _maxXreal = _X + _precision }; if (_Z < _minZreal) then { _minZreal = _Z - _precision }; if (_Z >= _maxZreal) then { _maxZreal = _Z + _precision }; drawLine3D [_pos1, _pos2, _lineColor2]; } else { drawLine3D [_pos1, _pos2, _lineColor1]; }; }; }; _minXreal = (round (_minXreal / _precision)) * _precision; _minYreal = (round (_minYreal / _precision)) * _precision; _minZreal = (round (_minZreal / _precision)) * _precision; _maxXreal = (round (_maxXreal / _precision)) * _precision; _maxYreal = (round (_maxYreal / _precision)) * _precision; _maxZreal = (round (_maxZreal / _precision)) * _precision; _minReal = [_minXreal, _minYreal, _minZreal]; _maxReal = [_maxXreal, _maxYreal, _maxZreal]; { if (_vehicle isKindOf (_x select 0)) exitWith { _minReal = _minReal vectorAdd (_x select 1 select 0); _maxReal = _maxReal vectorAdd (_x select 1 select 1); }; } forEach _extraOffsets; { if (_vehicle isKindOf (_x select 0)) exitWith { (_x select 1) pushBack [_kind, [_minReal,_maxReal]]; }; } forEach _classesBBox; deleteVehicle _vehicle; sleep 0.1; } forEach _vehClasses; _validBBoxes = []; { if (count (_x select 1) > 0) then { _validBBoxes pushBack _x; }; } forEach _classesBBox; copyToClipboard str _validBBoxes; };
  11. Is there a way to limit the flying altitude of a drone by script? I'm currently using this to limit manned aircraft's altitude initPlayerLocal.sqf: areaTimer = 0; #define DTIME 40 // Time until death while { true } do { _p = getpos player; _hightplayer = _p select 2; if( _hightplayer < 2000 ) then { areaTimer = time; } else { _t = time - areaTimer; if(_t >= DTIME) then { ["<t color='#ff0000' size='2'>Killed by hight limitation</t>",-1,-1,5,1,0,789] spawn BIS_fnc_dynamicText; player setDamage 1; } else { _time = [DTIME - _t, 0] call BIS_fnc_cutDecimals; hintSilent parseText format ["<t size='2' color='#ff0000'>Hight Limit</t><br/><br/>Please return below 2000m in %1 seconds<br />Or you will get killed</t>", _time]; playSound "FD_CP_Not_Clear_F"; }; }; sleep 1; }; But this wont work for UAVs
  12. Does anyone use soulkobk's serverRestartMessages.sqf on his server to show restart messages? I always get a "CallExtension 'real_date' could not be found" error when loading the script, even though real_date.dll file is right there in the game directory. Any idea why ?? GitHub link: https://github.com/soulkobk/ArmA3_Scripts/blob/master/serverRestartMessages/serverRestartMessages.sqf
  13. forEach (playableUnits - [player]); I use this to get the array containing all players other than the target player side group _hacked isEqualTo playerSide and use this to tell if a player is in the target player's group But how do I get the array that contains every player that is not in the target player's group?
  14. All players kicked simultaneously, why?
  15. The question is how do I find the submunition?
  16. Welp, didnt work. The last mark position is still at where the rocket engine went off
  17. It's really funny to know rocket shells are "dead" when the engines were off lol
  18. Im using this: [ missionNamespace, "arsenalOpened", { disableSerialization; _display = _this select 0; { ( _display displayCtrl _x ) ctrlSetText "Disabled"; ( _display displayCtrl _x ) ctrlSetTextColor [ 1, 0, 0, 0.5 ]; ( _display displayCtrl _x ) ctrlRemoveAllEventHandlers "buttonclick"; }forEach [ 44146, 44147 ]; } ] call BIS_fnc_addScriptedEventHandler; in initplayerlocal.sqf to disable Load/Save button in VA but the function is still accessible via Ctrl+O
  19. Tory Xiao

    Help! Converting .paa to .png

    Did you make this tool? this tool saved tons of my time
  20. { if ((vehicleVarName _x) select [0,9] == "AirRepair") then { _mrkPos = getPosATL _x; _markerName = format["marker_repair_%1",_x]; deleteMarkerLocal _markerName; _marker = createMarkerLocal [_markerName, _mrkPos]; _markerName setMarkerShapeLocal "ICON"; _markerName setMarkerTypeLocal "loc_repair"; _markerName setMarkerColorLocal "ColorGreen"; _markerName setMarkerSizeLocal [1,1]; //_markerName setMarkerTextLocal "Repair Site"; }; } forEach entities "????"; Im trying to mark every trigger with the repair script with a repair marker, but what should I put after 'entities'?
  21. How do I get a positions array of several objects using copytoClipboard in the editor?
  22. Thanks! Another question, how do I get the position in 2D [x,y] format? getPos, getPosASL, getPosATL... all return 3D coordinates
  23. Im trying { if (!isPlayer _x) then { _npcPos = getPosATL _x; }; } forEach entities "car"; copyToClipboard _npcPos; But it returns nothing
×