Jump to content
Sign in to follow this  
Zombitch

Need help on making multiplayer mission

Recommended Posts

Hi,

My mission is almost ready, so I'm testing it. However I would like my mission to be playable in multiplayer, so yesterday I gave my mission to a friend who manage the server and he launched the mission on a multiplayer and the fact is some things do not work anymore on multiplayer.

If you ready to help me, you can download all sqf file here.

First thing I would like to tell you is sorry. Sorry because I'm not very comfortable (not at all in fact) with locality system.

So here are some problems (maybe it's important or not but the host is my friend's computer) :

1) There are 2 player only, at beginning all players lost their weapon and are adding in a boat cargo. The problem is I (as a player) do not get on the boat and I still have my weapon whereas for my friend it worked (he was on the boat without any weapons).

Here is one of the script I "launch" in the init.sqf :

if(isServer || isDedicated) then
{
Player1 moveInCargo RescueBoat;
Player2 moveInCargo RescueBoat;
removeAllWeapons Player1;
removeAllWeapons Player2;
removeHeadgear Player1;
removeHeadgear Player2;
Player1 unassignItem "NVGoggles";
Player1 removeItem "NVGoggles";
Player2 unassignItem "NVGoggles";
Player2 removeItem "NVGoggles";
}

2) All tasks (objectives) should be affected to all player. But the problem is that only my friend got the task. Me, I got nothing affected (no task).

Again here is the script I launch in the init.sqf to make tasks :

if(isServer || isDedicated) then
{
["FindStuff_task",true,["Find the box containing your stuff. It should be near a rock","Find stuff","Find stuff"],[3258,1731,0],"ASSIGNED",1,true,false] call BIS_fnc_setTask;
["RescueHostage1_task",true,["Rescue the first hostage.","Rescue Hostage #1","Rescue Hostage #1"],[2779,1746,0],"CREATED",1,true,false] call BIS_fnc_setTask;
["CallTheShip_task",true,["Talk to the lighthouse keeper to call the boat.","Call the ship","Call the boat"],[2717,954,0],"CREATED",1,true,false] call BIS_fnc_setTask;
["CallTheShip_task",true,["Talk to the lighthouse keeper to call the ship.","Call the ship","Call the ship"],[2717,954,0],"CREATED",1,true,false] call BIS_fnc_setTask;
}

3) In order to succeed the first task, I made a trigger (with the ingame Arma3 Editor) with this condition :

cursorTarget == myGearBox

And when the condition meet I do the following (in order to complete the task) :

["FindStuff_task","SUCCEEDED"] call BIS_fnc_taskSetState;

This works fine when I play singleplayer, but in multiplayer it doesn't works. I aim at the gear box and nothing happens this is maybe normal since I don't have any task setted up. So I asked my friend to aim the gearbox and he told me that nothing happen. Are there some work to do to make cursorTarget working on multiplayer ? (is it available in multiplayer ?)

Now, it's time to thank you very much for reading me ;).

See you.

Edited by Zombitch

Share this post


Link to post
Share on other sites

if(isServer || isDedicated) then
{
Player1 moveInCargo RescueBoat;
Player2 moveInCargo RescueBoat;
removeAllWeapons Player1;
removeAllWeapons Player2;
removeHeadgear Player1;
removeHeadgear Player2;
Player1 unassignItem "NVGoggles";
Player1 removeItem "NVGoggles";
Player2 unassignItem "NVGoggles";
Player2 removeItem "NVGoggles";
}

I think the reason this only works for 1 player is because it's asking the server or host to make these changes. Any changes to the player character should generally be done by the client.

Try this instead:

waitUntil{!(isNull player)};
_p = player
   _p moveInCargo RescueBoat;
   removeAllWeapons _p;
   removeHeadgear _p;
   _p unassignItem "NVGoggles";
   _p removeItem "NVGoggles";

This will launch on every client and NOT the server. It then gets the clients player and does the stuff you want to that player.

