Jump to content

panther42

Member
  • Content Count

    774
  • Joined

  • Last visited

  • Medals

Posts posted by panther42


  1. 1 hour ago, Robustcolor said:

     

    I''ve been using the top one but as you said it could cause some error or nothing at all if variable is not set before when checking if the variable is true or false.

     

    _veh setVariable ["RWPoint",true];

    Since many vehicles don't have this variable i just want to check if a specific vehicle has the variable and that it's true.

     

    Is this good or bad practice to check if the variable is true or false?

    if (_veh getVariable ["RWPoint",false] == true) then {};

     

    or is it enough to check it like this

    if (_veh getVariable ["RWPoint",false]) then {}; but that will add a variable to it with false, Unnecessary?

    All you need is the second example you gave.  First one is redundant in the fact you are checking if(true) then {something}.  No need for == true. 

    Also, you are NOT adding that variable to the _veh as you state.  You are ONLY giving a default answer if the _veh does NOT have the variable assigned via setVariable.  I.E. the returned value for if() is false.  Code will not run unless you if !().

    • Like 1

  2. I happen to have downloaded this, back when it was available, but never used it.

    After looking through the scripts quickly, with a program like FileLocator Lite (free)/Pro, you will find the function "fnc_RemoveWayPoints", and it being called in several other scripts.

    Specifically, this function is called multiple times from "fnc_GAIA_Issue orders".

    Not certain if your group was handed off to GAIA from the outset?

    This is just a quick look to give you a starting point at least.  Again, I've never used this, but any help is better than none.

     


  3. Can you explain exactly how/where you are setting Trigger5_Con & Trigger9_Con to boolean (true/false)?  Within Trigger5 & Trigger9 On Activation?

     

    I suppose another option would be using triggerActivated.  No need for the other variables.  See the note for triggerActivated on the page linked.

    ((triggerActivated Trigger5 || triggerActivated Trigger9) && ["Tsk"] call BIS_fnc_taskState == "SUCCEEDED")

     

    Not tested myself, but without knowing where this boolean statement above is being checked.  I.E. if () then {} statement?

    • Like 1
    • Thanks 1

  4. On 11/24/2020 at 11:58 AM, madrussian said:

     

    Roger all that.  Sounds like to get AI-only transport working (for personal use, etc), likely all the parts are within Hermes code, I'd just need to... (re)assemble them.  Plus you guys have no doubt overcome many obstacles making this all this work.  I recall encountering many gotchas trying get helis transporting AIs & player in A2, so again I greatly appreciate your efforts here!  OK, before I dive in and try to re-cobble Hermes to perform player-less AI-only transport... curious @Rydygier do you or anyone know of a good A3 AI-only helicopter transport script, that requires no player interaction?

    Sorry for the multiple posts.  Seems as though I had misinterpreted @madrussian previous posts.

    This seems like some sort of ambient combat request for reinforcements sent via AI due to trigger/scripting.  Although, I'm not certain, as he/she states "encountering many gotchas trying get helis transporting AIs & player in A2".

     


  5. One script/mod I know which worked quite well back in the day was the Medevac Module by @goliath86.

    This was all AI coming to your aid, etc.

    If you dig into the code of this, you can use/change to your needs, of course, giving credits to @goliath86.

    Don't be fooled by the sqs code, as you can read a bit here: KillzoneKid.

     

    sorry, I was replying to @madrussian comments about AI transport.  I may have missed the issue...

    @Gunter Severloh & @Rydygier, I commend your work, although I'm not a "place this module in mission" type of guy.

    Thumbs up on both of your work.

    • Like 1

  6. 1 hour ago, Luft08 said:

    Thanks, I'll play around with it. How does it prevent the "double run" bug?

     

    I do not believe I ever had issues with the "double run" bug for the event handler. 

    Perhaps the code was updated, or wiki not updated once fixed? 

    There may be certain instances when this happens, but I have not ran across in the testing I have done.

    It would be easy to identify, as the wiki states there are only two elements returned, which are both the end point.


  7. @Luft08, I haven't done testing without the isNil check for adding the PathCalculated event handler to calculatePath, but I've noticed you do not use it. 

    In the examples given previously by myself and @pierremgiin another thread, we both did.

    Not sure if this could be messing up your convoyPath array, but the wiki does state this in the big yellow caution box at the top of calculatePath page.

     

    Also, just to point out, convoyPath may be overwritten if the code is run in a loop.  I.E. first run convoyPath count is 0, next iteration it is > 0.  This would mean your statement "if(convoyPath isEqualTo []) then {...}" runs only once.

    This depends on where you declare convoyPath = [] in relation to the entire code/scope.  If this is intent, disregard.

    • Like 1
    • Thanks 1

  8. There are other methods to path finding available, if interested.  These are based on shortest road routes from point A to point B.

    I believe I still have some test missions for code34's OO_Pathfinding, Spiderswine's Navigation System featuring Dijkstra-Algorithm, and Rube's RUBE_findRoute & RUBE_plotRoute

    Rube convoy also.  Note, with the Rube stuff, I've updated code, and removed folders/code which is not used.

    • Like 2

  9. This is part of the code which I used for testing.  I was using this to send cars driving back/forth from distant neighbor locations.  Very similar to what you are working on.  You can tweak to your variables, etc.

    Convoys are another animal, depending on if you set vehicles in the convoy along the route start position via your scripts also.  I used to use one of Rube's convoy route scripts for all of it.

     

    Don't believe I had any issues with the Problem(s) listed in calculatePath:

    For some unknown reason, the "PathCalculated" Event Handler is fired twice, first with calculated path and second with array consisting of 2 elements, which are identical and are equal to the end point. See Example 3 & 4 for a workaround.

     

    Spoiler
    
    romTest = [];
    
    isNil {(calculatePath ["car","safe",_startPos,_destPos]) addEventHandler ["PathCalculated", 
    {					
    	romTest = _this select 1;
    }]};
    waitUntil {count romTest > 0};
    
    private _romTemp = + romTest;
    
    //diag_log format ["_romTemp: %1",_romTemp];
    
    
    	[_vehX, _romTemp] spawn
    	{
    		params ["_vehX", "_rom"];
    		private _route = + _rom;
    		/*
    		private _color = selectRandom ["ColorGrey", "ColorBlue", "ColorYellow", "ColorRed", "ColorWhite", "ColorOrange"];
    		{
    			private _marker1 = createMarker [format["%1_wp_%2", _vehx,_forEachIndex], _x];
    			_marker1 setMarkerShape "ICON";
    			_marker1 setMarkerType "mil_dot";
    			_marker1 setmarkerbrush "Solid";
    			_marker1 setmarkercolor _color;
    			_marker1 setmarkersize [0.5,0.5];
    			_marker1 setmarkertext format["%1_wp_%2", _vehx, _forEachIndex];
    		} forEach _route;
    		*/
    		{_x pushBack 15} forEach _route;  //set speed
    			
    		while {canMove _vehX && {alive (driver _vehX)} && {fuel _vehX > 0}} do
    		{
    			_vehX setDriveOnPath _route;
    			private _lastROM = [((_route select ((count _route) - 1)) select 0), ((_route select ((count _route) - 1)) select 1), 0];
    							
    			waitUntil
    			{
    				if (_vehX distance2D _lastROM < 100 && {speed _vehX < 5}) exitWith {true};
    				false
    			};
    							
    			sleep 1;
    			reverse _route;
    			sleep 1;
    		};
    		
    		{doGetOut _x} forEach (crew _vehP);						
    		(crew _vehP) orderGetIn false;
    		(crew _vehP) allowGetIn false;
    	};				

     

     

     

    • Like 2

  10. You can use calculatePath to return an array of positions via the PathCalculated Event Handler.

    Once you have an array of positions, you can find the direction from array select 0 to array select 1, etc.  "I need to know what direction a vehicle will go..."

    I have used this in testing for ambient civilians, driving back/forth from town to town, in conjunction with setDriveOnPath.

     

    I can dig up some code from a test mission if you would like.

    • Like 2

  11. If I'm reading yours correctly, you are overwriting _return each time it runs through forEach _array;
    You want to "add to" the existing, not overwrite, to keep array of all.

    Couple of points:

    @pierremgi script _logic = _logics select _forEachIndex; could also be just _logic = _x

    _return pushBack [_townArray,_miscArray]; could be _return pushBack [_x,_townArray,_miscArray]; to save reference to logic for the  _townArray & _miscArray

    • Like 2

  12. I looked back at my logs, and seems to be related to the installation of Pythia, or a coincidence of when I started running it.

    Do you use 7erra's Editing Extensions, which requires Pythia?
    Do you have the following lines listed below the destroyed lines (Not pasting all):

    Spoiler
    
    22:32:11 Class EventHandlers destroyed with lock count 2
    22:32:11 Class CBA_Extended_EventHandlers destroyed with lock count 2
    22:32:11 Class CBA_NamespaceDummy destroyed with lock count 1
    22:32:11 Class CBA_Extended_EventHandlers_base destroyed with lock count 3
    22:32:12 Extensions:
    22:32:12   Pythia (E:\Program Files\steamapps\common\Arma 3\!Workshop\@Pythia\Pythia_x64.dll) [0.9.0.dev]
    
    22:32:12   PythiaSetPythonPath (E:\Program Files\steamapps\common\Arma 3\!Workshop\@Pythia\PythiaSetPythonPath_x64.dll) [0.9.0.dev]

     

    Otherwise, you can start disabling mod-by-mod to see when the writing to the log stops for the "destroyed with lock count".

     

    It must be CBA. I removed everything but CBA, and still received the messages.
    Without CBA, just base game... nothing related to "destroyed with lock count"

×