d3nn16 3 Posted July 5, 2008 I did a quick search and didn't find any thread talking about how to make a CTF map from scratch. I made my own CTF map with a basic scoring system but without using the triggers technique instead I used a finite state machine model using switch controls to track the flag state. I also tried to make simple scripts and use minimum triggers, variables, etc. Download pbo file here Mission name (in editor) : ctf_40_plato_de_cayo_v00beta Folder name : ctf_40_plato_de_cayo_v00beta.Sara List of files : $PBOPREFIX$ <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ctf_40_plato_de_cayo_v00beta This file contains the name of the mission file after compression using the editor "Export to multiplayer missions" option when clicking the "Save" button. The example above will result in ctf_40_plato_de_cayo_v00beta.Sara.pbo description.ext <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onLoadMission   = "P L A T O  D E  C A Y O"; onLoadMissionTime = 0; respawn    = "BASE"; respawnDelay = 10; disabledAI = 1; titleParam1   = "Time/Score Limit :"; valuesParam1[] = {86400, 300, 600, 900, 1200, 1500, 1800, 2700, 3600, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; defValueParam1 = 1800; textsParam1[]  = {"24 hours", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "25 minutes", "30 minutes", "45 minutes", "1 hour", "1 point", "2 points", "3 points", "4 points", "5 points", "6 points", "7 points", "8 points", "9 points", "10 points"}; titleParam2   = "Weapons :"; valuesParam2[] = {1000,  1001,  1002,  1000, 2000,  2001, 2002,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10,  11,  12,  13,  14,  15,  1000,  3000,  3001,  3002,  16,  17,  18,  19,  20,  21,  1000,  4000,  4001,  4002,  22,  23,  24,  1000,  5000,  5001,  5002,  25,  26,  27,  28,  29,  1000,  6000,  6001,  6002,  30,  31,  32,  33}; defValueParam2 = 1000; textsParam2[]  = {"Random",  "Full Random",  "Menu",  "-----",  "Rifle",  "Rifle Random",  "Rifle Menu",  "-> M16A2",  "-> M16A4",  "-> M16A4 ACG",  "-> M4",  "-> M4 AIM",  "-> M4A1 SD",  "-> M4A1",  "-> G36K",  "-> G36C",  "-> G36A",  "-> MP5A5",  "-> MP5 SD",  "-> AK74",  "-> AKS74U",  "-> AKS74UN",  "-> AKS74 PSO",  "-----",  "GL",  "GL Random",  "GL Menu",  "-> M16A2 GL",  "-> M16A4 GL",  "-> M16A4 ACG GL",  "-> M4 ACG GL",  "-> M4A1 ACG GL",  "-> AK74 GL",  "-----",  "MG",  "MG Random",  "MG Menu",  "-> M249",  "-> M240",  "-> PK",  "-----",  "Sniper",  "Sniper Random",  "Sniper Menu",  "-> Mk12 SPR",  "-> M24",  "-> M107",  "-> SVD",  "-> KSVK",  "-----",  "Handgun",  "Handgun Random",  "Handgun Menu",  "-> M9",  "-> M9 SD",  "-> Makarov",  "-> Makarov SD"}; class Header {   gameType = CTF;   minPlayers = 2;   maxPlayers = 40; }; #include "weapon_menu.hpp" You can find details about this file at http://community.bistudio.com/wiki/Description.ext weapon_menu.hpp <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#define CT_STATIC 0 #define CT_BUTTON 1 #define ST_LEFT 0x00 #define FONT0 "Zeppelin32" #define START_X 0.0 #define START_Y 0.0 class RscCase1 {   idc = 1;   type = CT_BUTTON;   style = ST_LEFT;   w = 0.15;   h = 0.035;   font = FONT0;   sizeEx = 0.023;   colorText[] = { 0, 0, 0, 1 };   colorBackground[] = { 1, 1, 1, 1 };   default = false;   colorDisabled[] = { 0, 0, 1, 1 };   colorFocused[] = { 0.8, 1, 0.5, 1 };   colorShadow[] = { 0, 0, 0, 1 };   colorBorder[] = { 0, 0, 0, 1 };   borderSize = 0;   colorBackgroundActive[] = { 0.8, 1, 0.5, 1 };   colorBackgroundDisabled[] = { 1, 1, 1, 0.5 };   offsetX = 0.003;   offsetY = 0.003;   offsetPressedX = 0.001;   offsetPressedY = 0.001;   soundEnter[] = { "", 0, 1 };   soundPush[] = { "", 0, 1 };   soundClick[] = { "", 0, 1 };   soundEscape[] = { "", 0, 1 }; }; class RscBck1 {   idc = -1;   type = CT_STATIC;   style = ST_LEFT;   w = 0.33;   h = 0.035;   font = FONT0;   sizeEx = 0.023;   colorText[] = { 0, 0, 0, 1 };   colorBackground[] = { 0, 0, 0, 0.8 };   text = ""; }; //////////COMPLETE WEAPON MENU //////////////////////////////////////////////////////////////////////////////// class WeaponDialog1 {   idd = -1;   movingEnable = true;   controlsBackground[] = { BckMain01, BckMain02, BckText01, BckText02, Bck01, Bck02, Bck03, Bck04, Bck05, Bck06, Bck07, Bck08, Bck09, Bck10, Bck11, Bck12, Bck13, Bck14, Bck15, Bck16, Bck17 };   controls[] = { Case1, Case2, Case3, Case4, Case5, Case6, Case7, Case8, Case9, Case10, Case11, Case12, Case13, Case14, Case15, Case16, Case17, Case18, Case19, Case20, Case21, Case22, Case23, Case24, Case25, Case26, Case27, Case28, Case29, Case30, Case31, Case32, Case33, Case34 };   objects[] = { };   class BckMain01 {      idc = -1;      type = CT_STATIC;      style = ST_LEFT;      x = START_X + 0.0;      y = START_Y + 0.0;      w = 0.33;      h = 1;      font = FONT0;      sizeEx = 0.02;      colorText[] = { 0, 0, 0, 1 };      colorBackground[] = { 1, 1, 1, 0.3 };      text = "";   };   class BckMain02 {      idc = -1;      type = CT_STATIC;      style = ST_LEFT;      x = START_X + 0.1;      y = START_Y + 0.8;      w = 0.22;      h = 0.1;      font = FONT0;      sizeEx = 0.02;      colorText[] = { 0, 0, 0, 1 };      colorBackground[] = { 1, 1, 1, 0.3 };      text = "";   };   class BckText01 {      idc = -1;      type = CT_STATIC;      style = ST_LEFT;      x = START_X + 0.08;      y = START_Y + 0.78;      w = 0.2;      h = 0.1;      font = FONT0;      sizeEx = 0.05;      colorText[] = { 0, 0, 0, 1 };      colorBackground[] = { 0, 0, 0, 0 };      text = "Z D R O B";   };   class BckText02 {      idc = -1;      type = CT_STATIC;      style = ST_LEFT;      x = START_X + 0.13;      y = START_Y + 0.83;      w = 0.2;      h = 0.1;      font = FONT0;      sizeEx = 0.05;      colorText[] = { 0, 0, 0, 1 };      colorBackground[] = { 0, 0, 0, 0 };      text = "S t u d i o s";   };   class Bck01 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.01;   };   class Bck02 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.055;   };   class Bck03 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.1;   };   class Bck04 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.145;   };   class Bck05 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.19;   };   class Bck06 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.235;   };   class Bck07 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.28;   };   class Bck08 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.325;   };   class Bck09 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.37;   };   class Bck10 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.415;   };   class Bck11 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.46;   };   class Bck12 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.505;   };   class Bck13 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.55;   };   class Bck14 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.595;   };   class Bck15 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.64;   };   class Bck16 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.685;   };   class Bck17 : RscBck1 {      x = START_X + 0.0;      y = START_Y + 0.73;   };   class Case1 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.01;      text = "M16A2";      action = "Weap = ""M16A2""";   };   class Case2 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.055;      text = "M16A4";      action = "Weap = ""M16A4""";   };   class Case3 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.1;      text = "M16A4 ACG";      action = "Weap = ""M16A4_ACG""";   };   class Case4 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.145;      text = "M4";      action = "Weap = ""M4""";   };   class Case5 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.19;      text = "M4 AIM";      action = "Weap = ""M4AIM""";   };   class Case6 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.235;      text = "M4A1 SD";      action = "Weap = ""M4A1SD""";   };   class Case7 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.28;      text = "M4A1";      action = "Weap = ""M4A1""";   };   class Case8 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.325;      text = "G36K";      action = "Weap = ""G36K""";   };   class Case9 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.37;      text = "G36C";      action = "Weap = ""G36C""";   };   class Case10 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.415;      text = "G36A";      action = "Weap = ""G36A""";   };   class Case11 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.46;      text = "MP5A5";      action = "Weap = ""MP5A5""";   };   class Case12 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.505;      text = "MP5 SD";      action = "Weap = ""MP5SD""";   };   class Case13 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.55;      text = "AK74";      action = "Weap = ""AK74""";   };   class Case14 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.595;      text = "AKS74U";      action = "Weap = ""AKS74U""";   };   class Case15 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.64;      text = "AKS74UN";      action = "Weap = ""AKS74UN""";   };   class Case16 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.685;      text = "AKS74 PSO";      action = "Weap = ""AKS74PSO""";   };   class Case17 : RscCase1 {      x = START_X + 0.01;      y = START_Y + 0.73;      text = "M16A2 GL";      action = "Weap = ""M16A2GL""";   };   class Case18 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.01;      text = "M16A4 GL";      action = "Weap = ""M16A4_GL""";   };   class Case19 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.055;      text = "M16A4 ACG GL";      action = "Weap = ""M16A4_ACG_GL""";   };   class Case20 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.1;      text = "M4 ACG GL";      action = "Weap = ""M4GL""";   };   class Case21 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.145;      text = "M4A1 ACG GL";      action = "Weap = ""M4A1GL""";   };   class Case22 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.19;      text = "AK74 GL";      action = "Weap = ""AK74GL""";   };   class Case23 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.235;      text = "M249";      action = "Weap = ""M249""";   };   class Case24 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.28;      text = "M240";      action = "Weap = ""M240""";   };   class Case25 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.325;      text = "PK";      action = "Weap = ""PK""";   };   class Case26 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.37;      text = "Mk12 SPR";      action = "Weap = ""M4SPR""";   };   class Case27 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.415;      text = "M24";      action = "Weap = ""M24""";   };   class Case28 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.46;      text = "M107";      action = "Weap = ""M107""";   };   class Case29 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.505;      text = "SVD";      action = "Weap = ""SVD""";   };   class Case30 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.55;      text = "KSVK";      action = "Weap = ""KSVK""";   };   class Case31 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.595;      text = "M9";      action = "Weap = ""M9""";   };   class Case32 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.64;      text = "M9 SD";      action = "Weap = ""M9SD""";   };   class Case33 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.685;      text = "Makarov";      action = "Weap = ""Makarov""";   };   class Case34 : RscCase1 {      x = START_X + 0.17;      y = START_Y + 0.73;      text = "Makarov SD";      action = "Weap = ""MakarovSD""";   }; }; //////////////////////////////////////////////////////////////////////////////// class WeaponDialog2 : WeaponDialog1 {   idd = -1;   controls[] = { Case1, Case2, Case3, Case4, Case5, Case6, Case7, Case8, Case9, Case10, Case11, Case12, Case13, Case14, Case15, Case16 }; }; class WeaponDialog3 : WeaponDialog1 {   idd = -1;   controls[] = { Case17, Case18, Case19, Case20, Case21, Case22 }; }; class WeaponDialog4 : WeaponDialog1 {   idd = -1;   controls[] = { Case23, Case24, Case25 }; }; class WeaponDialog5 : WeaponDialog1 {   idd = -1;   controls[] = { Case26, Case27, Case28, Case29, Case30 }; }; class WeaponDialog6 : WeaponDialog1 {   idd = -1;   controls[] = { Case31, Case32, Case33, Case34 }; }; This file describes the menu used to select weapons. ctf_score_hints.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//////////VARIABLES //////////////////////////////////////////////////////////////////////////////// private [   "_p_enemy_flag",   "_p_friendly_flag",   "_p_enemy_side",   "_p_friendly_side",   "_p_score_variable",   "_p_friendly_spawn_trig",   "_previous_flag_state",   "_current_flag_state",   "_flag_holder" ]; _p_enemy_flag = _this select 0; _p_friendly_flag = _this select 1; _p_enemy_side = _this select 2; _p_friendly_side = _this select 3; _p_score_variable = _this select 4; _p_friendly_spawn_trig = _this select 5; _previous_flag_state = 0; _current_flag_state = 0; _flag_holder = ""; _inSpawn = false; //////////////////////////////////////////////////////////////////////////////// //////////FLAG STATE HINTS & SCORE UPDATE //////////////////////////////////////////////////////////////////////////////// while {true} do {   sleep 1;     if (isNull flagOwner _p_enemy_flag) then   {      _current_flag_state = 0;   }   else   {      if (alive flagOwner _p_enemy_flag) then      {        if        (           ((flagOwner _p_enemy_flag distance _p_friendly_flag) < 5) or           (vehicle flagOwner _p_enemy_flag in list _p_friendly_spawn_trig)        )        then        {           if (vehicle flagOwner _p_enemy_flag in list _p_friendly_spawn_trig) then           {             _inSpawn = true;           };           _current_flag_state = 0;        }        else        {           _current_flag_state = 1;        }      }      else      {        _current_flag_state = 2;      }   };     switch (_current_flag_state) do   {      case 0 :      {        switch (_previous_flag_state) do        {           case 1 :           {             if (_inSpawn) then             {                _p_enemy_flag setFlagOwner objNull;                hint (_p_enemy_side+" flag has been returned");                _inSpawn = false;             }             else             {                flagOwner _p_enemy_flag addScore 10;                _p_enemy_flag setFlagOwner objNull;                hint (_flag_holder+" scored for "+_p_friendly_side);                if (isServer) then                {                  call compile (_p_score_variable+" = "+_p_score_variable+" + 1");                  call compile ("publicVariable '"+_p_score_variable+"'");                };             };             _previous_flag_state = 0;           };           case 2 :           {             hint (_p_enemy_side+" flag has been returned");             _previous_flag_state = 0;           }        }      };      case 1 :      {        switch (_previous_flag_state) do        {           case 0 :           {             hint ((name flagOwner _p_enemy_flag)+" captured the "+_p_enemy_side+" flag");             _flag_holder = name flagOwner _p_enemy_flag;             _previous_flag_state = 1;           };           case 2 :           {             hint ((name flagOwner _p_enemy_flag)+" picked up the "+_p_enemy_side+" flag");             _previous_flag_state = 1;           }        }      };      case 2 :      {        switch (_previous_flag_state) do        {           case 0 :           {             hint (_flag_holder+" was killed while capturing the "+_p_enemy_side+" flag");             _previous_flag_state = 2;           };           case 1 :           {             hint (_flag_holder+" dropped the "+_p_enemy_side+" flag");             _previous_flag_state = 2;           }        }      }   } } //////////////////////////////////////////////////////////////////////////////// This script tracks the flag state using exclusively the result of flagOwner command. It shows hints with the flag state change and increments team and player score. This script can be improved to add more score details like flagtouches, add more points for players killing flag runners etc. dialogWeapon.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">switch (RearmMode) do {   case 1002 : {createDialog "WeaponDialog1"};   case 2002 : {createDialog "WeaponDialog2"};   case 3002 : {createDialog "WeaponDialog3"};   case 4002 : {createDialog "WeaponDialog4"};   case 5002 : {createDialog "WeaponDialog5"};   case 6002 : {createDialog "WeaponDialog6"}; }; init.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//                 ALL //////////VARIABLES //////////////////////////////////////////////////////////////////////////////// RearmMode = Param2; WeaponsCount = 34; RifleStart = 0; RifleCount = 16; GlStart = 16; GlCount = 6; MgStart = 22; MgCount = 3; SniperStart = 25; SniperCount = 5; HandgunStart = 30; HandgunCount = 4; //PointsEast defined by server //PointsWest defined by server //RandWeapons defined by server //RandRifle defined by server //RandGL defined by server //RandMG defined by server //RandSniper defined by server //RandHandgun defined by server //StartTime defined by server //RandOverc defined by server //RandFog defined by server //RandRain defined by server //StartOutro defined by server //EndMission defined by client f_outro = {   private ["_camera", "_camPos", "_tarPos"];   _camPos = position G_CAM;   _tarPos = position G_TAR;   0 fadeMusic 3;   playmusic "ATrack5";   sleep 10;   cutText ["", "black out", 5];   showCinemaBorder true;   enableRadio false;   sleep 1;   if (PointsEast < PointsWest) then      {titletext [format ["West wins!\nWest %1 - East %2", PointsWest, PointsEast], "plain"]};   if (PointsWest < PointsEast) then      {titletext [format ["East wins!\nWest %1 - East %2", PointsWest, PointsEast], "plain"]};   if (PointsEast == PointsWest) then      {titletext [format ["The game is a draw!\nWest %1 - East %2", PointsWest, PointsEast], "plain"]};   _camera = "camera" camCreate [0, 0, 0];   _camera cameraEffect ["internal", "back"];   _camera camPrepareTarget _tarPos;   _camera camPreparePos _camPos;   _camera camPrepareFocus [0, 0];   _camera camPrepareFOV 1;   _camera camCommitPrepared 0;   sleep 3;   cutText ["", "black in", 5];   sleep 3;   5 fadeMusic 0;   sleep 6;   EndMission = true; }; f_rearm = compile preprocessFile "rearm.sqf"; //////////////////////////////////////////////////////////////////////////////// //                 SERVER if (isServer) then { //////////PUBLIC VARIABLES ////////////////////////////////////////////////////////////////////////////////   PointsWest = 0;   publicVariable "PointsWest";   PointsEast = 0;   publicVariable "PointsEast";   StartTime = random 15;   publicVariable "StartTime";   if (random 1 < 0.6) then      {RandOverc = (floor (random 6)) / 10}   else      {RandOverc = 0.6 + (floor (random 5)) / 10};   publicVariable "RandOverc";   if (random 1 < 0.6) then      {RandFog = (floor (random 6)) / 10}   else      {RandFog = 0.6 + (floor (random 5)) / 10};   publicVariable "RandFog";   RandRain = (floor (random 11)) / 10;   publicVariable "RandRain";   RandWeapons = floor (random WeaponsCount);   publicVariable "RandWeapons";     RandRifle = RifleStart + (floor (random RifleCount));   publicVariable "RandRifle";     RandGL = GlStart + (floor (random GlCount));   publicVariable "RandGL";     RandMG = MgStart + (floor (random MgCount));   publicVariable "RandMG";     RandSniper = SniperStart + (floor (random SniperCount));   publicVariable "RandSniper";     RandHandgun = HandgunStart + (floor (random HandgunCount));   publicVariable "RandHandgun"; ////////////////////////////////////////////////////////////////////////////////   if (Param1 > 10) then {estimatedTimeLeft Param1}; //////////ENDS MISSION WHEN TIME IS UP OR SCORE IS MAXIMUM ////////////////////////////////////////////////////////////////////////////////   [] spawn   {      while {true}  do      {        sleep 1;        if        (           (Param1 > 10 and (Time >= Param1)) or           ((PointsWest >= Param1) or (PointsEast >= Param1))        )        then        {           StartOutro = true;           publicVariable "StartOutro";        };      };   }; //////////////////////////////////////////////////////////////////////////////// }; //                 ALL //////////CTF HINTS AND SCORE UPDATES //////////////////////////////////////////////////////////////////////////////// [FLAG_WEST, FLAG_EAST, "West", "East", "PointsEast", T_EAST_SPAWN] execVM "ctf_score_hints.sqf"; [FLAG_EAST, FLAG_WEST, "East", "West", "PointsWest", T_WEST_SPAWN] execVM "ctf_score_hints.sqf"; //////////////////////////////////////////////////////////////////////////////// //////////WEATHER //////////////////////////////////////////////////////////////////////////////// waitUntil {   not isNil "StartTime" and   not isNil "RandOverc" and   not isNil "RandFog" and   not isNil "RandRain" }; skipTime StartTime; [] spawn {   while {true} do   {      0 setOverCast RandOverc;      sleep 1;      0 setFog RandFog;      0 setRain RandRain;   } }; //////////////////////////////////////////////////////////////////////////////// //////////PLAYER //////////////////////////////////////////////////////////////////////////////// waitUntil {alive Player}; if (Param2 >= 1000 and (Param2 % 1000 == 2)) then {WeapDiag = Player addAction ["Select Weapon", "dialogWeapon.sqf", nil, 0, false, false, ""]}; call f_rearm; Player addEventHandler ["killed", {   _this spawn   {      if      (        ((_this select 0) == flagOwner FLAG_WEST) or        ((_this select 0) == flagOwner FLAG_EAST)      )      then        {sleep 30}      else        {sleep 10};      deleteVehicle (_this select 0);   } }]; Player addEventHandler ["killed", {   _this spawn   {      cutText ["", "black out"];      Player removeAction WeapDiag;      waitUntil {alive Player};      call f_rearm;      if (Param2 >= 1000 and (Param2 % 1000 == 2)) then        {WeapDiag = Player addAction ["Select Weapon", "dialogWeapon.sqf", nil, 0, false, false, ""]};      cutText ["", "black in"];   }; }]; //////////////////////////////////////////////////////////////////////////////// //////////SCORE AND WEATHER STATUS TRIGGERS //////////////////////////////////////////////////////////////////////////////// _trig = createTrigger["EmptyDetector", [0,0,0]]; _trig setTriggerArea [0, 0, 0, false]; _trig setTriggerActivation ["ALPHA", "PRESENT", true]; _trig setTriggerText "Weather"; _trig setTriggerStatements ["this", "hint format [""Weather (local)\nDaytime : %1\nOvercast : %2\nFog : %3\nRain %4"", daytime, overcast, fog, rain]", ""]; _trig = createTrigger["EmptyDetector", [0,0,0]]; _trig setTriggerArea [0, 0, 0, false]; _trig setTriggerActivation ["BRAVO", "PRESENT", true]; _trig setTriggerText "Score"; _trig setTriggerStatements ["this", "hint format [""West %1 - East %2 / %3 vs %4"", PointsWest, PointsEast, playersNumber west, playersNumber east]", ""]; //////////////////////////////////////////////////////////////////////////////// rearm.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//////////VARIABLES //////////////////////////////////////////////////////////////////////////////// private [   "_weapons",   "_weapmuz",   "_mag",   "_glmag",   "_mag",   "_mag_count",   "_smokeShell",   "_i" ]; _weapons = [   "M16A2",   "M16A4",   "M16A4_ACG",   "M4",   "M4AIM",   "M4A1SD",   "M4A1",   "G36K",   "G36C",   "G36A",   "MP5A5",   "MP5SD",   "AK74",   "AKS74U",   "AKS74UN",   "AKS74PSO",   "M16A2GL",   "M16A4_GL",   "M16A4_ACG_GL",   "M4GL",   "M4A1GL",   "AK74GL",   "M249",   "M240",   "PK",   "M4SPR",   "M24",   "M107",   "SVD",   "KSVK",   "M9",   "M9SD",   "Makarov",   "MakarovSD" ]; _weapmuz = ""; _mag = ""; _glmag = "1Rnd_HE_M203"; _mag_count = 10; //Weap //RearmMode //RandWeapons //RandRifle //RandGL //RandMG //RandSniper //RandHandgun //////////////////////////////////////////////////////////////////////////////// removeAllWeapons player; //////////VARIABLES MUST BE INITIALIZED //////////////////////////////////////////////////////////////////////////////// waitUntil {   not isNil "RandWeapons" and   not isNil "RandRifle" and   not isNil "RandGL" and   not isNil "RandMG" and   not isNil "RandSniper" and   not isNil "RandHandgun" }; //////////////////////////////////////////////////////////////////////////////// //////////SELECTS WEAPON //////////////////////////////////////////////////////////////////////////////// switch (RearmMode) do {   case 1000 : {Weap = _weapons select (RandWeapons)};   case 1001 : {Weap = _weapons select (floor (random WeaponsCount))};   case 1002 : {if (isNil "Weap") then {Weap = _weapons select (floor (random WeaponsCount))}};   case 2000 : {Weap = _weapons select (RandRifle)};   case 2001 : {Weap = _weapons select (RifleStart + (floor (random RifleCount)))};   case 2002 : {if (isNil "Weap") then {Weap = _weapons select (RifleStart + (floor (random RifleCount)))}};   case 3000 : {Weap = _weapons select (RandGL)};   case 3001 : {Weap = _weapons select (GlStart + (floor (random GlCount)))};   case 3002 : {if (isNil "Weap") then {Weap = _weapons select (GlStart + (floor (random GlCount)))}};   case 4000 : {Weap = _weapons select (RandMG)};   case 4001 : {Weap = _weapons select (MgStart + (floor (random MgCount)))};   case 4002 : {if (isNil "Weap") then {Weap = _weapons select (MgStart + (floor (random MgCount)))}};   case 5000 : {Weap = _weapons select (RandSniper)};   case 5001 : {Weap = _weapons select (SniperStart + (floor (random SniperCount)))};   case 5002 : {if (isNil "Weap") then {Weap = _weapons select (SniperStart + (floor (random SniperCount)))}};   case 6000 : {Weap = _weapons select (RandHandgun)};   case 6001 : {Weap = _weapons select (HandgunStart + (floor (random HandgunCount)))};   case 6002 : {if (isNil "Weap") then {Weap = _weapons select (HandgunStart + (floor (random HandgunCount)))}};   default {Weap = _weapons select RearmMode}; }; //////////////////////////////////////////////////////////////////////////////// //////////ADDS 1 RANDOM COLOR SMOKESHELL & 1 HANDGRENADE //////////////////////////////////////////////////////////////////////////////// _smokeShell = switch (floor (random 3)) do {   case 0 : {"SmokeShellRed"};   case 1 : {"SmokeShellGreen"};   default {"SmokeShell"}; }; player AddMagazine _smokeShell; player AddMagazine "HandGrenadeTimed"; //////////////////////////////////////////////////////////////////////////////// //////////SELECTS GEAR //////////////////////////////////////////////////////////////////////////////// switch (Weap) do {   case "M16A2" : {_mag = "30Rnd_556x45_Stanag"};   case "M16A4" : {_mag = "30Rnd_556x45_Stanag"};   case "M16A4_ACG" : {_mag = "30Rnd_556x45_Stanag"};   case "M4" : {_mag = "30Rnd_556x45_Stanag"};   case "M4AIM" : {_mag = "30Rnd_556x45_Stanag"};   case "M4A1SD" : {_mag = "30Rnd_556x45_StanagSD"};   case "M4A1" : {_mag = "30Rnd_556x45_Stanag"};   case "G36K" : {_mag = "30Rnd_556x45_G36"};   case "G36C" : {_mag = "30Rnd_556x45_G36"};   case "G36A" : {_mag = "30Rnd_556x45_G36"};   case "MP5A5" : {_mag = "30Rnd_9x19_MP5"};   case "MP5SD" : {_mag = "30Rnd_9x19_MP5SD"};   case "AK74" : {_mag = "30Rnd_545x39_AK"};   case "AKS74U" : {_mag = "30Rnd_545x39_AK"};   case "AKS74UN" : {_mag = "30Rnd_545x39_AKSD"};   case "AKS74PSO" : {_mag = "30Rnd_545x39_AK"};   case "M16A2GL" : {_mag = "30Rnd_556x45_Stanag"; _weapmuz = "M16Muzzle"};   case "M16A4_GL" : {_mag = "30Rnd_556x45_Stanag"; _weapmuz = "M16Muzzle"};   case "M16A4_ACG_GL" : {_mag = "30Rnd_556x45_Stanag"; _weapmuz = "M16Muzzle"};   case "M4GL" : {_mag = "30Rnd_556x45_Stanag"; _weapmuz = "M4Muzzle"};   case "M4A1GL" : {_mag = "30Rnd_556x45_Stanag"; _weapmuz = "M4Muzzle"};   case "AK74GL" : {_mag = "30Rnd_545x39_AK"; _glmag = "1Rnd_HE_GP25"; _weapmuz = "AK74Muzzle"};   case "M249" : {_mag = "200Rnd_556x45_M249"; _mag_count = 4};   case "M240" : {_mag = "100Rnd_762x51_M240"; _mag_count = 4};   case "PK" : {_mag = "100Rnd_762x54_PK"; _mag_count = 4};   case "M4SPR" : {_mag = "30Rnd_556x45_Stanag"};   case "M24" : {_mag = "5Rnd_762x51_M24"};   case "M107" : {_mag = "10Rnd_127x99_M107"};   case "SVD" : {_mag = "10Rnd_762x54_SVD"};   case "KSVK" : {_mag = "5Rnd_127x108_KSVK"};   case "M9" : {_mag = "15Rnd_9x19_M9"; _mag_count = 8};   case "M9SD" : {_mag = "15Rnd_9x19_M9SD"; _mag_count = 8};   case "Makarov" : {_mag = "8Rnd_9x18_Makarov"; _mag_count = 8};   case "MakarovSD" : {_mag = "8Rnd_9x18_MakarovSD"; _mag_count = 8}; }; //////////////////////////////////////////////////////////////////////////////// //////////SELECTS STANCE //////////////////////////////////////////////////////////////////////////////// if (   Weap == "M9" or   Weap == "M9SD" or   Weap == "Makarov" or   Weap == "MakarovSD" ) then   {player switchMove "AmovPknlMstpSrasWpstDnon"} else   {player switchMove "AmovPknlMstpSrasWrflDnon"}; //////////////////////////////////////////////////////////////////////////////// //////////ADDS GEAR TO PLAYER //////////////////////////////////////////////////////////////////////////////// if (   Weap == "M16A2GL" or   Weap == "M16A4_GL" or   Weap == "M16A4_ACG_GL" or   Weap == "M4GL" or   Weap == "M4A1GL" or   Weap == "AK74GL" ) then {   for "_i" from 1 to 8 do {player AddMagazine _glmag};   for "_i" from 1 to _mag_count do {player AddMagazine _mag};   player AddWeapon Weap;   player SelectWeapon _weapmuz; } else {   for "_i" from 1 to _mag_count do {player AddMagazine _mag};   player AddWeapon Weap;   player SelectWeapon Weap; }; //////////////////////////////////////////////////////////////////////////////// briefing.html <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"><html> <head> <title></title> </head> <body> <p><a name="main"></a></p> <p> <br><br> Contact mission maker at : </p> <hr> <p><a name="plan"></a></p> <p> <br><br><br><br> - Capture the enemy flag<br><br> - Don't enter the enemy spawn area<br><br> - Don't enter your own spawn area while carrying the enemy flag<br><br> - 10 points reward for flag delivery<br><br> - Flag is returned after 30 seconds when flag owner dies<br><br> - Random weather and time of day (4:30 - 19:30) </p> </body> </html> Share this post Link to post Share on other sites
d3nn16 3 Posted July 9, 2008 I found a problem with the hint that shows time left. It was in a trigger in the mission.sqm file. I updated the mission file. The trigger before : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">      class Item3      {        position[]={8994.530273,35.105175,5876.273926};        a=0.000000;        b=0.000000;        repeating=1;        timeoutMin=1.000000;        timeoutMid=1.000000;        timeoutMax=1.000000;        age="UNKNOWN";        text="Time Left";        expCond="(Param1 > 10) AND ((Param1 - Time) <= 120 OR (Param1 - Time) <= 300 OR (Param1 - Time) <= 600 OR (Param1 - Time) <= 1200 OR (Param1 - Time) <= 1800 OR (Param1 - Time) <= 3600)";        expActiv="hint ((str ceil ((Param1 - Time) / 60)) + "" minutes left"")";        class Effects        {        };      }; The trigger after correction : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">      class Item3      {        position[]={8994.905273,35.119831,5875.522949};        a=0.000000;        b=0.000000;        repeating=1;        age="UNKNOWN";        text="Time Left";        expCond="(Param1 > 10) AND ((ceil (Param1 - Time) == 120) OR (ceil (Param1 - Time) == 300) OR (ceil (Param1 - Time) == 600) OR (ceil (Param1 - Time) == 1200) OR (ceil (Param1 - Time) == 1800) OR (ceil (Param1 - Time) == 3600))";        expActiv="hint ((str ceil ((Param1 - Time) / 60)) + "" minutes left"")";        class Effects        {        };      }; Share this post Link to post Share on other sites
d3nn16 3 Posted July 17, 2008 Changed ctf_hints_score.sqf file : Before : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">                flagOwner _p_enemy_flag addScore 10;                _p_enemy_flag setFlagOwner objNull;                hint (_flag_holder+" scored for "+_p_friendly_side);                call compile (_p_score_variable+" = "+_p_score_variable+" + 1"); After : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">                flagOwner _p_enemy_flag addScore 10;                _p_enemy_flag setFlagOwner objNull;                hint (_flag_holder+" scored for "+_p_friendly_side);                if (isServer) then                {                  call compile (_p_score_variable+" = "+_p_score_variable+" + 1");                  call compile ("publicVariable '"+_p_score_variable+"'");                }; Share this post Link to post Share on other sites