Jump to content

Recommended Posts

Hey, I was wondering if there was a way to do the following regarding artillery.

1. Disable the Artillery Computer on one or multiple artillery systems, but keep it on, on other vehicles.
2. Only allow artillery to fire on the mode: "Close" or "medium" if done via Artillery Computer (or any way really).

 

~PingWing

Share this post


Link to post
Share on other sites

Or simply, in init field of the artillery:

0 = this spawn {

  while {alive _this} do {

    waitUntil {sleep 0.5; gunner _this == player};

    enableEngineArtillery false;

    waitUntil {sleep 0.5; gunner _this != player};

    enableEngineArtillery true;

  };

};

NB: EHs are fine but more complicated for nuts, here, imho. getIn getout EH are not sufficient. You need also to check the moveToTurret action.

 

if you want to apply an EH, try instead:

inGameUISetEventHandler ["action", "if ((_this select 0) in [art1,art2,art3] && (_this select 3) == 'ArtilleryComputer') then {true}"];

This will disable the action (still visible in menu) for art1 art2 art3.

  • Like 1

Share this post


Link to post
Share on other sites

If you want to limit the artillery mode to the default one (example close for Scorcher):

 

0 = [] spawn {
    disableSerialization;
    private "_ctrl";
    while {true} do {
      waitUntil {_ctrl = ({ if !(isNull (_x displayCtrl 510)) exitWith {_x}; displayNull } forEach allDisplays) displayCtrl 510; !isNull _ctrl};
      ctrlEnable [510, false];
      waitUntil {isNull _ctrl};

  };

};

This way, the artillery mode is greyed. Player can't choose a different setting than "close".

 

You can limit the choice to "close" or "medium" (the 2 first ranges) by:

0 = [] spawn {
    disableSerialization;
    private "_ctrl";
    while {true} do {
        waitUntil {_ctrl = ({ if !(isNull (_x displayCtrl 510)) exitWith {_x}; displayNull } forEach allDisplays) displayCtrl 510; !isNull _ctrl};
        while {!isnull _ctrl} do {
          if (lbCurSel _ctrl > 1) then {_ctrl lbSetCurSel 0};
          sleep 0.2;
        };
    };

};

Any attempt to choose farther range will resume to close one.

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

pierremgi :D I use this script, the last one, it is very good I love it, but I would like to have Ai in my PvP mission, but you can request artillery of Ai and they shoot where you want, I would like to disable the possibility for players requesting artillery from the Ai group units

 

I know this script does this, but then the players can't use the artillery computer :( what do i do ?

enableEngineArtillery true;

 

Share this post


Link to post
Share on other sites

Can you tell, how did you acquire the control id 510? What is a workflow to find out what is what in UI?

On 12/26/2017 at 4:53 AM, pierremgi said:

If you want to limit the artillery mode to the default one (example close for Scorcher):

 

0 = [] spawn {
    disableSerialization;
    private "_ctrl";
    while {true} do {
      waitUntil {_ctrl = ({ if !(isNull (_x displayCtrl 510)) exitWith {_x}; displayNull } forEach allDisplays) displayCtrl 510; !isNull _ctrl};
      ctrlEnable [510, false];
      waitUntil {isNull _ctrl};

  };

};

This way, the artillery mode is greyed. Player can't choose a different setting than "close".

 

You can limit the choice to "close" or "medium" (the 2 first ranges) by:

0 = [] spawn {
    disableSerialization;
    private "_ctrl";
    while {true} do {
        waitUntil {_ctrl = ({ if !(isNull (_x displayCtrl 510)) exitWith {_x}; displayNull } forEach allDisplays) displayCtrl 510; !isNull _ctrl};
        while {!isnull _ctrl} do {
          if (lbCurSel _ctrl > 1) then {_ctrl lbSetCurSel 0};
          sleep 0.2;
        };
    };

};

Any attempt to choose farther range will resume to close one.

Share this post


Link to post
Share on other sites
On 12/25/2017 at 7:53 PM, pierremgi said:

If you want to limit the artillery mode to the default one (example close for Scorcher):

 

0 = [] spawn {
    disableSerialization;
    private "_ctrl";
    while {true} do {
      waitUntil {_ctrl = ({ if !(isNull (_x displayCtrl 510)) exitWith {_x}; displayNull } forEach allDisplays) displayCtrl 510; !isNull _ctrl};
      ctrlEnable [510, false];
      waitUntil {isNull _ctrl};

  };

}; 

This way, the artillery mode is greyed. Player can't choose a different setting than "close".

 

You can limit the choice to "close" or "medium" (the 2 first ranges) by:

0 = [] spawn {
    disableSerialization;
    private "_ctrl";
    while {true} do {
        waitUntil {_ctrl = ({ if !(isNull (_x displayCtrl 510)) exitWith {_x}; displayNull } forEach allDisplays) displayCtrl 510; !isNull _ctrl};
        while {!isnull _ctrl} do {
          if (lbCurSel _ctrl > 1) then {_ctrl lbSetCurSel 0};
          sleep 0.2;
        };
    };

};

Any attempt to choose farther range will resume to close one.

Is there a way to use this code on a server and for any arty that is spawned?

I have an Epoch server with traders so putting the code in the init of vehicles isn't really practical.

 

Thanks.

Share this post


Link to post
Share on other sites
7 hours ago, pazuzu said:

Is there a way to use this code on a server and for any arty that is spawned?

I have an Epoch server with traders so putting the code in the init of vehicles isn't really practical.

 

Thanks.

init of a vehicle was just an example. That's a place where the code run for server + clients (JIP or not)

To tell the truth, this code is for artillery display. So it concerns only PC with interface (players) .

 

The best place is in initPlayerLocal.sqf .

 

An acceptable one is init.sqf  Dedicated server can be skipped by:

if ! isDedidated then {  code here };
skipping dedicated server + headless client :
if  hasInterface then {   code here   };

 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

init of a vehicle was just an example. That's a place where the code run for server + clients (JIP or not)

To tell the truth, this code is for artillery display. So it concerns only PC with interface (players) .

 

The best place is in initPlayerLocal.sqf .

 

An acceptable one is init.sqf  Dedicated server can be skipped by:

if ! isDedidated then {  code here };
skipping dedicated server + headless client :
if  hasInterface then {   code here   };

 

Thank you, I'll give it a try.

Share this post


Link to post
Share on other sites
11 hours ago, pierremgi said:

init of a vehicle was just an example. That's a place where the code run for server + clients (JIP or not)

To tell the truth, this code is for artillery display. So it concerns only PC with interface (players) .

 

The best place is in initPlayerLocal.sqf .

 

An acceptable one is init.sqf  Dedicated server can be skipped by:

if ! isDedidated then {  code here };
skipping dedicated server + headless client :
if  hasInterface then {   code here   };

 

 

This works nicely. Thank you.

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

×