Jump to content
Sign in to follow this  
Bunny75

Sector control in MP and COOP

Recommended Posts

I'm obviously quite beginner at scripting and have strugled to get my MP mission working quite awhile. So I hope someone could help.

I'm working on a mission where only west can capture sectors, moving respawn point forward sector by sector like and east's respawn moves accordingly backwards. So i't like a push mode mission, but only for one direction. This was meant to be made to COOP also.

In every sector I have a trigger:

Seized by: BLUFOR repeatedly

on act: [1]exec"sectorCheck.sqs";

(number of sector from 1 to 3. 0 is carrier where you begin)

sectorCheck.sqs contains:

_sectorNr = _this select 0


if (_sectorNr == 1) then {goto "capture1"}; 
if (_sectorNr == 2) then {goto "capture2"}; 
if (_sectorNr == 3) then {goto "capture3"}; 




#capture1
deleteVehicle sectorTrigger_1
"respawn_west" setMarkerPos getMarkerPos "sector_1"
"sector_1" setMarkerType "hd_flag"
hint "Sector 1 captured"
exit




#capture2
_mType = getMarkerType "sector_1";
if(_mType == "hd_flag")}then{
deleteVehicle sectorTrigger_2;
"respawn_west" setMarkerPos getMarkerPos "sector_2";
"sector_2" setMarkerType "hd_flag";
hint "Sector 2 captured"; 
exit;
}else{
hint "Capture sector 1 first!"; 
exit;
};




#capture3
_mType = getMarkerType "sector_2"; 
if(_mType == "hd_flag")}then{
deleteVehicle sectorTrigger_3;
"respawn_west" setMarkerPos getMarkerPos "sector_3";
"sector_3" setMarkerType "hd_flag";
hint "Sector 3 captured"; 
exit;
}else{
hint "Capture sector 2 first!"; 
exit;
};

sector_1 - 3 are markers where the respawn_west marker is positioned after capture. The marker type checking is the latest one which I tried and I can't get it to work like anything else I tried. I can capture any flag no matter in which order.

So my problem is:

- What is wrong with that script?

- If thats not doable then how can I make a global variable that the script checks and decides if I can capture certain sector? I used to know how to do this in OFP, but can't get anything work now.

- I tried to make those global variables to init.sqf (the one thats loaded at the beginning of the game) simply by sectorCaptured = 1; but with no success. Is the init .sqf or .sqs and what's the difference?

And majorly

- What do I have to add to the scripts or in the ditor if I make a MP or COOP? I added the game logic in the editor, but do I have to write something into it? What do I have to consider when making scripts?

Share this post


Link to post
Share on other sites

Just have the trigger activate once. Have the activation trigger a variable change, which later zones will require in their condition. For some reason I can only get boolean to work on trigger condition - though I can change any definition in the activation and have a script work from it. Don't know what to do there...

For MP, isServer will need to execute a publicVariable, with an addPublicEventHandler telling the client what must happen (exec a script I assume, using switch or if or the like to update according to variable), and an onPlayerConnected reference.

Share this post


Link to post
Share on other sites

You are missing a ton of semi-colons in the code, for example on line 1. That'd be a good start to fixing it ;)

Plus it seems to be both sqs and sqf combined? Not good. Make it sqf only and delete the icky gotos...

Secondly, by the sounds of the design, I would advice using multiple instances of the same script and simple sending [previoustrigger,previousmarker,newspawnposition] to it as this would be the same for all flags (for the first flag, values are null).

For MP, markers are global (unless you use the local command) so they should update. I think the trigger is global? Hint however is not, so that you need to broadcast to everyone on the server.

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  

×