Jump to content

Sign in to follow this  
Feriluce

Script not executing on dedicated server.

Recommended Posts

I have a problem with my extraction script. It is supposed to spawn a chinook and and 4 su-30's and set up some waypoints so the planes shoot down the chopper. It also unlocks some hinds.

This works perfectly fine on my local server, but when i tried it on a dedicated server, nothing after the if (!isserver) exitWith {}; executed.

I really have no idea where I'm going wrong. do I need to run it on all clients? If so wont it spawn a chinook for every player on the server?

Here is the script:

  Reveal hidden contents

Share this post


Link to post
Share on other sites

The hints at the end won't do anything since all your players have left the script by then. Does all of this spawn close enough to the player to tell if it worked or not?

I'd wrap all the spawning stuff in an isServer block instead of leaving the script early. That way your hints will work at the end.

Share this post


Link to post
Share on other sites
  kylania said:
The hints at the end won't do anything since all your players have left the script by then. Does all of this spawn close enough to the player to tell if it worked or not?

I'd wrap all the spawning stuff in an isServer block instead of leaving the script early. That way your hints will work at the end.

Well that might be an idea, but I'm not sure it would solve the problem. None of the code after the !isserver check is executed. The code before works.

The stuff spawns pretty close, and you will be able to see the chopper within 30 seconds or so. It'll then get shot down directly over the players heads.

Again, this works 100% fine on a local server, but doesn't trigger when I tested it on a dedicated.

Share this post


Link to post
Share on other sites

Hi there,

just wrapping stuff into isServer blocks (or exiting it half-way through) is not the best solution to make it work on both dedicated and hosted environments. Because if you host a game you are the server and a client.

It's important that you split up client and server stuff.

In this case you make 2 files and launch them at the same time...

One for the server (All the commands with global effect):

if (!isserver) exitWith {};

"extractmark2" setmarkertype "arrow";
"extractmark2" setmarkercolor "colorblue";
deletemarker "extractmark";

hind1 setVehicleInit "this lock false";
hind2 setVehicleInit "this lock false";
hind3 setVehicleInit "this lock false";
processInitCommands;

_grp0 = creategroup WEST;
_grp = creategroup EAST;

_helodata = [getmarkerpos "helospawn", 320, "CH_47F_EP1", _grp0] call bis_fnc_spawnvehicle;
_helo = _helodata select 0;
_helo flyinheight 200;
_helo setpos [getpos _helo select 0, getpos _helo select 1, 200];

wp0 = _grp0 addwaypoint [getmarkerpos "helowp", 0];
wp0 setwaypointtype "LOAD";

sleep 40;

_plane1data = [getMarkerpos "spawn1", 240, "ACE_Su30_Des", _grp] call bis_fnc_spawnvehicle;
_plane1 = _plane1data select 0;
_plane1 flyinheight 300;
_plane1 setpos [getpos _plane1 select 0, getpos _plane1 select 1, 300];
_plane2data = [getMarkerpos "spawn2", 240, "ACE_Su30_Des", _grp] call bis_fnc_spawnvehicle;
_plane2 = _plane2data select 0;
_plane2 flyinheight 300;
_plane2 setpos [getpos _plane2 select 0, getpos _plane2 select 1, 300];
_plane3data = [getMarkerpos "spawn3", 240, "ACE_Su30_Des", _grp] call bis_fnc_spawnvehicle;
_plane3 = _plane3data select 0;
_plane3 flyinheight 300;
_plane3 setpos [getpos _plane3 select 0, getpos _plane3 select 1, 300];
_plane4data = [getMarkerpos "spawn4", 240, "ACE_Su30_Des", _grp] call bis_fnc_spawnvehicle;
_plane4 = _plane4data select 0;
_plane4 flyinheight 300;
_plane4 setpos [getpos _plane4 select 0, getpos _plane4 select 1, 300];

wp1 = _grp addwaypoint [getmarkerpos "planeattack", 0];


sleep 15;

{_x setdamage 1} foreach units _grp0;

sleep 60;

{{deleteVehicle _X} forEach (crew _x)+[_x]} forEach [_plane1, _plane2, _plane3, _plane4];

[b][color="SeaGreen"]HeloIsDown = true; publicVariable "HeloIsDown";[/color][/b]

And one for the clients:

taskobj8 settaskstate "SUCCEEDED";

[b][color="SeaGreen"]waitUntil {!isNil "HeloIsDown"};[/color][/b]

hint "Your only means of extraction have just been shot down right in front of you. You have to get out of here!";
sleep 10;
hint "You could risk the drive through the hotzone, but you may be able to find a faster way in the nearby airstrip.";

As you can see i make the clients wait until the variable HeloIsDown exists. (Which is being created at the end of the server file), this is one way to get the timing right for all clients including the one that hosts.

My structure looks always like that:

Task1_Server.sqf

Task1_Client.sqf

Task2_Server.sqf

etc.

Keep them always separated for MP missions.

Share this post


Link to post
Share on other sites
  Demonized said:
how are you starting it in mission? is it a trigger or action?

A trigger. The trigger is working in MP. Its the script that isn't.

Share this post


Link to post
Share on other sites
  ST_Dux said:
What is the condition of the trigger?

it checks the area for a green smoke, and of objdone is set it triggers. However, I already know my trigger is working, because the variable it sets is set, and the first few lines of the script executed, removing the marker etc.

Share this post


Link to post
Share on other sites

My guess is that the trigger is firing on the clients but not the dedicated server, which would explain why nothing after the server check is being run in your script. How exactly does the trigger check if "objdone" is set? Are you sure that the dedicated server is able to recognize this?

Share this post


Link to post
Share on other sites
  ST_Dux said:
My guess is that the trigger is firing on the clients but not the dedicated server, which would explain why nothing after the server check is being run in your script. How exactly does the trigger check if "objdone" is set? Are you sure that the dedicated server is able to recognize this?

((count ((markerpos "CheckSmoke") nearObjects ["Smokeshellgreen",100])) > 0) && objdone;

Is the condition for the trigger. And I have no idea if its able to regocnize it. So far getting all clients and the server to see the same thing is a complete nightmare and its not at all clear how to do it.

Edit: I think I might have an idea why its not working. To test it I used the debug addon to set the variable. However, that might just be local. I do believe the markers disappeared for the other persons on the server though, so I could be wrong.

Edited by Feriluce

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
Sign in to follow this  

×