Jump to content

_Mofo_

Member
  • Content Count

    59
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About _Mofo_

  • Rank
    Lance Corporal
  1. Not sure how you structured your files... but is the init.sqf loaded behind an "isDedicated" or "!isDedicated" of some sort? Also, I briefly recoded your function from the first page in my previous response as *thought* it had a few places with potential flaws in it. One other thing... do you have "-showScriptErrors" as a startup param and do you get any errors at all? Sorry to question so much... but we are flying kinda blind here and it's already hard enough trying to debug and especially when it's shots in the dark. But I do know that SHK_pos works on dedi as I've used it in MP missions and it seems to work as intended.
  2. Just curiosity here... how are you loading SHK_pos? --- private["_exclude_1","_exclude_2","_marker_center"]; // Cache your vars that won't change but are being will be referenced multiple times _exclude_1 = getMarkerPos "exclude_1"; _exclude_2 = getMarkerPos "exclude_2"; _marker_center = getMarkerPos "center"; { _checking = false; while {!_checking} do { _pos = [_marker_center, random 10000, random 359, false, [1, 5000]] call SHK_pos; if ((_pos distance _exclude_1 > 1500) && (_pos distance _exclude_2 > 500)) then { _checking = true}; }; }; _x setPos _pos; //DEBUG MARKERS _name = str(_x) + str(random 100); _marker = createMarker [_name, (getPos _x)]; _marker setMarkerShape "ICON"; _marker setMarkerType "DOT"; } forEach _array;
  3. Sounds like this "may" be a wasteland type mission. If so, look for "config.sqf" and the arrays contained therein. You need to look through the files the comprise the mission (w/e the mission is) and search out the variables that hold the information you want to edit to your liking. Just a tip.
  4. My home test server is working again... not sure if all is well in the world???
  5. If you want to give this a test... I found some information in another thread about adding an option to the startup parameters that "might" help... but I don't have anyone to test ATM and I'm at work. In TA2DST on the "Server Details" tab, put this in the "Parameters" line OTHERPARAMS='-ip=XX.XXX.XXX.XXX' replacing the X's with your WAN ip. Please let us know if it works. If no one has reported back by the time I get home this evening, I'll test it to verify. Reference post -------------- Edit... No need for a fix... users connected with & without the posted "fix". Seems things are back to normal? The world may never know.....
  6. Where did you hear this and is there a fix for it? I am having the exact same problem since today testing a mission I'm working on. I can connect... no one else can. Was working perfectly yesterday.
  7. I'm still learning FSM's myself, but I'm grasping them more and more as time passes. Main things to understand about FSM & debugging... writing "in" the FSM then executing the code makes it somewhat difficult to track bugs AND you can only "ctrl + z" back one time. /:| What I "typically" do when writing a block of code to execute is attach cheat engine to OA and set it up so that I can execute my test script... then write code (in a sqf) and execute it in game to more or less have a working live debugger. Once the code is good... then it goes to the appropriate place in the FSM.
  8. See above edit... The weapons your trying to add are for a different type of vehicle. I don't believe it's going to work the way you're thinking it will.
  9. when you say "menu"... what do you mean? Sorry... bad code... last part should be addWeaponCargoGlobal not addweapon Try this... // Create the vehicle _AN21 = createVehicle ["An2_1_TK_CIV_EP1", position player, [], 0, "NONE"]; // Clear it's cargo clearMagazineCargoGlobal _AN21; clearWeaponCargoGlobal _AN21; // Add the mags _AN21 addMagazineCargoGlobal ["2000Rnd_23mm_AZP85",4]; _AN21 addMagazineCargoGlobal ["12Rnd_Vikhr_KA50",1]; _AN21 addmagazineCargoGlobal ["60Rnd_CMFlareMagazine",1]; // Add the weapons _AN21 addWeaponCargoGlobal ["CMFlareLauncher",1]; _AN21 addWeaponCargoGlobal ["VikhrLauncher",1]; Also forgot another useful thing for you to use... Add "-showscripterrors" to your link properties. ;) ----------- Edit... on a side note... are you trying to do some sort of MadMax type thing with the biplane?
  10. Might I also suggest learning more about arrays as well as loops. It will help you TONS with repeating commands. You will also want to bookmark the bwiki to learn more about the functions and how to use them. https://community.bistudio.com/wiki/Main_Page // Create the vehicle _AN21 = createVehicle ["An2_1_TK_CIV_EP1", position player, [], 0, "NONE"]; // Clear it's cargo clearMagazineCargoGlobal _AN21; clearWeaponCargoGlobal _AN21; // Add the mags _AN21 addMagazineCargoGlobal ["2000Rnd_23mm_AZP85",4]; _AN21 addMagazineCargoGlobal ["12Rnd_Vikhr_KA50",1]; _AN21 addmagazineCargoGlobal ["60Rnd_CMFlareMagazine",1]; // Add the weapons _AN21 addweapon ["CMFlareLauncher",1]; _AN21 addWeapon ["VikhrLauncher",1]; P.s... I've only been coding for about 1 month. n00b to n00b. ;) P.s.s. This code keeps AN21 "local" to the script. I'm not sure why you wanted it global but if its for testing purposes... no need to make it global.
  11. _car = createVehicle [_cartype,_pos,[], _rad,"None"]; clearMagazineCargoGlobal _car; clearWeaponCargoGlobal _car; _car addMagazineCargoGlobal [_mag,(random 4)]; _car addWeaponCargoGlobal [_weapon,1]; It helps to see your code if we are to help with your specific case. In this example, I've left my variable names in there so you get the idea of where stuff goes. *Mine is MP... hence the Global
  12. FSM would work nicely for you here. Set a timestamp in your init code.. then in your condition check that { current time >= (60 minutes + timestamp) } Execute your FSM last in your server init.sqf
  13. Guess I shouldn't stay on the page editing as I go so I can see replys. ;-) Thank you again for your help with this... I'm sure it will be VERY useful for the community to have this function.
  14. I won't be using nil in the array at all... give me a few mins to process this new information and try again to implement it. BTW... your brain must hurt every night if this is the sort of stuff you think about during the day. ;) Also... they "must" match "in order" according to position within the nest? So that... [1,2,3] vs. [1,3,2] = false (not matched) This code takes care of that correct? for "_i" from 0 to (count _arrayA - 1) do { _elemA = _objectA select _i; _elemB = _objectB select _i; //Process recursively if (not ([_elemA, _elemB] call FancyIsEqual)) exitWith {_result = false;}; }; ---------- Further testing... FancyIsEqual = { private ["_objectA","_objectB","_result","_elemB","_elemB"]; _objectA = _this select 0; _objectB = _this select 1; //Do they have the same type? if (typeName _objectA != typeName _objectB) exitWith {false}; //Are they values? if (typeName _objectA != typeName []) exitWith {_objectA == _objectB}; //It must be arrays. Do they have same length? if (count _objectA != count _objectB) exitWith {false}; //Process each element; assume true _result = true; for "_i" from 0 to (count _objectA - 1) do { _elemA = _objectA select _i; _elemB = _objectB select _i; //Process recursively if (not ([_elemA, _elemB] call FancyIsEqual)) exitWith {_result = false;}; }; _result }; RemoveDuplicates = { private ["_array", "_unduplicated", "_original","_exists"]; _array = _this; _unduplicated = []; { _original = _x; _exists = false; { if (not ([_original, _x] call FancyIsEqual)) exitWith { _exists = true; }; } forEach _unduplicated; if (not _exists) then { _unduplicated set [count _unduplicated, _original]; }; } forEach _array; _unduplicated }; This code now outputs the array with MATCHING elements. Also, I changed one error in the code to what I believed it should be. // Setup test array _test = [[1,2,3],[1,2,3],[4,5,6]]; // call remove duplicates _some = _test call RemoveDuplicates; RETURNS: [ [1,2,3], [1,2,3] ] for "_i" from 0 to (count _arrayA - 1) do { should actually be... back to further debugging I go to try and trace the problem. ----------- Final edit (for now)... changing this line if (not ([_original, _x] call FancyIsEqual)) exitWith { to... if ([_original, _x] call FancyIsEqual) exitWith { Works for the first test... going to stress test it now to see what breaks it. ---------------------------------------------- Working code to remove duplicate entries in arrays by MuzzleFlash: FancyIsEqual = { private ["_objectA","_objectB","_result","_elemB","_elemB"]; _objectA = _this select 0; _objectB = _this select 1; //Do they have the same type? if (typeName _objectA != typeName _objectB) exitWith {false}; //Are they values? if (typeName _objectA != typeName []) exitWith {_objectA == _objectB}; //It must be arrays. Do they have same length? if (count _objectA != count _objectB) exitWith {false}; //Process each element; assume true _result = true; for "_i" from 0 to (count _objectA - 1) do { _elemA = _objectA select _i; _elemB = _objectB select _i; //Process recursively if (not ([_elemA, _elemB] call FancyIsEqual)) exitWith {_result = false;}; }; _result }; RemoveDuplicates = { private ["_array", "_unduplicated", "_original","_exists"]; _array = _this; _unduplicated = []; { _original = _x; _exists = false; { if ([_original, _x] call FancyIsEqual) exitWith { _exists = true; }; } forEach _unduplicated; if (not _exists) then { _unduplicated set [count _unduplicated, _original]; }; } forEach _array; _unduplicated }; // Test arrays used _test = [[1,2,3],[1,2,3],[4,5,6],[7,8,9],[1,2,3],["a","b","c"],[4,5,6],["a","b","c"],[132.2,123.4,532.6],[132.2,123.4,532.6]]; _test = [1,1,2,2,"a","a","c","c",2.1,2.1]; // Used to output results _unDupe = []; _unDupe = _test call RemoveDuplicates; hint format["%1",_unDupe]; ------ Thank you MuzzleFlash for your efforts!!
  15. Thank you for the time and I'll be more than happy to check for errors while testing and correct as needed. I really do appreciate it your time!!! Will report back shortly. ------ Also, in trying to understand your logic and the way you are checking the arrays... when you say... "For array they are if they have the same length and same content:"... I'm assuming you mean that the entirety of the content must be the same... correct? I.e. _a1 = [[1,2,3],[2,3,4],[1,2,3]]; the Unduped array would be built using the entirely of the nested array content and not just the individual elements themselves _unDupe = [[1,2,3],[2,3,4]]; Sorry to question... but I'm really struggling to wrap my head around checking nested arrays for dupes. ------ First test: FancyIsEqual = { private ["_objectA","_objectB","_result","_elemB","_elemB"]; _objectA = _this select 0; _objectB = _this select 1; //Do they have the same type? if (typeName _objectA != typeName _objectB) exitWith {false}; //Are they values? if (typeName _objectA != typeName []) exitWith {_objectA == _objectB}; //It must be arrays. Do they have same length? if (count _objectA != count _objectB) exitWith {false}; //Process each element; assume true _result = true; for "_i" from 0 to (count _arrayA - 1) do { _elemA = _objectA select _i; _elemB = _objectB select _i; //Process recursively if (not ([_elemA, _elemB] call FancyIsEqual)) exitWith {_result = false;}; }; _result }; RemoveDuplicates = { private ["_array", "_unduplicated", "_original"]; _array = _this; _unduplicated = []; { _original = _x; { if (not ([_original, _x] call FancyIsEqual)) exitWith { _unduplicated set [count _unduplicated, _original]; }; } forEach _unduplicated; } forEach _array; hint format["%1",_unduplicated]; // hinting out the array after all runs }; // Setup test array _test = [[1,2,3],[1,2,3],[4,5,6]]; // call remove duplicates _test call RemoveDuplicates; This returns a blank array in the hint. Wouldn't the check fail on every run since "_unduplicated" will return "any" or "nil" for the first run? Since the array is empty to begin with... if (typeName _objectA != typeName _objectB) exitWith {false}; Would always return false? Maybe count _unduplicated array and if 0 store the first value no matter what since the array is empty?
×