Jump to content
domcho

Multiplayer mission only works properly for the host

Recommended Posts

My mission works correctly in singleplayer, but in multiplayer it only works properly for the host. For some weird reason the end trigger gets executed prematurely for the non-host player(s). My first trigger:

Condition: ({alive _x} count units apcGrp == 0) AND ({alive _x} count units tankGrp == 0)
Activation: deadAttackers = true

2nd trigger (5 seconds delay):

Condition: deadAttackers
Activation: "2" objStatus "DONE"; hint "Objective completed"; end1 = true

3rd trigger (12 seconds delay) that ends the mission with End1

Condition: end1

apcGrp consists of 2 M113s, tankGrp consists of 1 M1A1 (squad leader) and 2 M60 tanks.

 

For some reason the condition of the first trigger always returns true for the non-host player(s) at the very start of the game. Putting

deadAttackers = false;

in the init.sqs did not solve the issue. The missions just ends for the non-host player(s) with the 2nd objective completed.

Any ideas? Could it be that because the units that are being checked if they are alive are crew members inside vehicles and are somehow local to the host? So the host sees them as alive but the other players don't? To me it seems like a weird bug.

  • Like 1

Share this post


Link to post
Share on other sites

I managed to figure it out. For some weird reason a group occupying populated vehicle(s) placed in the editor seem to initialize properly only in singleplayer. In multiplayer they initialize properly only for the server (host). For the clients, the groups appear to be empty which is why checking for the amount of alive units of that group will return 0 for clients. To solve my issue, since I am playing Operation Flashpoint v1.96 I placed a Game Logic object in my mission and named it "server". Then I changed my first trigger to this:

Condition: (({alive _x} count units apcGrp == 0) AND ({alive _x} count units tankGrp == 0)) AND local server
Activation: deadAttackers = true; publicVariable "deadAttackers"

Since Game Logics are always local to the server/player host this trigger will only fire for the player host in multiplayer. Then with publicVariable command I can change "deadAttackers" value for the clients as well, so that the next trigger will work for both the host and the clients.

 

If you are playing ArmA: Cold War Assault (or in other words Operation Flashpoint version 1.99) instead of placing Game Logic, you can use the command isServer which has been backported into ArmA:CWA.

 

These two particular topics were helpful:

Multiplayer Scripting

A view on (Multiplayer) Scripting, by Sickboy

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

×