Jump to content

jshock

Member
  • Content Count

    3059
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by jshock


  1. For Arma 2 and 3, what would be the best language to learn?  i.e. C++?  I read what killzone_kid posted for me and understand the base of the execVM, but want to learn more.

    The language used is sqf, so learn that, but if your're looking for more of a real world application C++/Java would be a good start as Arma does mirror concepts in sqf.

    However this is off topic from this thread, if you want to continue this discussion I recommend you PM someone or start your own discussion thread on the subject.

    • Like 1

  2. Most of the "lower level" tutorials out there use execVM because throwing people that have zero coding knowledge into function file structure, compilation, and optimization is just too complicated when a new coder just wants to create something as simple as a dynamic marker on an objective after it's completed. And since most people start on the lower levels, they don't learn about the use of call/spawn until later in their coding careers, so they use execVM instead, where they don't need to think about suspension or locality (as much anyways) or other topics that aren't so easily understood.

    • Like 7

  3. _array = [
        ["Key 1", [0, 0, 0], [0, 0, 0]],
        ["Key 2", [0, 0, 0], [0, 0, 0]],
        ["Key 3", [0, 0, 0], [0, 0, 0]] 
    ];
    
    _searchKey = "Key 1";
    
    _matchedArray = [];
    
    {
    	_keyArray = _x;
    	if ((_keyArray select 0) == _searchKey) exitWith
    	{
    		{
    			_matchedArray pushBack _x;
    		} forEach _keyArray;
    	};
    } forEach _array;
    _matchedArray;

    Untested, but should work....but give you a concept.

     

    Forgot about the select command, use hallyGs post :D.

    • Like 1

  4. Realized my stupid mistake (tired as hell atm), try this:

    if !(player getVariable ["bluSuitPowers_eh",false]) then
    {
    	[
    		"checkEquippedUniform",
    		"onEachFrame",
    		{
    			params ["_unit"];
    			if (uniform _unit isEqualTo "U_B_Soldier_VR") then 
    			{
    				if ( !(_unit getVariable ["powers", false]) ) then 
    				{ 
    					[ [], "fnc_bluSuitPowers", _unit ] call BIS_fnc_MP; 
    				};
                                    _unit setVariable ["powers", true];
    			} 
                            else 
    			{
                                    _unit setVariable ["powers", false];
    			};
    		},
    		[player]
    	] call BIS_fnc_addStackedEventHandler;
    	player setVariable ["bluSuitPowers_eh",true];
    };
    
    • Thanks 1

  5. I think your original solution is better

     

    That solution only works if the player picks it up and equips it, but the OP stated that is not always the case (implies that the uniform could be applied directly to the player via script).

     

     

    onEachFrame in this case shouldn't cause too much of a performance impact, unless you are adding a whole bunch of onEachFrame stacked event handlers, which is probably the issue here, so try the following, hopefully it works better, if it doesn't I'll need to see where you are actually using and putting the code.

    if !(player getVariable ["bluSuitPowers_eh",false]) then
    {
    	[
    		"checkEquippedUniform",
    		"onEachFrame",
    		{
    			params ["_unit"];
    			if (uniform _unit isEqualTo "U_B_Soldier_VR") then
    			{
    				[ [], "fnc_bluSuitPowers", _unit ] call BIS_fnc_MP;
    			}
    			else
    			{
    				//remove suit powers
    			};
    		},
    		[player]
    	] call BIS_fnc_addStackedEventHandler;
    	player setVariable ["bluSuitPowers_eh",true];
    };
    
    • Thanks 1

  6. fn_createBagFence = 
    {
    	_newBag = "Land_BagFence_Short_F" createVehicle position player;
    	_newBag attachto [player, [0, 1, 0.5]];
    	_newBag setVectorDirAndUp [ [1,0,0],[0,0,1] ];
    	detach _newBag;
    	player setVariable ["playerBag",_newBag];
    };
    
    _bag = player getVariable ["playerBag",nil];
    
    if (isNil "_bag") then
    {
    	[] call fn_createBagFence;
    }
    else
    {
    	deleteVehicle _bag;
    	[] call fn_createBagFence;
    };
    
    

    EDIT: Ninja'd :P


  7. Hm, seems like BIS_fnc_randomPos isn't returning anything, so the central position doesn't provide any possible positions within the radius or the BIS function has changed since my use of it in that script, I've looked at the wiki and it seems the same to me. If the BIS function works for the foot patrol portion, I don't know why it won't work on the air patrol.

×