Jump to content
JIMMI DEE BILLY BOB

SQF files don't work on dedicated server/server.

Recommended Posts

I have just recently finished making a lot of missions for my server, have tested them in single player and multi player, they work there, but when I test them on my nitrado server, they do not work according to the script.
I have written on the codes what does not work, will someone help me, I am desperate.

I really want it to work so I could invite strangers into a game, I have spent 2 years to this date to make the missions, it would really hurt if I wasted my time, only by playing with myself.

 

https://youtu.be/wv3S-cGHJpU?si=FGikttrppBPPH9bH

Share this post


Link to post
Share on other sites

 

the Object


this addaction["------------------------------------------------------", ""]; 
this addAction ["Buy F/A-181 Black Wasp Stealth", "buyAir\BlackWaspStealth1.sqf"];                                                                        
this addAction ["Buy F/A-181 Black Wasp", "buyAir\BlackWasp1.sqf"];                                                      
this addAction ["Buy A-149 Gryphon", "buyAir\Gryphon1.sqf"]; 
this addAction ["Buy A-143 Buzzard", "buyAir\Buzzard1.sqf"];                                                                        
this addAction ["Buy A-164 Wipeout", "buyAir\Wipeout1.sqf"];  
this addaction["------------------------------------------------------", ""];                                                      
this addAction ["Buy AH-99 blackfoot", "buyAir\blackfoot1.sqf"];      ///this on, they are all the same 
this addAction ["Buy WY-55 hellcat", "buyAir\hellcat1.sqf"];                                                                        
this addAction ["Buy AH-9 Pawnee", "buyAir\pawnee1.sqf"];


----------------------------------------------------------------------------------------------------------------------


"Instructions" hintC [
 "You have bought the AH-99 blackfoot, it is unlocked now.",
        "Dont pay for it again!"
];
hintC_EH = findDisplay 72 displayAddEventHandler ["Unload", {
 _this spawn {
  _this select 0 displayRemoveEventHandler ["Unload", hintC_EH];
  hintSilent "";
 };
}];

[West, -80] call BIS_fnc_respawnTickets;

//dont work
Natohelipilot2 moveInGunner blackfoot1;
//
//dont work
blackfoot1 setVehicleLock "UNLOCKED";
//

 

Share this post


Link to post
Share on other sites

 

the Object


this addaction["------------------------------------------------------", ""]; 
this addAction ["Buy 3x Cruise missiles", "NuCruiserM1.sqf"];    
this addaction["------------------------------------------------------", ""];                                                                     
this addAction ["Buy one 0,3kt nuclear howitzer shell", "NukeWar1.sqf"];            ///this on, they are all the same                                                
this addAction ["Buy one 3kt nuclear Cruise missile", "NukeWar11.sqf"];      

 

----------------------------------------------------------------------------------------------------------------------

 


//dont work, it works the sekund time a try to addaction, and then I would have used 2x the tickets
NnukeArt1 setVehicleAmmo 0.0313;
//

"Instructions" hintC [
 "You can only buy one nuclear howitzer shell at a time.",
    "Trying to buy more will only cost your team more tickets.",
 "Nuclear howitzer shell has been armed in Hammer cannon on destroyer.",
 "Use UAV terminal to control Hammer."
];
hintC_EH = findDisplay 72 displayAddEventHandler ["Unload", {
 _this spawn {
  _this select 0 displayRemoveEventHandler ["Unload", hintC_EH];
  hintSilent "";
 };
}];
[west, -50] call BIS_fnc_respawnTickets;

 

 

 

Share this post


Link to post
Share on other sites

 

if (!isServer) exitWith {};


_veh = _this #0; _veh lockCargo true;
_veh = _this #0; _veh removeWeaponTurret ["LMG_RCWS", [0]];
_veh = _this #0; _veh lockturret [[0,0],true];
_veh = _this #0; _veh lockturret [[0],true];
_veh = _this #0; _veh animate ["HideTurret", 1];
_veh = _this #0; _veh allowCrewInImmobile true;
_veh = _this #0; _veh removeWeaponTurret ["SmokeLauncher",[0,0]];


//dont work
_veh = _this #0; _veh addAction
[
  "Dispense AT mines : Fire slugs in driver seat,and to the right side of vehicle, mines will be covering a 40m radius 65 meters out ",
  {}];
//

