Jump to content

Ed!

Member
  • Content Count

    95
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by Ed!

  1. Thank you for answering the question. Edit: I've searched. Found nothing. You have no motivation for your statement. Thus, I can't gain insight from your inputs.
  2. Ed!

    line of sight?

    lineIntersects won't detect all rocks, trees and fiolage. You can use terrainIntersectASL together with lineIntersects for that matter. I assume lineIntersects detects objects with cfg classes that are spawnable while terrainIntersectASL detects stuff related to the map itself which aren't spawnable.
  3. what if you avoid a loop and do something like this. [u]functionName[/u] = { _result = [] call fnc_IsAtBase; if(!_result) exitWith { }; if(_damage > 0) exitWith{ vehicle player setDamage (_damage - 0.1); _damage = damage vehicle player; [] spawn [u]functionName[/u]; //or call if you like }; if(_fuel < 1) exitWith{ vehicle player setFuel (_fuel + 0.1); __fuel = fuel vehicle player; [] spawn [u]functionName[/u]; //or call if you like }; // And more threads for ammo, color, and custom scripts }; [] spawn [u]functionName[/u];
  4. Some buildings like the hospital, ghost hotel and terminal have 3 objects that need to be placed next to each other to form the building as a whole. Is there a value in the cfgFile which indicates that the "house" is only partial?
  5. Since you are using BIS functions, it does not mean you will always get a guarenteed feasible result. For example some BIS functions return [0,0] when they fail while other link BIS_fnc_findSafePos returns the center of the map getArray(configFile >> "cfgWorlds" >> worldName >> "centerPosition"). You can compare the result of the functions to an expected answer. For example if you use BIS_fnc_findSafePos and it returned the center of the map, you know it failed. Edit: You can make a global array and store your script handles(asynchronous) in it. globalHandlesArray = []; _h = spawn xyz; globalHandlesArray pushBack _h; OR You can make a nested array and let the nested arrays be the children handles. [[handleParent,[[handleChild,[]],[handleChild,[]],[handleChild,[]]]], [handleParent,[handleChild,[[handleChildOfChild,[]]]]]]
  6. I see those commands are listed in a spotrep. If this is the case, what does the following do? (Obsolete?) pictureColor[] = {1,1,1,1}; pictureColorSelect[] = {1,1,1,1}; pictureColorDisabled[] = {1,1,1,1}; Will the updates be added to the wiki?
  7. I used this as a workaround for the same issue. But the selected data (cursel) go black again.
  8. I want to know for example: If there are 10 clients using a publicVariable at nearly the exact same time (close enough intervals such that all 10 broadcast within 1 server frame/tick). Is there a risk of the event handler not firing for some of these broadcasts then? I tested last night with a couple of players. When they broadcasted at the same time, it looked as if the event handler only triggered once. Would it be better to have a unique publicVariable for each client?
  9. Use bounding boxes and test wether the player's bounding box and the caltrops bounding box has intersected.
  10. Thanks KK, it's the kind of answer I was looking for.
  11. I will try using galzohar's suggestion with the players spamming publicVariables. But Im wondering now if 2 of the same EHs can run in parallel, that could also be an issue if for instance: The script inside the EH might take long enough to complete such that it can be fired again while not yet completed with the current running script. A ton of testing lies before me.
  12. I tested by letting people shoot each other and it would use a publicVariableServer upon death to increment the score of the killer. In the end the scoreboard had a score of 24 and the incremented variables had a value of 20. It seems to only have triggered once when 2 players shot each other at the same time.
  13. Since you are using caltrops then, you can also use nearObjects and check for the caltrops objects. If the players are closer than for instance 0.5m then you damage them. Im assuming you have an object for the caltrops.
  14. You need 4 parameters, not 5. Remove the true in the end (you misread the wiki and mistaked the return value for a parameter). And also it's a waste to have 2 of the same objects to be ignored. while {true} do { _pos1 = getposASL test_canteen; _pos2 = getposASL test_canteen; _pos2 set [2, (_pos2 select 2) + 0.2]; _intersect = lineIntersects [_pos1 , _pos2, test_canteen]; hintsilent format["_intersect: %1", _intersect]; sleep 1; }; And to add to above post: lineintersects works perfectly. I use it to determine Line Of Sight between objects. EDIT: I misread the post... You used lineIntersectsWith while {true} do { _pos1 = getposASL test_canteen; _pos2 = getposASL test_canteen; _pos2 set [2, (_pos2 select 2) + 0.2]; _intersect = lineIntersectsWith[_pos1 , _pos2, test_canteen, objNull, true]; hintsilent format["_intersect: %1", _intersect]; sleep 1; }; If you perhaps add a bit height to the first position it won't start on terrain level, which might affect your results - I'll need to test first to see if terrain triggers lineIntersectsWith since it already won't work under water. But if you can tell us what you want your script to do, we might have a better solution than this.
  15. It works when the positions and units are placed North/South from each other, but it doesn't when they are West/East from each other. It's something to do with those quadrants things I guess. Will fix it quick :P Edit: I updated that script now. Should work for all crazy angles now.
  16. Ed!

    Vehicle dimension

    I was wondering the same thing now. Worth the bump I would say. For example spawning a city using random houses from the cfgFiles. You want to generate a town, but you end up with a bunch of big buildings spawning inside each other while the toilets spawn all alone in the center of the milky way. Edit: Maybe move this to the Mission Editing & Scripting
  17. Based on the video above MEN = [man1, man2, man3, man4]; POSITIONS = [getPos pos1, getPos pos2, getPos pos3, getPos pos4]; _xTot = 0; _yTot = 0; { _xTot = _xTot + ((getPos _x) select 0); _yTot = _yTot + ((getPos _x) select 1); }foreach MEN; _avgMenPos = [_xTot / count(MEN), _yTot / count(MEN)]; _xTot = 0; _yTot = 0; { _xTot = _xTot + (_x select 0); _yTot = _yTot + (_x select 1); }foreach POSITIONS; _avgTargetPos = [_xTot / count(POSITIONS), _yTot / count(POSITIONS)]; _angle = ((_avgTargetPos select 0) - (_avgMenPos select 0)) atan2 ((_avgTargetPos select 1) - (_avgMenPos select 1)); _adjustedXMen = []; { _tmp = [(_avgMenPos select 0) - ((getPos _x) select 0), (_avgMenPos select 1) - ((getPos _x) select 1)]; _adjustedXMen pushBack [_x, ((_tmp select 0) * cos(_angle)) - ((_tmp select 1) * sin(_angle))]; }foreach MEN; _adjustedXTarget = []; { _tmp = [(_avgTargetPos select 0) - (_x select 0), (_avgTargetPos select 1) - (_x select 1)]; _adjustedXTarget pushBack [_x, ((_tmp select 0) * cos(_angle)) - ((_tmp select 1) * sin(_angle))]; }foreach POSITIONS; //sort by X for[{_o = 0},{_o < count(_adjustedXMen)},{_o = _o + 1}] do { for[{_i = 0},{_i < count(_adjustedXMen)},{_i = _i + 1}] do { if((_adjustedXMen select _o select 1) > (_adjustedXMen select _i select 1)) then { _a = _adjustedXMen select _o; _b = _adjustedXMen select _i; _adjustedXMen set [_o, _b]; _adjustedXMen set [_i, _a]; }; }; }; for[{_o = 0},{_o < count(_adjustedXTarget)},{_o = _o + 1}] do { for[{_i = 0},{_i < count(_adjustedXTarget)},{_i = _i + 1}] do { if((_adjustedXTarget select _o select 1) > (_adjustedXTarget select _i select 1)) then { _a = _adjustedXTarget select _o; _b = _adjustedXTarget select _i; _adjustedXTarget set [_o, _b]; _adjustedXTarget set [_i, _a]; }; }; }; LINES = []; { _pos1 = getPos (_x select 0); _pos1 set [2, 1]; _pos2 = (_adjustedXTarget select _foreachIndex) select 0; _pos2 set [2, 1]; LINES pushBack (call compile format["{drawLine3D [%1, %2, [1,0,1,1]];}", _pos1, _pos2]); }foreach _adjustedXMen; onEachFrame { { call _x; }foreach LINES; }; https://dl.dropboxusercontent.com/u/56725922/nolinecross.Stratis.rar http://i.imgur.com/cKV73ut.jpg
  18. I needed a function to replace a certain set of characters within a string. I found BIS_fnc_splitString and BIS_fnc_trimString etc. but not a replaceString. So I made it myself, but usually there is always somebody afterwards posting a simple 1 liner that does everything I tried in my 100 lines - and Im here asking for it. This is what I got strings_replace = { _string = _this select 0; _replace = _this select 1; _replaceWith = _this select 2; _strar = toArray (_string); _replaceAr = toArray (_replace); _replaceWithAr = toArray (_replaceWith); _newStrAr = []; for[{_i = 0}, {_i < count(_strar)}, {_i = _i + 1}] do { if((_strar select _i) == (_replaceAr select 0)) then { _match = true; for[{_k = 0}, {((_k + _i) < count(_strar)) && (_k < count(_replaceAr))}, {_k = _k + 1}] do { if((_strar select (_k + _i)) != (_replaceAr select _k)) then { _match = false; }; }; if(_match) then { for[{_j = 0}, {_j < count(_replaceWithAr)}, {_j = _j + 1}] do { _newStrAr = _newStrAr + [_replaceWithAr select _j]; }; _i = _i + count(_replaceAr) - 1; } else { _newStrAr = _newStrAr + [_strar select _i]; }; } else { _newStrAr = _newStrAr + [_strar select _i]; }; }; toString (_newStrAr); }; Or did somebody out there make a whole library of string manipulation functions for us to use?
  19. This is great, thanks!
  20. That's so much shorter than what I wasted my time on :P. Another question off topic now, what are the benefits when using private [...] in this particular example? It would work without the private [...] too? Is there some kind of performance gain or formality tied to it?
  21. If I knew how to get the player's field of view setting, then I could have done something more fancy. _testPos = getPos _testTarget; _playerPos = getPos player; _direction = ((_testPos select 0) - (_playerPos select 0)) atan2 ((_testPos select 1) - ((_playerPos select 1))); _dirDiff = _direction - (getDir player - 180); //atan2 returns -180 to 180, so need to make 360 dir to a -180 to 180 too if(180 - abs(_dirDiff) < 60) then //You can adjust this 60 to compensate for the player's field of view { hintsilent "Yes, Can see"; } else { hintsilent "No, Cannot see"; };
  22. Im not hosting this, but other people are. gungame.clanservers.com:2302 The onPlayerConnected is in my init.sqf line 19
  23. Good job, sir. 1 Suggestion to save more fps. Store all the loot you spawned in an array server side like this [[lootObject, timestamp], [lootObject, timestamp]] And then when you want to clean the loot, you loop through the array, looking mainly at the timestamps. Then you exit the loop when it finds the first array which didn't expire according to it's timestamp (since all following elements will be newer timestamps) So only for those elements which expired, you check the player distance etc. (I think it will shorten the loop by a great deal) A loop with allMissionObjects will run maybe like 1000 times, where a loop through an array as explained above will run only maybe like 50 times. There are many other ideas I have regarding the loot spawning to gain performance, but that will require a wiki on it's own. I will study your code over the weekend and come up with more suggestions. I can add you on steam later if you want to discuss.
  24. I have a mission where it works. onPlayerConnected "[_id, _name] execVM ""PlayerConnected.sqf"""; and then inside the PlayerConnected.sqf _id = _this select 0; _name = _this select 1; sleep 1; _id publicVariableClient "GAME_progress"; I remember how I struggled to get this to work, but it works. It comes from my gun game thingy (Im trying to make a gun game that is compatible with any weapon mod or map).
  25. In onPlayerConnected _this select 0 works with publicVariableClient ---------- Post added at 11:16 ---------- Previous post was at 11:12 ---------- Mistake again... _id, not _this select 0
×