Jump to content

Recommended Posts

Hello guys, i'm new to scripting and i really need some script to make sure only one specific player wil be able to connect to 4 specifics UAVs, of course not at the same time.
It's possible?

 

Thaks alot!

Share this post


Link to post
Share on other sites

Give the player a UAV controller and he can control any UAV's in range.

  • Like 1

Share this post


Link to post
Share on other sites

Anyone can take a UAV controller from Arsenal and i dont wanna put that on blacklist too.

 

What i want is just one player can control uav_1 to uav_4 (specifics uavs name), and all the other planes can control uavs like Darter or Greyhawk.

Or something that prevents players from taking UAV control by limiting it to only the designated class.

Share this post


Link to post
Share on other sites

disableUAVConnectability

 

Here's a quick hacked-together bit, just place in init field of each playable unit you want to restrict:

0 = [this] spawn {
  _unit = _this select 0;
  _uavList = [uav_1,uav_2,uav_3,uav_4];
  {
    _unit disableUAVConnectability [_x,true]
  } forEach _uavList;
};

 

  • Like 5

Share this post


Link to post
Share on other sites

@Harzach found right command

 

from wiki:

This command has effect on a UAV terminal, not on whether a unit is able to connect to a UAV or not.
When a unit gets a new UAV terminal, the unit will be able to connect to the UAV again, unless this command is executed again.

 

disableUAVConnectability

//initPlayerLocal.sqf
//onPlayerRespawn.sqf

player addEventHandler 
[
    "Take", 
    {
        params ["_unit", "_container", "_item"];

        // add roles that can control UAVs
        _roles = ["I_soldier_UAV_F", "O_soldier_UAV_F", "B_soldier_UAV_F"];

        if (typeOf _unit in _roles) then 
        {
            // add terminals from mod if you need
            _terminals = ["I_UavTerminal", "C_UavTerminal", "O_UavTerminal", "I_E_UavTerminal", "B_UavTerminal"];
        
            // add your whitelisted UAVs
            _uavs = [uav_1, uav_2, uav_3];

            if (_item in _terminals) then 
            {
                {
                    _unit disableUAVConnectability [_x, true];
                } 
                forEach (allUnitsUAV - _uavs);
            };
        }
    }
];

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hey all, hope you are all doing fine :).

 

I haven't scripted UAVs before but according to this webpage (from BI's Wiki) you can use variable rules to decide who can have access to a UAV

 

 
 
 
 
2
Quote

rules = <array>; - Rule which defines which units with have access to UAV. Can be either list of specific units or whole side

Example: BIS_uav_0 setVariable["rules",[west, allied_gue_1]];

Default value: units synchronised in editor

 

Additionally, as you can see, most probably, one can just synchronise the unit(s) that want to have access to the specific UAV(s) in order to exclude the rest. Once more... I haven't scripted or used UAVs before so I can't really say if these would do the thing you would like to do. Unfortunately, I don't have access to ArmA and I won't be able to test it anytime soon. Hope it does help though. Please let us know if it does :).

  • Like 3

Share this post


Link to post
Share on other sites
5 hours ago, Harzach said:

disableUAVConnectability

 

Here's a quick hacked-together bit, just place in init field of each playable unit you want to restrict:


0 = [this] spawn {
  _unit = _this select 0;
  _uavList = [uav_1,uav_2,uav_3,uav_4];
  {
    _unit disableUAVConnectability [_x,true]
  } forEach _uavList;
};

 

Don't work, thx anyway!

 

3 hours ago, M1ke_SK said:

@Harzach found right command

 

from wiki:

This command has effect on a UAV terminal, not on whether a unit is able to connect to a UAV or not.
When a unit gets a new UAV terminal, the unit will be able to connect to the UAV again, unless this command is executed again.

 

disableUAVConnectability


//initPlayerLocal.sqf
//onPlayerRespawn.sqf

player addEventHandler 
[
    "Take", 
    {
        params ["_unit", "_container", "_item"];

        // add roles that can control UAVs
        _roles = ["I_soldier_UAV_F", "O_soldier_UAV_F", "B_soldier_UAV_F"];

        if (typeOf _unit in _roles) then 
        {
            // add terminals from mod if you need
            _terminals = ["I_UavTerminal", "C_UavTerminal", "O_UavTerminal", "I_E_UavTerminal", "B_UavTerminal"];
        
            // add your whitelisted UAVs
            _uavs = [uav_1, uav_2, uav_3];

            if (_item in _terminals) then 
            {
                {
                    _unit disableUAVConnectability [_x, true];
                } 
                forEach (allUnitsUAV - _uavs);
            };
        }
    }
];

 