_veh = _this #0; _veh addWeaponTurret ["sgun_HunterShotgun_01_sawedoff_F",[-1]];
{ _veh addMagazineTurret ["2Rnd_12Gauge_Slug",[-1]] } count [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];

//dont work
_veh = _this #0; _veh addEventHandler ["Fired", {
      flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]);
      flareN setVelocity [0,0,-01];
}];
//

//dont work
 _veh = _this #0; _veh addEventHandler ["killed",{
 _bomb="ammo_Missile_Cruise_01" createVehicle (getPos (_this select 0));
 (_this select 0)}];
//

//dont work
_veh = _this #0;  call compile preprocessFileLineNumbers "plank\plank_init.sqf";
[_veh, [0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0]] call plank_api_fnc_forceAddFortifications;
//

[West, -24] call BIS_fnc_respawnTickets;

east addScoreSide 2;

 

I know it can work on the server, I've tried using vehicle init, but there's something I'm doing wrong, I have a not a chance to figure it out, I'm bad at scripting.

Share this post


Link to post
Share on other sites

I can understand your frustration,  but from your explanation, I really have no clue what the problem is. The code you posted looks ok. If it works on your PC, then  the problem is not the code itself, but where it gets called from. To code MP missions, you should have an understanding of MP locality.

 

Read this page carefully:

https://community.bistudio.com/wiki/Multiplayer_Scripting

 

As of your problem, let's be more clear:

-  What do you mean exactly by "doesn't work" - the code does not get called?

-  Where is the code written?- (init field, init.sqf etc....)

Share this post


Link to post
Share on other sites
14 hours ago, dupa1 said:

I can understand your frustration,  but from your explanation, I really have no clue what the problem is. The code you posted looks ok. If it works on your PC, then  the problem is not the code itself, but where it gets called from. To code MP missions, you should have an understanding of MP locality.

 

Read this page carefully:

https://community.bistudio.com/wiki/Multiplayer_Scripting

 

As of your problem, let's be more clear:

-  What do you mean exactly by "doesn't work" - the code does not get called?

-  Where is the code written?- (init field, init.sqf etc....)


//dont work: is to point out where i have problems, the language scripting is kind of hard for me.

My problems basically these parts of the script her under, i get that it has something to do with how the code run, like server and local, I just can't figure it out.

// this is my main problem, i have like 50 of Them running on my missions on units and vehicles, it is run by remoteVM, i tried RemoteExec, they looks like the same problem.

 

—————-SQF file
if (!isServer) exitWith {};

 


_veh = _this #0;  call compile preprocessFileLineNumbers "plank\plank_init.sqf";
[_veh, [0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0]] call plank_api_fnc_forceAddFortifications;

 

 _veh = _this #0; _veh addEventHandler ["killed",{
 _bomb="ammo_Missile_Cruise_01" createVehicle (getPos (_this select 0));
 (_this select 0)}];


_veh = _this #0; _veh addAction
[
  "Dispense AT mines : Fire slugs in driver seat,and to the right side of vehicle, mines will be covering a 40mradius 65 meters out ",
  {}];


dont work
_veh = _this #0; _veh addEventHandler ["Fired", {
      flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]);
      flareN setVelocity [0,0,-01];
}];

 

 

My sekund problem is when i use adaction in mission on a object, then these lines will not manipulate objects as described, but that is my least problem, but it would be easier to solve the problems in  the sqf file.


———sqf file

 

NnukeArt1 setVehicleAmmo 0.0313;

 

Natohelipilot2 moveInGunner blackfoot1;

blackfoot1 setVehicleLock "UNLOCKED";

Share this post


Link to post
Share on other sites

First piece of code: I've marked some code lines with numbers and below there are some comments.

if (!isServer) exitWith {};   //*********** 1 ***********

_veh = _this #0;  call compile preprocessFileLineNumbers "plank\plank_init.sqf";
[_veh, [0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0]] call plank_api_fnc_forceAddFortifications;

 _veh = _this #0; _veh addEventHandler ["killed",{  
 _bomb="ammo_Missile_Cruise_01" createVehicle (getPos (_this select 0));
 (_this select 0)}];

_veh = _this #0; _veh addAction  //*********** 2 ***********
[
  "Dispense AT mines : Fire slugs in driver seat,and to the right side of vehicle, mines will be covering a 40mradius 65 meters out ",
  {}];

dont work
_veh = _this #0; _veh addEventHandler ["Fired", {
      flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]); //*********** 3 ***********
      flareN setVelocity [0,0,-01];
}];

 