Edited by chaoticgood

Share this post


Link to post
Share on other sites

Don't surround the task inside the condition of

isServer || isDedicated.

By doing that only the server can get the task and if it was a dedicated server then no one will see the task.

You created the task where only the task is local which is good since you made sure that everyone will get the task. Erase the condition and just make sure that the last parameter is false.

We don't want it to be global since everyone will have the task when their game reads in the init.sqf. As far as the trigger please explain what condition do you want to happen. What do you want to do with myGearBox?

Share this post


Link to post
Share on other sites

Thanks for your answers guys, I will try your solutions when I'll get back home.

@Johnson11B2P

The thing I want to do with the trigger and myGearBox is :

If one of the players is near the gearbox (player distance gearbox < 20) AND the player aim the gearbox then make the current task succeed.

Can you help about that ? :)

Share this post


Link to post
Share on other sites

ok, so now almost everything work, thank you very much!

I'll explain what I've change step by step :

1) About initialize the players I have exaclty done what chaoticgood said. So i put exctly this in the init.sqf file :

 waitUntil{!(isNull player)};
_p = player
_p moveInCargo RescueBoat;
removeAllWeapons _p;
removeHeadgear _p;
_p unassignItem "NVGoggles";
_p removeItem "NVGoggles";

There still a bug with this, the only thing that don't work is the moveInCargo function (in order to place the player in the rescueBoat). In fact my friend who host the game and play with me was on the boat, but me I wasn't. So if you have any idea ? (maybe as I am a client, at the init phase my client don't know what is the RescueBoat ?)

Maybe if I do something like that it will work : (I will try afterwork)

if(isServer || isDedicated)
{
   Player1 moveInCargo RescueBoat;
   Player2 moveInCargo RescueBoat;
}

waitUntil{!(isNull player)};
_p = player
removeAllWeapons _p;
removeHeadgear _p;
_p unassignItem "NVGoggles";
_p removeItem "NVGoggles";

(Player1 and Player2 are the names of the players that I set in the editor).

2) About the task, I have done again exactly what Johnson11B2P said and it works like a charm!

3) About the cursorTarget it works an both multiplayer AND single player. In fact I think my trigger with the condition :

 (cursorTarget== myGearBox) 

and that do the following when condition meet :

["FindStuff_task","SUCCEEDED"] call BIS_fnc_taskSetState;

Wasn't working because I was creating the task only when it was a server (checking isServer), so the player wasn't able to succeed task since the task was set on server side. When I made the Johnson11B2P changes all worked.

Thanks guys.

Share this post


Link to post
Share on other sites
ok, so now almost everything work, thank you very much!

I'll explain what I've change step by step :

1) About initialize the players I have exaclty done what chaoticgood said. So i put exctly this in the init.sqf file :

 waitUntil{!(isNull player)};
_p = player
_p moveInCargo RescueBoat;
removeAllWeapons _p;
removeHeadgear _p;
_p unassignItem "NVGoggles";
_p removeItem "NVGoggles";

There still a bug with this, the only thing that don't work is the moveInCargo function (in order to place the player in the rescueBoat). In fact my friend who host the game and play with me was on the boat, but me I wasn't. So if you have any idea ? (maybe as I am a client, at the init phase my client don't know what is the RescueBoat ?)

Yes, you need to make sure the client knows what "RescueBoat" is. The client should know what it is because it's a global variable, if you placed the boat in the editor then you need to make sure "RescueBoat" (without quotes) is in the name field so the client knows which boat you are refereing to.

The only other thing I can think of is it might be trying to put you both in the same slot at the same time which probably won't work. If this is the case then this might work:

waitUntil{!(isNull player)};
_p = player
_p moveInCargo [RescueBoat,1];
if(!(_p in RescueBoat))then{_p moveInCargo [RescueBoat,2];};
removeAllWeapons _p;
removeHeadgear _p;
_p unassignItem "NVGoggles";
_p removeItem "NVGoggles";

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  

×