Jump to content
Sign in to follow this  
Black²

Capture gamemode!

Recommended Posts

Hey guys, it's been a while since I've done this but I could really need some help! :eek:

So for this unit I'm in (6th AB div) I'm making a tvt mission.

We used to play Resistance and Liberation (Source engine mod) which had Capture gamemodes, I'm trying to implement something similar in ArmA2.

I got 3 round markers which act as capture zones, named C1, C2 and C3 with their own triggers which check team (west and east) numbers and coloring it blue or red, green for even numbers or empty.

This is what I have so far in the activation field of one of the cap area triggers.

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";

};

};

However, when in testing I kill an opfor player in that area.. it does turn blue showing that team west has "captured" it.

Now when I leave the capture area it goes green again! I need it to stay blue when west captured it or red when east captured it.

Ughh, please BIS community.. help a bro out haha!

Peace!

(I am aware of the pvpmissionwizard but I tried it and it just messed stuff up for me.)

Share this post


Link to post
Share on other sites

create marker named " mrk_zone1" ; then setup trigger / trigger1: opfor - present - repeatedly. on act: "mrk_zone1" setMarkerColor "ColorRed"; on de-act:"mrk_zone1" setMarkerColor "ColorBlue"; then same thing again only for blufor..

Share this post


Link to post
Share on other sites

Or you could always wait a few hours for conquest beta to release :D. Unless the satisfaction of making your own is too great! Cheers.

Share this post


Link to post
Share on other sites
create marker named " mrk_zone1" ; then setup trigger / trigger1: opfor - present - repeatedly. on act: "mrk_zone1" setMarkerColor "ColorRed"; on de-act:"mrk_zone1" setMarkerColor "ColorBlue"; then same thing again only for blufor..

Wont this just reset the marker to Blufor by default when Opfor leaves? The points shouldnt be controlled by default!

Hmm.. if I use on de-act:"mrk_zone1" setMarkerColor "ColorRed"; for deactivation.. oh snap.

Thanks dude, why didnt I think of that!

Or you could always wait a few hours for conquest beta to release :D. Unless the satisfaction of making your own is too great! Cheers.

Yeah thanks for that but I'd rather learn to write my own stuff again instead of leaching of other peoples skills haha!

Your version looks nice but really overcomplicated for my RNL style capture gamemode =)

Edited by Black²

Share this post


Link to post
Share on other sites

Here's some code for capturing a zone. Maybe you could get some ideas from this. As the actual c&h mode in conquest is based off a simple concept.

Trigger named zone1 - whatever size you want, but works better with smaller sizes, because of how it functions. ie; 20x20. Note: The marker that's changing colors can be any size. The marker name in this example is Zone1M.

Anyone present
once
Cond: this && IsServer
Activation:  _handle = [] Spawn ZONE1_FNC

Init.sqf

If (IsServer) Then {[] call compile preProcessFile "zone1.sqf";};

[] spawn {
WaitUntil {Sleep 5;Local Player};
Player AddRating 999999;
};

onplayerConnected {execVM "markerJip.sqf"};

markerJip.sqf

_markers = ["Zone1M"];
{
_x setMarkercolor (getMarkercolor _x);
}foreach _markers;

zone1.sqf

Z1EastCap = 10;
Z1WestCap = 10;

EAST_ZONE1 = False;
WEST_ZONE1 = False;
NEUTRAL_ZONE1 = False;