First of all, I repeat my question:

If is VERY IMPORTANT to know where the script is called from. So I am asking again: Where is the SQF file called from? Where is the execVM command that runs it? Is it in an init line of an editor object? Is it in init.sqf? Or elsewhere? 

 

Remarks regarding the code:

1. This means that the script will run on server only. 

2. AddAction should be used on clients, but your script runs on the server. This action is added on the server only, so clients won't be able to see it. Consider using remoteExec here.

3. In this line of code you mention "player". There is no player on dedicated server, so you should use some other object for position reference. You do have an array of all players, it's called: allPlayers. https://community.bistudio.com/wiki/allPlayers

 

The second piece of code:

nukeArt1 setVehicleAmmo 0.0313;
Natohelipilot2 moveInGunner blackfoot1;
blackfoot1 setVehicleLock "UNLOCKED";

 

I am not sure I completely understand your explanation:

Quote

My sekund problem is when i use adaction in mission on a object, then these lines will not manipulate objects as described, but that is my least problem, but it would be easier to solve the problems in  the sqf file.

If I understand correctly, you have an Addaction in an init line of an object in the editor that calls this script. 

In the wiki setVehicleAmmo, moveInGunner and setVehicleLock  all have a "LA" icon, which means "local argument" it means that these commands have to be run on the machines where the vehicle is local. When you use an action, the action code is executed on the players machine. By default, empty vehicles are local to server, but if a player enters them, they switch locality to the players computer. So try the following (not tested):

[nukeArt1, 0.0313] remoteExec ["setVehicleAmmo", nukeArt1];
[Natohelipilot2, blackfoot1] remoteExec ["moveInGunner", Natohelipilot2];
[blackfoot1, "UNLOCKED"] remoteExec ["setVehicleLock", blackfoot1];

To make your mission work on the dedicated server, you will need patience. Try to concentrate on one problem at a time.

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
On 2/22/2024 at 8:44 PM, dupa1 said:

First piece of code: I've marked some code lines with numbers and below there are some comments.


if (!isServer) exitWith {};   //*********** 1 ***********

_veh = _this #0;  call compile preprocessFileLineNumbers "plank\plank_init.sqf";
[_veh, [0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0]] call plank_api_fnc_forceAddFortifications;

 _veh = _this #0; _veh addEventHandler ["killed",{  
 _bomb="ammo_Missile_Cruise_01" createVehicle (getPos (_this select 0));
 (_this select 0)}];

_veh = _this #0; _veh addAction  //*********** 2 ***********
[
  "Dispense AT mines : Fire slugs in driver seat,and to the right side of vehicle, mines will be covering a 40mradius 65 meters out ",
  {}];

dont work
_veh = _this #0; _veh addEventHandler ["Fired", {
      flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]); //*********** 3 ***********
      flareN setVelocity [0,0,-01];
}];

 

First of all, I repeat my question:

If is VERY IMPORTANT to know where the script is called from. So I am asking again: Where is the SQF file called from? Where is the execVM command that runs it? Is it in an init line of an editor object? Is it in init.sqf? Or elsewhere? 

 

Remarks regarding the code:

1. This means that the script will run on server only. 

2. AddAction should be used on clients, but your script runs on the server. This action is added on the server only, so clients won't be able to see it. Consider using remoteExec here.

3. In this line of code you mention "player". There is no player on dedicated server, so you should use some other object for position reference. You do have an array of all players, it's called: allPlayers. https://community.bistudio.com/wiki/allPlayers

 

The second piece of code:


nukeArt1 setVehicleAmmo 0.0313;
Natohelipilot2 moveInGunner blackfoot1;
blackfoot1 setVehicleLock "UNLOCKED";

 

I am not sure I completely understand your explanation:

If I understand correctly, you have an Addaction in an init line of an object in the editor that calls this script. 

In the wiki setVehicleAmmo, moveInGunner and setVehicleLock  all have a "LA" icon, which means "local argument" it means that these commands have to be run on the machines where the vehicle is local. When you use an action, the action code is executed on the players machine. By default, empty vehicles are local to server, but if a player enters them, they switch locality to the players computer. So try the following (not tested):


[nukeArt1, 0.0313] remoteExec ["setVehicleAmmo", nukeArt1];
[Natohelipilot2, blackfoot1] remoteExec ["moveInGunner", Natohelipilot2];
[blackfoot1, "UNLOCKED"] remoteExec ["setVehicleLock", blackfoot1];

