Jump to content

Luft08

Member
  • Content Count

    197
  • Joined

  • Last visited

  • Medals

Everything posted by Luft08

  1. Thanks! That was it. I have a hard time finding the right ammo for each weapon. Now I need to find the smoke mortars.
  2. The BIS_fnc_findSafePos function takes the min and max distances as parameters. I have the values set at 350 and 750.
  3. Thanks, I'll give it a shot... Nope, No luck... 😞
  4. I'm writing multiplayer scenarios and wish to use a revive system that is included in Arma without any additional mods. However, after opening the "Attributes - MultiPlayer form and completing the revive section player's never bleed out but rather die instantly (just like there is no revive option selected.) I opened up the available player characters in the Eden Editor and under the "Object: Special States" section there is a "revive enabled" option that is greyed out so that it can not be selected. Any ideas to get this to work? Thanks.
  5. When people who know each other walk together in a casual setting they generally don't go single file or in some wing formation but rather just walk close together, side by side. I've tried putting two grouped AI into a line formation but they don't seem to want to cooperate. Has anyone got a solution to make AI civilians or really careless/relaxed soldiers walk in a more natural manner? Thanks
  6. I'm trying to debug my convoy code. I have placed a civilian on the map and named him "civ_1" and then try to move him to the random convoy starting position with this code: private _temp = []; // ---------------------Test, remove _temp = convoyPath select 0;// ------------------Test, remove // The following line prevents civ_1 from spawning high above the ground: private _civPos = [_temp select 0, _temp select 1, 0];// <<<-- This is the offending line. civ_1 setPos _civPos; // ------------------Test, remove However, when the code runs I get the error message: Error undefined variable in expression: _temp
  7. Thanks, I'll play around with it. How does it prevent the "double run" bug? I need to be able to get the path position array out. My code checks that a global variable is equal to [] (which it is in the beginning) and then doesn't overwrite it. Code with isNil added but untested: if(!isServer) exitWith {}; params["_startPos", "_endPos"]; if(convoyPath isEqualTo []) then { isNil {(calculatePath ["wheeled_APC","safe",_startPos,_endPos]) addEventHandler ["PathCalculated",{ { if((_forEachIndex mod 15 == 0) && drawPath) then { private _markerName = ("marker" + str _forEachIndex); private _marker = createMarker [_markerName, _x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorOrange"; }; convoyPath pushBack _x; } forEach (_this select 1); }]}; };
  8. Wow, how did I miss the big yellow caution box on the wiki? I'll rework my code. Thanks! 🙂
  9. Sorry, I gave incomplete info. convoyPath is an array of positions I get from: if(!isServer) exitWith {}; params["_startPos", "_endPos"]; if(convoyPath isEqualTo []) then { (calculatePath ["wheeled_APC","safe",_startPos,_endPos]) addEventHandler ["PathCalculated",{ { if((_forEachIndex mod 15 == 0) && drawPath) then { private _markerName = ("marker" + str _forEachIndex); private _marker = createMarker [_markerName, _x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorOrange"; }; convoyPath pushBack _x; } forEach (_this select 1); }]; }; The drawPath variable is a global boolean. (I would like to pass that boolean as a param but I can't get the code to acknowledge that it has been defined. Different problem...)
  10. The title says it all. I need to know what direction a vehicle will go when placed on a random road segment with a random road segment as a destination. I think calculatePath might be useful but I don't know how to use the "agent" after I get it.
  11. Any examples you can provide will be helpful. I modified and used the example provided on the wiki page. To plot the path of the convoy I execute my markPath.sqf code: if(!isServer) exitWith {}; params["_startPos", "_endPos"]; convoyPath = []; (calculatePath ["wheeled_APC","safe",_startPos,_endPos]) addEventHandler ["PathCalculated",{ { private _object = _x; if(_forEachIndex mod 15 == 0) then { private _marker = createMarker ["marker" + str _forEachIndex, _x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorOrange"; convoyPath pushBack _x; }; } forEach (_this select 1); }]; Here is the test code that calls markPath.sqf: // Mark likely convoy path private _handle = [_posStart, _posEnd] execVM ("LFT_Convoy\markPath.sqf"); waitUntil {scriptDone _handle}; private _point1 = convoyPath select 0; private _point2 = convoyPath select 1; // <<<<<<<<------ Throws a zero divisor error. if(isNil "_point1" ) then { hint "Nil"; // <<<<<<<<-------------- This hint shows up. } else { hint str _point1; }; I would be grateful for any examples of working code. Thanks.
  12. I wish to place a vehicle on a road and send it to a random road location far away. I can get the direction of the road via a function: getRoadDir = { params["_roadSeg"]; private _info = getRoadInfo _roadSeg; private _dir = (_info select 6) getDir (_info select 7); _dir }; My problem is that I need the vehicle to always immediately start moving toward its destination without an initial turn around. The "road direction" I want is either what is returned by the function or 180 degrees different and I don't know how to determine that.
  13. Well, thanks for your reply. Good Morning (where I am) 🙂
  14. My current convoy function looks like this: if(!isServer) exitWith {}; params["_leadVehicleType", "_endVehicleType", "_vehicleTypeArray", "_convoyStartPos", "_convoyEndPos", "_vehicleCount", "_startDir", "_side", "_maxLeadSpeed", "_vehicleSeparation", "_vehicleStorageArray"]; // create lead escort vehicle private _vehArray = [_convoyStartPos, _startDir, _leadVehicleType, _side] call BIS_fnc_spawnVehicle; _vehicleStorageArray pushBack _vehArray; private _veh = _vehArray select 0; private _leader = effectiveCommander _veh; private _group = _vehArray select 2; _group setFormation "COLUMN"; _veh limitSpeed _maxLeadSpeed; private _wp = _group addWaypoint [_convoyEndPos, 0]; _wp setWaypointBehaviour "SAFE"; _wp setWaypointType "MOVE"; // Create convoy vehicles for "_x" from 1 to _vehicleCount do { private _result = _veh distance _convoyStartPos > 20; sleep 10; private _vehType = selectRandom _vehicleTypeArray; private _vehArray = [_convoyStartPos, _startDir, _vehType, _side] call BIS_fnc_spawnVehicle; _vehicleStorageArray pushBack _vehArray; private _veh = _vehArray select 0; _veh limitSpeed _maxLeadSpeed + 5; {[_x] joinSilent _leader}forEach _vehArray # 1; }; sleep 10; _vehArray = [_convoyStartPos, _startDir, _endVehicleType, _side] call BIS_fnc_spawnVehicle; _vehicleStorageArray pushBack _vehArray; _veh = _vehArray select 0; _veh limitSpeed _maxLeadSpeed + 5; {[_x] joinSilent _leader}forEach _vehArray # 1; { private _veh = _x select 0; _veh setConvoySeparation _vehicleSeparation; } forEach _vehicleStorageArray; If you want to test it create a new mission using the Altis map and launch the convoy using something like: if(!isServer) exitWith {}; activeVehicleArray = []; private _vehicleTypeArray = ["B_Truck_01_ammo_F", "B_Truck_01_box_F", "B_Truck_01_fuel_F", "B_Truck_01_medical_F", "B_Truck_01_Repair_F", "B_Truck_01_covered_F"]; // private _startEscortType = "B_MRAP_01_gmg_F"; private _startEscortType = "B_APC_Wheeled_01_cannon_F"; private _endEscortType = "B_APC_Wheeled_01_cannon_F"; // private _endEscortType = "B_MRAP_01_gmg_F"; private _convoyStartPos = [3626.53,13169.2]; private _convoyEndPos = [14637.4,16771.7]; private _convoyVehicleCount = 8; private _convoyStartDir = 11.689; private _side = west; private _maxLeadSpeed = 15; private _vehicleSeparation = 90; [_startEscortType, _endEscortType, _vehicleTypeArray, _convoyStartPos, _convoyEndPos, _convoyVehicleCount, _convoyStartDir, _side, _maxLeadSpeed, _vehicleSeparation] execVM "launchConvoy.sqf"; I'm currently looking into the calculatePath function to determine which direction to point the vehicles. I think that would be a better way to go than waiting for each vehicle to turn around and move out of the way.
  15. Thanks for taking a look at this but wouldn't the AI controlled vehicle still turn around if say the road connected to the target segment curved around and went the opposite direction? What I'm doing is spawning a convoy one vehicle at a time at the same spawn spot and I need each vehicle to move out of the way before the next vehicle spawns and causes massive destruction. If a vehicle ever takes the time to turn around bad things happen. Since both the starting location and the ending location are random I can never be sure what the AI will do. I think there is some way to query Arma as to the AI path that will be taken but I don't know to get that information. I'm looking at the Bohemia "calculatePath" function but I don't understand how to use it.
  16. I'm making a mission using the GM assets. I want to simulate the cold war experience along the border. There are many guard towers and I have read that many of them were not manned but did have cardboard cutouts to fool people into thinking that they were. Is this true and if so, what percentage were empty? Does anyone know where I can get a picture of the cutouts? Also I know that there were landmines between the inner and outer fences. Can anyone point me to information that will allow me to place minefields in the proper places? Thanks.
  17. I have a group of friends that play my Arma missions. Some are jokers who will shoot the officer while he is giving the starting briefing. I have disabled damage on the officer so that the starting information (which changes from mission to mission) isn't stopped in the middle of the briefing. However, I would like to prepare a little surprise for the jokers. I have reduced the damage the officer will take by a LOT and when these jokers shoot him I want him to stop talking, pull his gun, say: "Oh, you think that's funny?" ,shoot the joker dead and say "Not laughing now are you chuckles!" I have everything working except I can't stop the officer from completing the say3D command. I read somewhere that you can attach a logic object and use the say3D command on that so that when you want the officer to stop talking you can delete the logic object. I can't seem to get this to work. I named the logic object and used that name in the say3D command but no sound. Can you use say3D with logic objects?
  18. Wow, that could make things a lot easier if I can figure out how to make it work when the say3D is wrapped in an remoteExec. Would it be as easy as: _voice = [captain,["Surprise",100, 1]] remoteExec["say3D"]; I'll try it and see. Thanks!
  19. I wrote a method that creates a convoy with a leading and trailing escort vehicle but depending on the trailing escort vehicle type it sometimes just sits there. init.sqf: if(!isServer) exitWith {}; activeVehicleArray = []; maxConvoyLeadSpeed = 15; private _vehicleTypeArray = ["O_Truck_03_device_F", "O_Truck_03_ammo_F", "O_Truck_03_fuel_F", "O_Truck_03_medical_F", "O_Truck_03_covered_F"]; private _startEscortType = "O_MRAP_02_hmg_F"; //private _endEscortType = "O_MRAP_02_F"; // <<<<<<< This works okay. private _endEscortType = "O_MRAP_02_hmg_F"; // <<<<<<< End vehicle just sits there. private _convoyStartPos = [26867.5,24474.3]; private _convoyEndPos = [25798.8,21449.1]; private _convoyVehicleCount = 3; private _convoyStartDir = 221.218; private _side = east; [_startEscortType, _endEscortType, _vehicleTypeArray, _convoyStartPos, _convoyEndPos, _convoyVehicleCount, _convoyStartDir, _side] execVM "launchConvoy.sqf"; launchConvoy.sqf: if(!isServer) exitWith {}; params["_leadVehicleType", "_endVehicleType", "_vehicleTypeArray", "_convoyStartPos", "_convoyEndPos", "_vehicleCount", "_startDir", "_side"]; // create lead escort vehicle private _vehArray = [_convoyStartPos, _startDir, _leadVehicleType, _side] call BIS_fnc_spawnVehicle; activeVehicleArray pushBack _vehArray; private _veh = _vehArray select 0; private _crewArray = _vehArray select 1; private _group = _vehArray select 2; private _leader = _crewArray select 0; _group setFormation "COLUMN"; _veh limitSpeed maxConvoyLeadSpeed; private _wp = _group addWaypoint [_convoyEndPos, 0]; _wp setWaypointBehaviour "SAFE"; _wp setWaypointType "MOVE"; // Create convoy vehicles for "_x" from 1 to _vehicleCount do { sleep 10; // Give time for current vehicle to get out of way before spawning next vehicle. private _vehType = selectRandom _vehicleTypeArray; // private _vehType = _vehicleTypeArray call BIS_fnc_selectRandom; _vehArray = [_convoyStartPos, _startDir, _vehType, _side] call BIS_fnc_spawnVehicle; activeVehicleArray pushBack _vehArray; _veh = _vehArray select 0; _veh limitSpeed maxConvoyLeadSpeed + 5; _crewArray = _vehArray select 1; private _vehLeader = _crewArray select 0; [_vehLeader] joinSilent _leader; }; sleep 10; _vehArray = [_convoyStartPos, _startDir, _endVehicleType, _side] call BIS_fnc_spawnVehicle; activeVehicleArray pushBack _vehArray; _veh = _vehArray select 0; _veh limitSpeed maxConvoyLeadSpeed + 5; _crewArray = _vehArray select 1; _vehLeader = _crewArray select 0; [_vehLeader] joinSilent _leader;
  20. My editor flags a problem with code like this: private _foo = []; myFunction = { _foo pushBack 1; }; It claims that _foo inside the function is not declared. This has got to be a scope problem. Even though all code is within the same sqf file the variables inside the function are not considered to be within the same scope. This kind of makes sense. Once declared myFunction can be called from anywhere can't it? Is their any way to get the function to use the outer _foo that is declared? Can an inline function take parameters? Thanks. To be more complete this is (more or less) what thinking about passing parameters: if(!isServer) exitWith {}; [true, ["seePriestTask"], ["Go talk to the Priest in Chernogorsk", "See Priest", "priestMarker"], priest_1, "ASSIGNED", 1, true, "mil_join", true] call BIS_fnc_taskCreate; _nearPriestArray = []; playerNearPriest = { params ["_nearPriestArray"]; private _return = false; { if ((_x distance priest_1) < 3) then { _nearPriestArray pushBack _x; _return = true; }; } forEach activePlayerArray; _return }; if (playerNearPriest) then { // Do stuff };
  21. I do have one question. How do you "match up" scopes that are in a different file? Is it something like counting the depth of the nesting? File 1: { // scope 1 _var_1 (Would having the "private" declaration not allow access in File 2, scope 2?) { // scope 2 code } } File 2: { // scope 1 (as in File 1) { // scope 2 (as in file 1) _var_1 from file 1 is visible here. } }
  22. Thanks Larrow, You have been incredibly helpful!
  23. LOL! That sounds like something I would do! 😁 Just tested this and it works!! Thanks!
  24. Ah-Hah!! This I did not know! I will try giving the gunner the waypoint. BTW did you really mean the gunner rather than the commander or driver? It will be interesting to see if the trailing vehicle stays in formation. oops... I just remembered that the addwaypoint command takes a group name. Once the vehicle is added to the convoy wouldn't the group be the same as the original waypoint assignment? So I'm not sure how to add a waypoint to the gunner specifically. Thanks.
  25. Thanks pierremgi, I'll look at your suggestions. I started with the sleep command set to 5 seconds and vehicles started blowing up if the spawned vehicle didn't start moving right away. Maybe I was doing something wrong. The reason I spawn one vehicle at a time and start it moving is pure laziness. 🙂 This was the first solution that worked (not counting the trailing escort vehicle). Thanks again for your suggestions. I didn't even know about setConvoySeparation. (So much to learn...)
×