Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
frosties

How to "seize zones" in MP games?

Recommended Posts

Hello,

Me and a friend is trying to create our own missions.

We want two sides in MP to be fighting over several objectives.

How do we add a area to be taken, and how can we show wich team holds that area?

Share this post


Link to post
Share on other sites

The most realistic way would probably to have a flag or something that changes according to who is in control.

The most simplest way is probably something like this.

A marker for the area. If it is Grey noone has taken control. If it is Blue then Blu(e)for and if it is red then opfor is in control.

This marker will be controlled using a trigger. Make it "ANYBODY PRESENT" and REPEATABLE where you can do something like this:

//Condition
(floor time) % 5 == 0
//On act:
blufors = {side _x == west} count thisList;
opfors = {side _x == east} count thisList;
if (blufors == opfors) then {
 "TheMarkerName" setMarkerColor "ColorGreen";
} else {
   if (blufors > opfors) then {
     "TheMarkerName" setMarkerColor "ColorBlue";
   } else {
     "TheMarkerName" setMarkerColor "ColorRed";
   };
};
//On deact (no one in trigger/area)
"TheMarkerName" setMarkerColor "ColorGreen";

Then every 5s the color of the marker will update to show who is in numerical control. If they are evenly numbered then it will be green.

Edit: Nevermind the nevermind, I made it work.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

Ive added this code into the area and it seems to work.

The green color shows up right away, and every 5s it blinks blue when im in the area then it turns green again?

Shouldnt it stay blue until a red player gets in?

Or does it switch when i leave? .. if so.. i can i make it stay blue until the enemy takes the area?

Edited by Frosties

Share this post


Link to post
Share on other sites

It should not blink blue, just turn blue, while you are still in the area and has not left. Does it blink constantly?

If you don't want it to change back when no one is around, then remove the deactivation part.

Share this post


Link to post
Share on other sites

it turns green when i start the game.. and when i am in the area it shows as blue every 5s then turns green again.

when i leav its just green

Edit: i removed the deactivation parts and it made it to stop blink, its red when there is an enemy there, when i kill him it turns green and when i enter it turns blue.. however.. when i leave it turns green again anyway....

Edit2: i removed the IF that checks if the number of bluefor/opfor is equal, now the blue stays after i cleared it

---------- Post added at 19:46 ---------- Previous post was at 19:24 ----------

Another related question:

How can i add so that each team gets an objective that tells them to "capture each area" and when they have hold all objectives for a certain amount of time they win or something like that?

Edited by Frosties

Share this post


Link to post
Share on other sites

Glad you got it working.

Another related question:

How can i add so that each team gets an objective that tells them to "capture each area" and when they have hold all objectives for a certain amount of time they win or something like that?

For the actual telling them part you can use tasks: http://community.bistudio.com/wiki/Tasks

For the holding all objectives and then winning you use triggers. Right after you set the color of the markers

"MarkerNameA" setMarkerColor "ColorBlue";

you can set an variable:

"TheMarkerName" setMarkerColor "ColorBlue";
controlsAreaA = "Bluefor";

If you would set the marker to red you set the variable to Opfor. For you other areas you use controlsAreaB and so on.

Then you create a trigger that checks if anyone has won. In bluefor's case you write this in the condition:

controlsAreaA == "Bluefor" && controlsAreaB == "Bluefor" && controlsAreaC == "Bluefor"

On activation you can use something like:

bluforWins = true; opforLoses = true; 

Then you create 2 triggers one for win and one for lose:

side == west && bluforWins

Then you want END1 perhaps:

endMission "END1";

The lose trigger:

side == west && bluforLoses

Then you want END2:

endMission "END2";

And similar for the opfor triggers.

The text that they see on the debriefing you define in briefing.html: http://community.bistudio.com/wiki/Briefing.html#Endings.

If you want a side to be in control at least 30s for example before winning then you can set the timeout values (min, mid and max) to 30 in the trigger and set it to timeout. Then if someone breaks control say at 20s and then get killed you will have to start over again with the 30s.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

really dont like the BI wiki.. it got lots of useful information, but lacks HOW to use it..

should i create a new file, what would it be called.

Do i add it in the editor, and where.. :D

Share this post


Link to post
Share on other sites

The area that needs to be taken is working, kindof..

It turns blue when i enter with BLUFOR, but turns red when i leave the area...

Without enemy personell in it...

code:

blufors = {side _x == west} count thisList;  opfors = {side _x == east} count thisList;  if (blufors > opfors) then {        "Alpha" setMarkerColor "ColorBlue"; controlsAlpha= "BlueFor";      } else {        "Alpha" setMarkerColor "ColorRed"; controlsAlpha= "OpFor";     };

What have i done wrong?

Is there something i can add to this marker to make it easy with the task completion?

e.g When the area is taken by bluefor the blufor players sees it as completed and opfor failed.. but still if they retake it, it will show up as completed?

Share this post


Link to post
Share on other sites

It is because the code just checks if there are more blufors than opfors. Then it makes it blue. If there are not then it makes it red.

if (blufors > opfors) then {
 "TheMarkerName" setMarkerColor "ColorBlue";
};
if (opfors > blufors) then {
 "TheMarkerName" setMarkerColor "ColorRed";
};

Then you won't get this issue when no one is around. The last color set will remain.

Share this post


Link to post
Share on other sites

It seems to be working! Thanks!

Now how can i connect the capture of this area to a task that have been given?

And when the area is BLUEFOR the blufor task shows as complete and opfors failed?

Share this post


Link to post
Share on other sites

Where you can use triggers for that too.

Condition:

controlsAlpha == "Bluefor" && side player == west

On act:

tskAlpha setTaskState "Succeeded"

Similiar for the failed:

Condition:

controlsAlpha == "Opfor" && side player == west

On act:

tskAlpha setTaskState "Failed"

Share this post


Link to post
Share on other sites

this is working!

If i would like to use it with two playable sides?

Can i just change the player == west to player == east and have it the other way around?

Share this post


Link to post
Share on other sites

I'm trying to get that script working mentioned on the first page, does floor time have to be defined in init? my mp mission has three sides so i've copied and pasted some additional code to it.

//Condition

(floor time) % 5 == 0

//On act:

blufors = {side _x == west} count thisList;

opfors = {side _x == east} count thisList;

Indep = {side _x == guerilla} count thisList;

if (blufors == opfors) then {

"camp1" setMarkerColor "ColorOrange";

} else {

if (blufors > opfors) then {

"camp1" setMarkerColor "ColorBlue";

} else {

"camp1" setMarkerColor "ColorRed";

};

};

if (blufors == indep) then {

"camp1" setMarkerColor "ColorOrange";

} else {

if (blufors > indep) then {

"camp1" setMarkerColor "ColorBlue";

} else {

"camp1" setMarkerColor "ColorGreen";

};

};

if (opfors == indep) then {

"camp1" setMarkerColor "ColorOrange";

} else {

if (opfors > indep) then {

"camp1" setMarkerColor "ColorRed";

} else {

"camp1" setMarkerColor "ColorGreen";

};

};

//On deact (no one in trigger/area)

"TheMarkerName" setMarkerColor "ColorGreen";

This doesn't work, i don't get any debug errors either. I have been trying with using Seize by triggers, and had limited success.

I wonder if the script above is too long to put into Activation? I am aware that triggers are suppose to be global across the network,

I guess i could try using public variables and have three triggers that will change the marker colour when true, and run the one script (above)

when inside a "anybody present" trigger.

Would that be sufficient for MP? including JIP players?

Share this post


Link to post
Share on other sites
Sign in to follow this  

×