Jump to content

panther42

Member
  • Content Count

    712
  • Joined

  • Last visited

  • Medals

Community Reputation

16 Good

6 Followers

About panther42

  1. interesting, as the code I use, I would expect the global array to be overwritten by only the two points then? see the mission I posted in a previous post. Perhaps I'm missing something? I have markers and diag_log inserted to verify route positions of the array.
  2. 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.
  3. Just in case, here is a link to a quick test mission I put together. p42_calculatePath It's set up for player to ride along. Edit as you wish. View the map to see route positions. Change "end" marker to a different location, etc.
  4. @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.
  5. 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.
  6. 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.
  7. 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.
  8. I suggest you read the previous tutorials I posted, and here's another: Private Special Variables These will help you understand what you inquire about. Much better to understand why things work the way they do, than to say "because person x told me so". The old proverb "Give a man a fish, and you feed him for a day. Teach a man to fish, and you feed him for a lifetime."
  9. 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
  10. @killzone_kid also has a tutorial on variables (three parts) & scopes. In fact, if you have not visited his site, he has a lot of great information available.
  11. panther42

    Strange Error in .rpt file

    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): 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"
  12. I used Mando Chute (with a bit of editing) in A2 with great success. I'm sure it would work just as well in A3. Script could be updated for newer commands, but you can build off of the idea.
  13. do NOT use createVehicle for units... You could use createVehicleCrew, or BIS_fnc_spawnVehicle, with same. Alternate: createUnit
  14. panther42

    Array Find Question

    No need to re-invent the wheel. If using CBA 3, fnc_hashCreate. Allows for default value.
  15. I think there's some issues if you're using sqs, instead of sqf: The control structures listed in the article Control Structures may also be used in SQS syntax. Note that they must be written within a single line... So, if you are using an sqs script to call the sqf script via ExecVM, try following the rules for sqs posted here
×