Jump to content

Ed!

Member
  • Content Count

    95
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by Ed!


  1.  

    here's a shitty hack that might get you somewhere. not taken care of shooting but only aiming so far.

    A very good idea.

     

    I changed it a bit so you don't need the target.

     

    The next stumbling block is using the camera of the agent in the gunner seat. Aiming via the vehicle optics would be epic.

     

    Here is what I did:

    testcar addEventHandler ["GetIn", {_this execVM "carin.sqf";}];
    
    ///////////////////////////
    //carin.sqf
    
    params ["_vehicle", "_position", "_unit", "_turret"];
    
    handleClick = {
    _handled = false; 
    if(_this select 1 == 0) then {
    	vehicle player action ["UseWeapon", vehicle player, gunner vehicle player, 0]; 
    	_handled = true;
    }; 
    _handled;
    };
    
    if (driver _vehicle == player) then
    {
    	(findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call handleClick;"];
    	(findDisplay 46) displayAddEventHandler ["MouseButtonDown", ""];
    
    	DummyGunner = createAgent [typeof player, [0,0,0], [], 0, "FORM"]; 
    
    	DummyGunner moveingunner _vehicle; 
    
    	[_vehicle] spawn 
    	{
    		params ["_vehicle"];
    		
    		while {driver _vehicle == player} do 
    		{
    			DummyGunner doWatch (positioncameratoworld [0,0,100]);
    			sleep 0.1;			
    		}; 
    		deleteVehicle DummyGunner;
    		(findDisplay 46) displayAddEventHandler ["MouseButtonDown", ""];
    	};
    };
    

  2. Hello guys, I'm trying to make a script which will basically dewlete the bullet and draw a green tracer line to the cursortarget.

     

    So far as I know, all the scripts were based on the bullet tracing, and I was wondering if it is possible just to draw line for 5-7 sec which will be created about 100m distance or something like that.

     

    Any help please?

    A quick search suggests that you described exactly this.

     

    Edit:

    You should consider rather posting on the already existing thread.


  3. I've been having trouble getting this to work due to the inability to build classes with their own members etc. It is hard (not impossible) to accomplish certain things. I've managed to do some A* algorithms in the past which involved nested arrays within nested arrays within nested arrays.

     

    The reason I want to use Voronoi diagrams, is because it uses site points (positions - example: trees, players, rocks etc.) and renders nodes and edges which are like central positions between the site points.

    This will be a non-random approach to replace BIS_fnc_findSafePos with guaranteed success (if there exists a solution given the environment).

     

    Every result that is not favorable can just be added as a site point to the algorithm which will lead to an intelligent algorithm which can evenly distribute objects over an area within any environment.

     

    I can do this with object orientated programming, but that would require me to build addons which I don't prefer.


  4. This sounds like an avenue to pursue! Do you have any brief examples you could describe? Thanks

    I will give you a C# project that I used to play around with performance counters and wmi. It is not a best practise, but you might be able to learn something from it.

    The output is as follows:

    Time Elapsed 00:00:56.9663781

    Time(ms) CPU(%) RAM(MB) Hard Drive(%)

    261 0 0 0

    621 1.08 0 3

    980 5.44 3 0

    1343 5.4 9 6

    1702 14.11 10 8

    2062 18.44 13 31

    2424 4.34 14 13

    2784 9.73 15 3

    3143 24.99 25 0

    3503 22.78 47 12

    3864 8.67 49 15

    4225 1.08 50 16

    4584 9.76 52 7

    4942 28.28 53 0

    5302 35.96 54 11

    5664 10.85 57 14

    6023 11.9 62 17

    6384 11.9 65 5

    6744 23.88 78 9

    7104 10.86 86 18

    7463 4.34 87 23

    7823 2.18 87 16

    8183 3.25 89 8

    8542 11.98 95 1

    8902 20.6 105 0

    9263 24.95 116 16

    9623 3.25 116 13

    9983 11.92 116 5

    10345 11.9 119 15

    10704 1.08 126 0

    11064 4.36 131 0

    11424 10.86 133 11

    11787 24.95 154 13

    12148 47.34 160 6

    12508 22.72 172 4

    12868 23.89 183 0

    13229 22.75 188 0

    13590 21.67 194 12

    13949 4.33 200 0

    14310 20.61 201 8

    14672 23.84 204 0

    15032 24.81 204 0

    15392 24.95 204 0

    15752 24.95 204 0

    16112 24.95 204 1

    16473 23.87 210 0

    16833 24.95 210 3

    17193 26.04 210 0

    17553 28.2 211 0

    17913 28.2 211 0

    18273 22.72 213 17

    18634 9.77 219 6

    18995 7.58 222 0

    19356 0 222 7

    19716 10.83 228 0

    20077 24.95 244 6

    20438 20.55 275 8

    20798 21.66 292 17

    21159 21.62 297 17

    21519 17.42 301 16

    21879 19.51 305 16

    22240 27.12 312 18

    22601 20.57 317 14

    22960 22.72 320 0

    23320 25.02 321 0

    23682 23.86 322 19

    24042 24.82 330 19

    24402 27.04 335 19

    24762 32.63 364 19

    25122 27.12 386 23

    25482 24.95 392 18

    25842 29.29 394 19

    26202 24.95 397 0

    26562 24.95 398 0

    26923 24.95 400 0

    27282 24.95 401 0

    27642 25.02 413 1

    28001 24.96 416 9

    28364 11.91 417 16

    28724 10.8 420 14

    29083 9.79 424 13

    29443 20.61 439 12

    29803 23.87 446 0

    30163 44.48 446 0

    30523 45.69 446 0

    30883 29.32 452 10

    31245 31.38 460 12

    31606 18.32 467 10

    31968 36.85 470 4

    32331 32.39 479 0

    32696 27.9 479 0

    33058 40.67 480 1

    33420 38.97 480 1

    33782 33.35 482 0

    34144 32.41 482 0

    34506 32.45 482 0

    34867 33.44 482 0

    35229 35.7 482 0

    35589 33.55 483 0

    35952 21.55 488 5

    36314 33.44 486 0

    36675 32.47 486 0

    37036 33.44 486 0

    37399 26.97 486 3

    37760 35.73 486 0

    38121 29.13 486 0

    38483 31.37 486 0

    38843 31.37 486 0

    39203 28.21 486 0

    39567 27.04 486 0

    39929 32.24 488 0

    40292 23.75 488 0

    40655 31.19 488 0

    41017 33.37 488 0

    41379 28.05 488 3

    41744 33.47 488 0

    42106 29.96 488 0

    42468 30.19 488 3

    42828 24.89 464 7

    43188 24.93 548 8

    43549 27.09 572 3

    43909 24.88 572 0

    44270 26.11 572 5

    44632 24.88 565 5

    44992 24.76 609 0

    45352 24.95 682 1

    45713 24.96 723 6

    46075 21.57 728 18

    46437 25.95 731 15

    46797 23.8 721 17

    47158 24.9 726 14

    47518 24.95 730 15

    47878 22.81 734 16

    48238 21.69 738 16

    48597 23.89 745 15

    48958 22.78 750 14

    49318 17.4 754 10

    49678 25.97 759 14

    50038 25.99 764 5

    50399 22.78 796 2

    50761 23.76 801 0

    51121 25.89 801 3

    51481 24.95 801 0

    51842 25.02 801 0

    52202 23.8 817 8

    52561 17.41 828 10

    52922 22.73 834 0

    53281 26.09 834 17

    53642 30.34 845 18

    54003 32.54 854 13

    54364 41.18 859 6

    54725 41 860 18

    55085 42.37 863 7

    55448 42.07 864 1

    55808 34.62 864 0

    56168 3.26 864 0

    56529 4.32 864 0

    56889 4.34 864 0

    The result comes from launching arma and then loading altis.

    You can paste the results in excel and graph them if you wish.

     

    The time intervals aren't constant either, but this will give you the information you need.

     

    Just take into mind that the first time you load a mission will take longer than the second time you load it because the resources are still stored in your memory.

     

    https://dl(dot)dropboxusercontent(dot)com/u/56725922/Resource%20Monitor%20-%20Copy(dot)rar

     

    I stripped some content from the project because it was actually used to monitor server performance during running queries on MSSQL and MySQL servers. So, there might be strange references. (Project from an old school assignment)


  5. I'm fairly certain that this is not possible in Arma/Scripting, but just to be sure, is it possible to pass data into a HTML document from using htmlLoad?

    _control htmlLoad "myDocument.html?var1=a&var2=b&var3=c";
    

    Or rather load data from within the HTML document using JavaScript. Like an XHR request to get a JSON script or something?

    https://forums.bistudio.com/topic/157999-dialogs-using-html/#entry2484180

     

    Look at that. Maybe it could help.

     

    AFAIK html documents are static and cannot perform any actions


  6. If you have a look inside some vanilla PBO files, like ui_f_data.pbo, you will already find some HTML files. In fact, there is a support for HTML files already in place as you can read up in the BIKI pages for HTML-Files and DialogControls-Text.

     

    But I personally have not managed to include an HTML file as a dialog into one of my missions, because it's not as intuitive as I hoped.

    Wouldn't it be great to create a complete functioning dialog based only on HTML documents?


  7. I have seen some threads touching the topic, but I did not find an answer/opinion I was looking for.
     
    Since scripting for Arma has allowed us to do many glorious things with our missions (example: integrating with databases), I thought it would be great if we could start dynamically creating dialogs using HTML and Javascript.
    Some other game engines already utilize this technology (although ARMA does too, but is very limited).
     
    Imagine creating dialogs like this:

    <html>
    <head>
       <meta name="class" content="HTMLDialogName">
       <meta name="movingEnable" content="false">      
       <style>
          body{
              width:80%;
              height:80%;
              margin:auto;
              padding:1%;
              background:#CCC;
             }
           p{
             color:#A30;
             background#FFF;
             size: 10%;
            }
        </style>
        <script>
          function somefunction()
          {
              //somefancy visual stuff and then...
              execSQF("execVM somescript.sqf");
          }
        </script>
    </head>
    <body>
       <p>
          Some text
       </p>
       <button onclick="somefunction();">
          Click Me!
       </button>
    </body>
    </html>
    

    And then you can call it like this

    createDialog "HTMLDialogName"; 

  8. That means that road is not really connected (engine wise) to where visually seems to.

     

    The only workaround I can tell you is to create a whitelist of roads which have this situation, so: if ((count roadsConnectedTo _road) == 1) then {if (_road in whiteListRoads) then....  

     

    I'm curious to know if the path of your script is the same than AI uses to travel in SAFE or CARELESS mode, is it?

    I haven't tested this, although I think the result might be very similar.

     

    I also thought the (count roadsConnectedTo _road) == 1, but the problem was that it was 2. There is a junction in the road. The result should have been 3 roadsConnectedTo.

     

    Finding the shortest route would have taken about 10 seconds instead of a minute if those roads were connected.


  9. I've created a script that finds the shortest route between points via roads. But I've found that not all roads are connected properly. Is there a workaround to know which roads are connected without using roadsConnectedTo?

     

    I montirored the search by adding a marker to jump to the active node being searched and it stopped at the following spot (marked with red arrow): 

    pOjIUOu.jpg?1

     

    createMarker ["tst",[0,0]];
    			"tst" setMarkerShape "ELLIPSE";
    			"tst" setMarkerSize [50,50];			
    			"tst" setMarkerColor "ColorGreen";
    
    SelectFrontier = {
    	node = Frontier select 0;
    	Frontier deleteAt 0;
    	node;
    };
    
    InsertFrontier = {
    	_alreadyExplored = false;
    	
    	{
    		if(_this select 0 == _x select 0) exitWith{//Both parent and current node must match, because it allows exploring different paths in junctions (paths with more than 2 paths attached to them)
    			//Already explored or on line to be explored
    hint "Already Explored";			
    _alreadyExplored = true;	
    		};
    	
    	}foreach Explored + Frontier;
    	
    	if(_alreadyExplored) exitWith{};
    	hint "adding";
    	_tmpFront = [];
    	_tmpBack= [];
    	_score = (_this select 2) + ((_this select 0) distance Destination);
    	{		
    		if(_score > ((Frontier select _forEachIndex) select 2) + (((Frontier select _forEachIndex) select 0) distance Destination)) then
    		{
    			_tmpFront = _tmpFront + [Frontier select _forEachIndex];
    		} 
    		else 
    		{
    			_tmpBack = _tmpBack + [Frontier select _forEachIndex];
    		};
    	}foreach Frontier;
    	
    	systemchat str Frontier;
    	
    	Frontier = _tmpFront + [_this] + _tmpBack;
    
    	
    	systemchat ("added to:" + str count(_tmpFront));
    };
    
    CreateNode = {
    	_score = 0;
    	if(!isNull ((_this select 1) select 0)) then
    	{
    		_score = ((_this select 0) distance (_this select 1 select 0)) + (_this select 1 select 2); //(distance between currentNode & parentNode) + parentNodeScore
    	};
    	[_this select 0, _this select 1, _score];
    };
    
    
    	Destination = (destinationlogic nearRoads 10) select 0;
    	if(isNull Destination) exitWith{ hint "BAD ROAD!";};
    	Start = (player nearRoads 10) select 0;
    	Frontier = [[Start, [objNull, nil, 0]] call CreateNode];
    	Explored = [];
    	pathFound = false;
    	[] spawn {
    	
    	while{count Frontier > 0 && !pathFound} do
    	{		
    		_currentNode = call SelectFrontier;
    		"tst" setMarkerPos getPos (_currentNode select 0);
    		Explored = Explored + [_currentNode];
    		hint str (count(roadsConnectedTo (_currentNode select 0)));
    		{
    			if(_x == Destination) then {
    				pathFound = true;
    				player setPos getPos _x;
    				goalNode = [_x, _currentNode] call CreateNode
    			};
    			if(str _x != str(_currentNode select 1)) then {
    				([_x, _currentNode] call CreateNode) call InsertFrontier;
    			};
    		} foreach roadsConnectedTo (_currentNode select 0);
    	};
    	
    	
    	if(!isNil "goalNode") then
    	{
    		_curNode = goalNode;
    		while{!isNull (_curNode select 0)} do 
    		{
    			_markerstr = createMarker [str random 1000000,_curNode select 0];
    			_markerstr setMarkerShape "ELLIPSE";
    			_markerstr setMarkerSize [10,10];
    			_markerstr setMarkerPos getPos (_curNode select 0);
    			_markerstr setMarkerColor "ColorGreen";
    			_curNode = _curNode select 1;
    		};
    	};
    	hint "done";
    	}; 

  10. How would I then go about doing the following?:

    _obj1 = someobject;
    _obj1 setVariable["foo", "bar"];
    
    _obj2 = someobject;
    _obj2 setVariable["parent", _obj1];
    _obj2 setVariable["foo", "baz"];
    
    _quz = (_obj2 getVariable "parent") getVariable "foo";

    I want to know what the best "someobject" would be to attach the variables to.

     

    Edit:

    My question should rather be: How do I create a namespace?

    I do not want to use missionNameSpace or units etc. I just want a namespace which does not belong to anything.


  11. I am currently thinking of using a combination of setVariable and getVariable on objects to get the same behavior as you would get from classes in OOP.

     

    I am thinking of doing the following:

    _x = someObject;
    _x setVariable ["foo", "bar"];
    

    which would be similar to:

    Object x = new Object();
    x.foo = "bar";
    

    If there is a better practise, please stop reading and just direct me towards it.

     

    If the above is sufficient, what object would be the best to use the setVariable/getVariable on?

     

    I am looking at creating an array which might contain more than a thousand of these objects.


  12. So are you saying that instead of ending a mission normally and going through debriefing, starting mission, picking units, seeing briefing, start.

    You are instead resetting the mission while it is still active? by running the init.sqf?

    I can not see a problem with this as long as your mission is mainly script based. There would be some things that would need resetting like player positions and deleting anything created during the mission and maybe some other caretaking needed like resetting modules etc.

    In which case the only scripts you would need to terminate is anything spawned in a loop or spawned functions that maybe held open waiting for something.

    If this isnt what you mean then i do not understand the correlation between Execsive lobby wait times and ending scripts.

    This is exactly the answer I was looking for. My whole mission is based on scripts - Nothing is staticly placed except the respawn location.

     

    So what I did is terminate all the handles, then delete all the mission objects, set some important variables to nil and then execute the init.sqf again.

    Thank you for all the replies. I am spamming the "like this" for all of you.  :P

×