Really dont know how to make that.

I try( dont know if i do that right) but dont work too, thx anyway!

Share this post


Link to post
Share on other sites

In order to implement the solution proposed by M1ke_SK you have to copy the given script in initPlayerLocal.sqf and onPlayerRespawn.sqf. If those files don't exist..., create them. Another solution would be to add Respawn event handler to the players in initPlayerLocal.sqf, but I believe the result would be the same with no difference in efficiency (at least not noticeable), but I may be wrong!

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, ZaellixA said:

In order to implement the solution proposed by M1ke_SK you have to copy the given script in initPlayerLocal.sqf and onPlayerRespawn.sqf. If those files don't exist..., create them. Another solution would be to add Respawn event handler to the players in initPlayerLocal.sqf, but I believe the result would be the same with no difference in efficiency (at least not noticeable), but I may be wrong!

Okay, i will try again M1ke_SK script if that dont works i will try yours.

Thx alot!

  • Like 1

Share this post


Link to post
Share on other sites

Ok i try mike_SK script again and dont work.

I will try your metod lazer ZaellixA

  • Like 1

Share this post


Link to post
Share on other sites
43 minutes ago, gaske said:

Ok i try mike_SK script again and dont work.

I will try your metod lazer ZaellixA

Hhhmmm, you have to make sure that the unit you want to be able to use the UAV is of the types that M1ke_SK set as the possible users. Otherwise, you can modify those classes to match the one your unit has. Not sure this will solve the problem, but it could possibly to the job (unable to test as I said).

 

Nevertheless, I believe that if the other solution (the one I sent you) is working, it is the best way to do it. It is more concise, easier maintained and faster (most probably since it calls fewer commands). The choice is yours though to pick one that suits your preferences best (in case they both work out in the end).

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, gaske said:

Don't work, thx anyway!

 

I did test this snippet before posting, but it does assume that your UAVs are named appropriately and the code is in the right place. Also, there's a forum bug where copy/pasting code snippets sometimes results in corrupt characters, breaking the code. It's best to re-type any snippets, but at the very least check all quotes and semicolons ( " ' ; ) carefully, as they seem to be the most commonly affected.

 

Regardless, as @M1ke_SK points out, the command actually disables the terminal currently in the player's inventory, so my snippet is useless in most situations.

 

As for others' code not working, you need to share how you are implementing it. Just replying "don't work" is not constructive.

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, Harzach said:

 

I did test this snippet before posting, but it does assume that your UAVs are named appropriately and the code is in the right place. Also, there's a forum bug where copy/pasting code snippets sometimes results in corrupt characters, breaking the code. It's best to re-type any snippets, but at the very least check all quotes and semicolons ( " ' ; ) carefully, as they seem to be the most commonly affected.

 

Regardless, as @M1ke_SK points out, the command actually disables the terminal currently in the player's inventory, so my snippet is useless in most situations.

 

As for others' code not working, you need to share how you are implementing it. Just replying "don't work" is not constructive.

I check the " and , and is all on place, i put yours on unit init whit all UAVs named, try copy/pasting and re-type both do not work here

 

With M1ke_SK code, i add the lines on initplayer.sqf and creat the onplayerrespawn.sqf, re-type on both and seems to not work too.

I will just delete the UAV's, cant make them spot autofiring too, so they are useless for now.

 

Thanks alot for the help guys!

Share this post


Link to post
Share on other sites
9 minutes ago, gaske said:

I check the " and , and is all on place

 

Just so it's clear, the issue isn't that the characters are missing or in the wrong place, it's that they are somehow corrupted, or switched out for the "curly"variant.

"string using straight quotes"; //works

“string using curly quotes”;  //does not work

 

  • Like 1

Share this post


Link to post
Share on other sites
14 minutes ago, Harzach said:

 

Just so it's clear, the issue isn't that the characters are missing or in the wrong place, it's that they are somehow corrupted, or switched out for the "curly"variant.


"string using straight quotes"; //works

“string using curly quotes”;  //does not work

 

Its all on straight quotes.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×