ZONE1_FNC = 
{

   While {True} Do 
   {
       If (({Alive _x && (Side _x) == West} Count List Zone1) > ({Alive _x && (Side _x) == East} Count List Zone1) && (Z1WestCap > 0)) Then 
       {
         Z1WestCap = Z1WestCap - 1;
         If (Z1EastCap < 10) Then {Z1EastCap = Z1EastCap + 1;};
       };

       If (({Alive _x && (Side _x) == East} Count List Zone1) > ({Alive _x && (Side _x) == West} Count List Zone1) && (Z1EastCap > 0)) Then 
       {
         Z1EastCap = Z1EastCap - 1;
         If (Z1WestCap < 10) Then {Z1WestCap = Z1WestCap + 1;};
       };

       If (({Alive _x && (Side _x) == West} Count List Zone1) == 0 && ({Alive _x && (Side _x) == East} Count List Zone1) == 0 && (Z1EastCap != 0) && (Z1WestCap != 0)) Then
       {
           If (Z1WestCap == 10) ExitWith {}; 
           Z1WestCap = 10;
           Z1EastCap = 10;
       };

       If (({Alive _x && (Side _x) == West} Count List Zone1 > 0) && ({Alive _x && (Side _x) == East} Count List Zone1 > 0))  Then 
       {
         If (MarkerColor "Zone1M" != "ColorYellow") Then {"Zone1M" SetMarkerColor "ColorYellow";PublicVariable "Zone1M";};
         If (!NEUTRAL_ZONE1) Then {NEUTRAL_ZONE1 = True;PublicVariable "NEUTRAL_ZONE1";};
         If (EAST_ZONE1) Then {EAST_ZONE1 = False;PublicVariable "EAST_ZONE1";};
         If (WEST_ZONE1) Then {WEST_ZONE1 = False;PublicVariable "WEST_ZONE1";};
       };

       If ((Z1WestCap < 1) && ({Alive _x && (Side _x) == East} Count List Zone1 == 0))  Then   
       {

         If (MarkerColor "Zone1M" != "ColorGreen") Then {"Zone1M" SetMarkerColor "ColorGreen";PublicVariable "Zone1M";};     
         If (NEUTRAL_ZONE1) Then {NEUTRAL_ZONE1 = False;PublicVariable "NEUTRAL_ZONE1";};
         If (EAST_ZONE1) Then {EAST_ZONE1 = False;PublicVariable "EAST_ZONE1";};
         If (!WEST_ZONE1) Then 
            {
              sleep 0.005;
              WEST_ZONE1 = True;
              PublicVariable "WEST_ZONE1";

            };

               []Spawn WEST_SCORE;
       };

       If ((Z1EastCap < 1) && ({Alive _x && (Side _x) == West} Count List Zone1 == 0)) Then 
       {
         If (MarkerColor "Zone1M" != "ColorRed") Then {"Zone1M" SetMarkerColor "ColorRed";PublicVariable "Zone1M";};  
         If (NEUTRAL_ZONE1) Then {NEUTRAL_ZONE1 = False;PublicVariable "NEUTRAL_ZONE1";};
         If (!EAST_ZONE1) Then 
            {
              EAST_ZONE1 = True;
              PublicVariable "EAST_ZONE1";

            };

         If (WEST_ZONE1) Then {WEST_ZONE1 = False;PublicVariable "WEST_ZONE1";};

       };


         Sleep 1;
   };



};



Share this post


Link to post
Share on other sites

Pow there we go! Much appreciated! AFK from arma atm but I'll update this thread if I have anything + sum it all up so others can use it as well!

THAANKSSS!!!!!

Share this post


Link to post
Share on other sites

Hi guys the script is great and works like a charm. But I have a little questions would it be very difficult to add 2 things to the script.

1) A visual bar showing a capture rate like in AAS with a percentage or something similar.

2) This is apart, a trigger or triggers that would end the mission with east or west wining or a stalemate if nobody captures all the flags in some time like 2 hours.

I'm trying to break into bits some of the code of the great AAS mission with a friend with a bit more knowledge than me in coding to make realistic tvt missions for ACE and I got everything solved except the capture zones and end mission triggers.

If searched a lot in the forums

thanks a lot

Edited by Jaime

Share this post


Link to post
Share on other sites

Because aas is to complicated has millions of scripts and lots off things y dont need. I just need some zones to be captured with some type of visual effects like hints or something like that and the triggers to end the mission.

I will deal with respawns weapons logistics and the rest.

Share this post


Link to post
Share on other sites

Oh does it? I didn't realize such a simple mode has alot of scripts. Anyhow, you'd want to setup that script to run on the server and use PVEH and side command to broadcast the hints.

Here's an example of how to do it. It's how I did it in conquest mode (still a WIP c&h mode, 95% done). Works really well on dedicated. though I'm sure someone can come with a more refined solution.

//[]call compile preprocess "pveh.sqf"

"WEST_ZONE1" addPublicVariableEventHandler 
{


      If ((Side Player == West) && (WEST_ZONE1)) Then 
      {
        PlaySound "Captured";
        hintSilent parseText format["<img size='1.25' image='%1'/><br/>Your team has captured<br/><t color='#00FF00' size='1.25' align='center'>Feruz'Abad</t>", pictureG];


      };


      If ((Side Player == East) && (WEST_ZONE1)) Then 
      {
        PlaySound "LostZone";
        hintSilent parseText format["<img size='1.25' image='%1'/><br/>Your team has lost<br/><t color='#00FF00' size='1.25' align='center'>Feruz'Abad</t>", pictureG];

      };



};


"EAST_ZONE1" addPublicVariableEventHandler 
{


      If ((Side Player == East) && (EAST_ZONE1)) Then 
      {
        PlaySound "Captured";
        hintSilent parseText format["<img size='1.25' image='%1'/><br/>Your team has captured<br/><t color='#FF0000' size='1.25' align='center'>Feruz'Abad</t>", pictureR];

      };


      If ((Side Player == West) && (EAST_ZONE1)) Then 
      {
        PlaySound "LostZone";
        hintSilent parseText format["<img size='1.25' image='%1'/><br/>Your team has lost<br/><t color='#FF0000' size='1.25' align='center'>Feruz'Abad</t>", pictureR];

      };



};

Share this post


Link to post
Share on other sites

Thanks a lot iceman going to work this afternoon with it and see how it works.

ASS is great but has too much going for mi level of editing its got scores, respawns and load of things going on the mission too much for me right know.

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  

×