Can I have a seasoned coder please review to see how well I did here. ***I haven't tested it yet, but it at least gives an idea on what I am trying to accomplish for a series of Attack & Defend maps that I would like to created for some decent events.
Let me know if this looks good or has a more efficient way of writing it please let me know. ***Basically a defending team accumulates points on vehicles, players, and other objects. ***Only players respawn and as points go up the Security Alerts drop.
Vehicle, Object, Person has the script call with it's point value appended
(i.e. not alive unit [50] execVM homelandsec.sqf )
Here are my questions on what I have.
Question 1:
Is this written in such a way that it will work? ***I have a variable-flag set each time a level is met so that they don't show up when each item is killed. ***Does that look ok?
Question 2: (HOW TO END)
How can I make it so that when I get to the very last part where the threat is over, the mission ends with a BLUFOR victry?
Question 3: (RESTRICT TO BLUFOR ONLY)
How can I make it so that only the BLUFOR team sees the messages? ***It would be nice to only have them know the level they are at.
homelandsec.sqf
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
// HOME LAND SECURITY THREAT MESSAGES
// VARIABLES passed in are:
// _points - is a variable which the mission maker appends to an object. ***What he/she believe the unit is worth
//
// PARAMETERS _codered, blue, etc ***are used for the security threshhold values. ***As points are accumulated
// the threat is over and the mission will end.
_points = _this select 0;
_codered = 0;
_codeorange = 1000;
_codeyellow = 2000;
_codeblue = 3000;
_codegreen = 4000;
_threatisover = 5000;
_total = _total + _points;
//================================================== ====
// Now check against our security matrix to see what level of threat we are at. ***Each time we call
// this script we only want to display as the serverity changes so we set a flag/variable called
// _code(color)activated then check each time before displaying the message.
if ((_total < _codeorange) && (_coderedactivated != 1)) then
{
*** *** ***_coderedactivated = 1;
*** *** ***cutText["CODE RED. ***We are at a SEVERE Risk of Attack.", "PLAIN"];
*** };
if ((_total >= _codeorange) && (_total < _codeyellow) && (_codeorangeactivated != 1)) then
{
*** *** ***_codeorangeactivated = 1;
*** *** ***cutText["CODE ORANGE. ***We have dropped to a HIGH Risk of Attack.", "PLAIN"];
*** };
***
if ((_total >= _codeyellow) && (_total < _codeblue) && (_codeyellowactivated != 1)) then
{
*** *** ***_codeyellowactivated = 1;
*** *** ***cutText["CODE YELLOW. ***We have dropped to an ELEVATED Risk of Attack.", "PLAIN"];
*** };
***
if ((_total >= _codeblue) && (_total < _codegreen) && (_codeblueactivated != 1)) then
{
*** *** ***_codeblueactivated = 1;
*** *** ***cutText["CODE BLUE. ***We have dropped to a GUARDED Risk of Attack.", "PLAIN"];
*** };
***
if ((_total >= _codegreen) && (_total < _threatisover) && (_codegreenactivated != 1)) then
{
*** *** ***_codegreenactivated = 1;
*** *** ***cutText["CODE GREEN. ***We have dropped to a LOW Risk of Attack.", "PLAIN"];
*** };
***
if (_total >= _threatisover) then
{
*** *** ***cutText["The Security Threats are over. ***We are free of enemy attacks.", "PLAIN"];
*** };[/QUOTE]
HOME
Reply With Quote