To make your mission work on the dedicated server, you will need patience. Try to concentrate on one problem at a time.

 

 

 

 

 

 

 

I know that I have answered for a little too long, it is probably also a little because I am impatient, I don't have that much time, the 2 years that I have spent were for the purpose of being able to finish, so that i could play something casual without spending 8-16 hours to get some action in Arma 3, i could play with Ai but it's not the same as a human player.

 

I found a half solution to most of the problems, I just need to fix them in the missions, except for this big problem.

 

I am using jebus/gaia script, it works perfectly but no my scripting 

 

 

this is in the units init. its a officer Nato side 🙂 it works just not on the server, RemoteExoc make no deferens.---------------------------------

 

     0 = [this, "DELAY=",300, "INIT=", "{[_x] execVM 'Ticket1OFFn.sqf'} forEach units (group _proxyThis);"]spawn jebus_fnc_main;   

 

Ticket1OFFn.sqf----------------------------------- dont work to

 

 if (!isServer) exitWith {};

_unit = _this #0; _unit enableFatigue false;

call compile preprocessFileLineNumbers "plank\plank_init.sqf";
[_unit, [6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 ,2 ,2, 0, 0, 0, 100, 100, 100, 60]] call plank_api_fnc_forceAddFortifications;

[West, -3] call BIS_fnc_respawnTickets;

East addScoreSide 1;
 

 

 

 

 

The green is a script called plank https://github.com/kami-/plank?tab=readme-ov-file

this script does work on server, only if but it in a planced units init

Share this post


Link to post
Share on other sites

Generally, init lines in editor objects are run globally. If the unit is a player, I don't know what happens. I suspect the script could be run only on the local client. And then the script begins with: 

if (!isServer) exitWith {};

 

Maybe try calling it from init.sqf instead

  • Like 1

Share this post


Link to post
Share on other sites

I almost gave up, but came up with a possible other solution, just haven't gotten it to work yet.

 

 

The respawn script in the unit-----------------

On 2/26/2024 at 12:51 AM, JIMMI DEE BILLY BOB said:

0 = [this, "DELAY=",300, "INIT=", "{[_x] execVM 'Ticket1OFFn.sqf'} forEach units (group _proxyThis);"]spawn jebus_fnc_main;   

 

0 = [this, "DELAY=",300, "INIT=", " 
(group _proxyThis)[_unit, [6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 ,2 ,2, 0, 0, 0, 100, 100, 100, 60]] call plank_api_fnc_forceAddFortifications;"]
spawn jebus_fnc_main;

when loading, it says there is a problem there l

(group _proxyThis)l[_unit, [6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 ,2 ,2, 0, 0, 0, 100, 100, 100, 60]] call plank_api_fnc_forceAddFortifications;"]spawn jebus_fnc_main;

 

 

 

 

If this can work on a units init. on server, that should to in some way to. 😄 😢 

[_unit, [6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 ,2 ,2, 0, 0, 0, 100, 100, 100, 60]] call plank_api_fnc_forceAddFortifications;

 

Share this post


Link to post
Share on other sites

I have solved my problem, not the solution that I wanted, but it works, I have made a lot of vehicle start mission off map out under the water.

 

1vic----

 

this addEventHandler ["killed",{
deleteVehicle hunter1}];                                              

 this addEventHandler ["killed",{
hunter2 setPos (getPosATL Npad11)}];                                    

this addEventHandler ["killed",{hunter2 setDamage 0}];                                  

call compile preprocessFileLineNumbers "plank\plank_init.sqf";  [this, [ 0, 4, 0, 6, 0, 2, 2, 5, 5 ,8 ,10, 0, 10, 8, 80, 80, 80, 50]] call plank_api_fnc_forceAddFortifications;

 

2vic----

 

this addEventHandler ["killed",{
deleteVehicle hunter2}];                                                

this addEventHandler ["killed",{
hunter3 setPos (getPosATL Npad1)}];                                    

this addEventHandler ["killed",{hunter3 setDamage 0}];                                  

call compile preprocessFileLineNumbers "plank\plank_init.sqf"; [this, [ 0, 4, 0, 6, 0, 2, 2, 5, 5 ,8 ,10, 0, 10, 8, 80, 80, 80, 50]] call plank_api_fnc_forceAddFortifications;

 

And so on.

 

One hour a week for 3 months, that's how long it took 😄 

 

 

 

 

  • Like 2

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

×