Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Everything posted by MrGamer100

  1. Hey there! I've begun learning SQF scripting around a week ago, so still quite the newbie. I've been reading through the Fockers tutorial series (which I have yet to finish), and decided to try and get some practical experience making something, since that's the best way I learn code. My friend, who makes missions and does zeus stuff, suggested I make a patrol script. I liked the idea, and went along with trying to make a patrol script callable by execVM, accepting the calling unit and an array of Markers as parameters. The script works by sending the entire group to those markers assuming the group still exists and there's at least one unit alive in it. If the marker they are about to head to does not exist, the marker is deleted from the array and the loop starts from the beginning until a valid marker exists. Irrelevant at this point as I can't test to make sure that actually works, since I can't seem to get an object param passed to the file. It looks like it only accepts arrays, which I am having trouble understanding. So I need to solve this one of two ways: I need to find a way to pass an object as a parameter and keep it intact when it reaches the function. Or, I need to find a way to take the array sent as the unit, and turn it back in to the object, which I don't know how to do. This script is meant to be multiplayer friendly (despite me not having the slightest clue of how to code it for multiplayer) so please keep that in mind with the solution. My goal is not to just come to a solution to fix my issue, but to understand why it works, since I'm trying to learn SQF and understanding what the code is doing and why will help me advance in that goal. I appreciate the help and can try to give as much information as I can when asked. This is in the team leader's init box: patrolArray = [patrolMarker1, patrolMarker2, patrolMarker3]; PatrolScriptHandle = [this, patrolArray] execVM "Patrol.sqf"; This is the Patrol.sqf: // Patrol.sqf // Parameters: // 0: (Object) Unit // 1: (Array) Markers params ["_unitObject", "_markerArray"]; debugPatrolRunning = True; // Use this only for debug purposes to see if the script is still running. _unitMarkerPatrolArray = _this select 1; _patrolArrayCount = (count _unitMarkerPatrolArray) - 1; _unitGroup = group _this select 0; _shouldRun = True; while (_shouldRun) do { scopeName "patrolCheck"; sleep 0.1; for "_i" from 0 to _patrolArrayCount do { _unitsAlive = {alive _x} count units _unitGroup; _curMarkerSelection = _unitMarkerPatrolArray select _i; if ( isNull _curMarkerSelection ) then { _tempA = [_curMarkerSelection]; _unitMarkerPatrolArray = _unitMarkerPatrolArray - _tempA; _tempA = nil; breakTo "patrolCheck"; }; if ( _unitsAlive >= 1 && {!isNull _unitGroup} ) then { // I don't think I can use the Marker object itself in getMarkerPos, so let's convert it to string first. _curMarker = format ["%1", _curMarkerSelection]; _unitGroup move getMarkerPos _curMarker; sleep random [3, 5, 10]; } else { _shouldRun = False; debugPatrolRunning = False; breakOut "patrolCheck"; }; }; };
  2. I don't know if you'll still get this message, but I have looked through the code you have contributed and I have learned quite a bit. I did have one more question having to do with your code... looking in to how Waypoints worked on the wiki to understand your code (especially the Waypoint datatype itself), a default waypoint at the group's starting position is always created at index 0. When you go through the waypoints at the end to delete them, does it delete this default waypoint too? If it does, does it ever return? Is it even deletable? The reason I ask is because of this line: waitUntil {sleep 1; currentWaypoint _unitGroup == count patrolArray}; If the deleteWaypoint loop were to delete the default waypoint, the line would need to be changed to count patrolArray - 1 to make sure there is no OOB error if I did my homework on this properly. The script still seemed to be working on the next iterations, but I want to make sure I have a straight answer to this question. I've learned a good amount about waypoints thanks to your code and following up with the wiki on it. I was not able to find an answer to the questions I have just asked however. Thank you once again and I hope I can get an answer on this!
  3. How would I make them public? Is there an article or specific resource I can read in to that will tell me more about the nuances and specifics of multiplayer scripting and how to synchronize things, what to synchronize, when to synchronize and such? It feels like one of the single most important things I should really learn, and I just haven't found as specific of information about it on the wiki so far. I can't believe I didn't think of just making the array quotes instead of references to the actual marker objects. That would have saved me the process of converting, I wasn't thinking right on that one. Thank you for pointing that out! So basically a global variable is fully accessible in the entire mission by any script, and any machine including the server can also access it? Will that allow me to pass an object to the SQF file? I insist on doing this through an SQF file instead of a pure Init line, even if it will be harder. My reasoning is that I want to make an SQF file that any mission maker could just stick in the mission layout folder and call with only a few parameters in order to use its functionality (encapsulation). I want to try avoiding doing it on an Init line and making the mission maker have to do more work and assurances, but maybe I'm just not that good yet. I did play around with the idea of trying to create a logic module through Eden and maybe finding a way to use it as storage for objects, and then have the SQF file reference the object through the module instead? I make things more complicated than they should be, but it's because I'm always trying to figure out how to make my code more efficient, better, and robust, even if I'm nowhere near the level of proficiency in the language to be even trying to do that. So since it would be just one param, there's no reason to treat it as an array right? That is why select is no longer needed, because it's only one param being sent. I thought I read on the wiki for the param command that it counts single elements as a single element array though? Do Eden Init boxes not properly parse line comments? Will the "comment" command still work fine as it's an actual command to signify a comment? That is so much more efficient, I didn't even know a group counted as an Eden object to edit. I've learned something new, thank you! Do you think this object could somehow be stored in a logic module for reference by an SQF file? Using an 'if' condition to check if isServer is true hm? Will this solution work to multiplayer-proof pretty much any code? Does it get more complicated than that as far as writing multiplayer-ready code goes? Half of that code is a bit over my head I have to admit. I never thought you could add waypoints to a group and use that to make them travel to an area. I really want to try and avoid doing it all in an init box because I want to encapsulate my code to be used in other missions with relative ease as long as mission creators would have the knowledge necessary to know how to use the script (necessary markers and parameters). For my particular code I don't want it to delete the markers as it goes along it (perhaps an option I could put in later somehow), only check if the marker still exists just in case. I'll have to take some time to look at this code and understand it, definitely the waypoints portion. I should probably also continue in the Focker's scripting series as it might even answer some of my other questions above. Thank you for contributing this code, it's given me a whole new insight on how to approach my problem. I only ask so many questions because I want to understand this. I hope you are not annoyed by my questions, it is my eagerness for knowing and understanding this language, in an attempt to make better scripts. I appreciate you answering this and I hope to press for more answers so that I can understand. Thank you for your patience and your help, a lot of times I feel like I'm alone in trying to figure out these problems and why they are happening with my code. It's good to be able to put this code up for a sort of peer review and gather even more information about how to improve it and get it to work.
  4. MrGamer100

    Task Force Arrowhead Radio

    It's a requirement of the unit to also change name to your real last name, or one you make up. So it's not just the tags, we also really do have to change the name. Will this method work for the name as well?
  5. MrGamer100

    Task Force Arrowhead Radio

    There's been an issue that's 50/50 on the reproduction rate, some of the guys in our unit make a new profile in ARMA 3 that isn't the default so that we can get their names changed to match our unit. This has broken TFR for some of those members that made a new profile, and they have to go back to their default profile for TFR to work properly. We've thought it was userconfig doing it, but taking a look at it doesn't seem to be the reason why it happens. Any ideas for fixing this? We really need our guys wearing the right name and tags.
  6. MrGamer100

    Task Force Arrowhead Radio

    So a friend of mine is having an odd issue that none of us have. He has the Teamspeak plugin and it's enabled, the mod is enabled and launched, and we're all in game. All of us talk and have voice proximities (this is without the radio), he talks and it doesn't show that he is talking in-game. His mouth doesn't move, nothing, it's all through Teamspeak like it was not launched, so we hear him no matter how far he is. He has the latest version of the Teamspeak plugin and the game mod, as well as CBA. Any ideas as to troubleshooting methods we can try, or even the solution itself if this has already been solved?