Jump to content
nerexis

Scripting UAV to prevent connection

Recommended Posts

I wanna know if it's possible to prevent certain players in Independent side to connect to UAV which has already player connected UAV from Independent side.
Best way would be to use some event handler which checks if there are already connected players to UAV, something like that. So what kind of event handlers work on drones?

 

Share this post


Link to post
Share on other sites

Thank you, it works for me :)

EDIT: Is there way to prevent drone from showing on map?

Edited by nerexis

Share this post


Link to post
Share on other sites

Hello, i also wanna know if it's possible to prevent players to get connected with some uavs. the uavs should not appear in the terminal overview.

 

i have tried "player disableUAVConnectability [uav_1,true];" from a logic object. works fine but only in singleplayer scenario.

 

how do i set up this command all players on the server?

Share this post


Link to post
Share on other sites
11 minutes ago, Nexus Payne said:

Hello, i also wanna know if it's possible to prevent players to get connected with some uavs. the uavs should not appear in the terminal overview.

 

i have tried "player disableUAVConnectability [uav_1,true];" from a logic object. works fine but only in singleplayer scenario.

 

how do i set up this command all players on the server?

 

[[<UAV>],{player disableUAVConnectability [_this select 0,TRUE];}] remoteExec ['call',-2,<UAV>];

 

Share this post


Link to post
Share on other sites

sorry, i am not so skilled in scripting. so please dont judge me for "stupid" questions:

 

55 minutes ago, fn_Quiksilver said:

 


[[<UAV>],{player disableUAVConnectability [_this select 0,TRUE];}] remoteExec ['call',-2,<UAV>];

 

 

where and how do i place it right. in the logic-object init? or in the player init? oder somewhere else?

Share this post


Link to post
Share on other sites
Just now, Nexus Payne said:

sorry, i am not so skilled in scripting. so please dont judge me vor "stupid" questions:

 

 

where and how do i place it right? in the logic-object init? or in the player init? oder somewhere else?

 

wherever the uav is spawned

Share this post


Link to post
Share on other sites

hmm,

 

it does not work...

 

placed the uav (e.g. varname is uav_1), place a playable unit and a gamelogic object. copy this "[[<UAV>],{player disableUAVConnectability [_this select 0,TRUE];}] remoteExec ['call',-2,<UAV>];" in the logic-init. please tell me what else I can do...

Share this post


Link to post
Share on other sites

i got an error, in german "Fehler: Ungültige Zahl im Ausdruck"

in english - dont know, maybe "error: invalid number in the expression"

Share this post


Link to post
Share on other sites
if (local uav_1) then {
	0 = [[uav_1],{player disableUAVConnectability [_this select 0,TRUE];}] remoteExec ['call',-2,uav_1];
};

 

Share this post


Link to post
Share on other sites

now there is no error but...it doesnt work.

 

i am so sorry bro! thanks for your help so far.

Share this post


Link to post
Share on other sites
35 minutes ago, Nexus Payne said:

now there is no error but...it doesnt work.

 

i am so sorry bro! thanks for your help so far.

 

are you executing this in the init field of the uav itself or some "logic"?

if (local this) then {
	0 = [[this],{player disableUAVConnectability [_this select 0,TRUE];}] remoteExec ['call',-2,this];
};

 

Share this post


Link to post
Share on other sites
12 minutes ago, fn_Quiksilver said:

are you executing this in the init field of the uav itself or some "logic"?

 

i try both. in the init of the uav with "this" and if its not working in the init of the logic-module with the varname of the uav.

Share this post


Link to post
Share on other sites

i have started from the begining and...i dont know why but it works so far in MP but only for one player at a time. is it possible to exec the "disableUAVConnectability" for all players on the server? our server got 20 playable slots and i think there must be a better way to solve this problem than writing the command 20 times (for player1, player2, player3, etc...) in the init of the uav.

 

is there a way to exec this command for all players at once?

Share this post


Link to post
Share on other sites
22 hours ago, Nexus Payne said:

is there a way to exec this command for all players at once?

 

Try something like this.

 

Create a script and call it whatever you want. Add this to the script.

sleep 1;

if !(isServer) exitWith {};

_uav = objNull;

_uav = _this select 0;

{_x disableUAVConnectability [_uav,true];} forEach playableUnits;

And add this to your uav init field to run it.

0 = [this] execVM "whatever.sqf";

 

Hope this helps.

 

Cheers.

Share this post


Link to post
Share on other sites

Hi, Unfortunately, the script does not work in multiplayer. I talked to the author of the mission and he told me that the script had to be executed for each client. Unfortunately, I do not know what he means. Can you help me please?

 

PS: we are working on a variant of Domination (original author: Xeno)

 

thank you guys!

Share this post


Link to post
Share on other sites
25 minutes ago, Nexus Payne said:

he told me that the script had to be executed for each client. Unfortunately, I do not know what he means.

 

each 'client' is each connected player, you want remoteExec command, have a look at the section marked 'target'. remote exec can run a local script for each client

Share this post


Link to post
Share on other sites
3 hours ago, Nexus Payne said:

Hi, Unfortunately, the script does not work in multiplayer.

 

This is not enough information for anyone to be able to help you.

 

What script ?

 

And how is the script being used etc ?

 

Share this post


Link to post
Share on other sites

I'm trying to explain:

 

I am trying to create a domination server (original author is "Xeno "). Domination is a kind of PvE-milsim mode.

 

There we would like to place anti-aircraft (SAM, from the Jet dlc) which are supposed to work normally, but the player should not have Access via uav terminal. These SAMs should not appear in the terminal, because otherwise it becomes very confusing for Player which uav is open to Play and which is not. Therefore we need a script for this purpose.

 

thank u guys for your support.

Share this post


Link to post
Share on other sites

I tried it with the script from cb65 (see above) but unfortunately it did not work in multiplayer. Then I contacted the original author of Domination. hetold me that I have to make sure that the script is executed on each client. Unfortunately, I have no idea what to do or how to do it.

Share this post


Link to post
Share on other sites
9 hours ago, Nexus Payne said:

I tried it with the script from cb65 (see above) but unfortunately it did not work in multiplayer. Then I contacted the original author of Domination. hetold me that I have to make sure that the script is executed on each client. Unfortunately, I have no idea what to do or how to do it.

 

@ Nexus Payne give this a try.

 

place your sam's in the editor and name them, for example sam1, sam2, etc.

 

Then put this in your mission init.sqf

Spoiler

[] spawn {
    if (!hasInterface) exitWith {};
    while {true} do {
        // Check if the player has an AV terminal
        if ("B_UavTerminal" in assignedItems player) then {
            {player disableUAVConnectability [_x,true];} forEach [sam1,sam2];
        };
        sleep 0.01;
    };
};

 

 I've tested it and it works for me.

 

Cheers.

  • Like 1

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

×