Jump to content
410541059

problem of a progress bar script

Recommended Posts

If you have played "battlefield",u will know what is this。but I want the effect is like "squad"。"squad" need you one by one take done,A→B→C,unlike  "battlefield"。have there any way to solve problems?( not using global variables)

 

_triggerOne = _this select 0;  
_zero = 0;
_blueing = 0;
_reding = 0;
_JDT = 0;
_xxoo = false;
JDTK =
{
    disableSerialization;
    1 cutRsc ["H8erHUD","PLAIN"];
};
JDTG = 
{
    1 cutText ["", "PLAIN"]; 
};
waitUntil {player in list _triggerOne};
{
    if (_x in list _triggerOne) then
    {    
        _x call JDTK;
        _xxoo =  true;
    };
}foreach units player;
waitUntil {!isNull (uiNameSpace getVariable "H8erHUD")};
_display = uiNameSpace getVariable "H8erHUD";
_setText = _display displayCtrl 1001;
_setText progressSetPosition 0;
while {true} do 
{
    {
        if ((_x in list _triggerOne) && (!_xxoo)) then
        {
            _x call JDTK;
            _xxoo =  true;
            _display = uiNameSpace getVariable "H8erHUD";
            _setText = _display displayCtrl 1001;
        };
    }foreach units player;
    _blue = west countSide list _triggerOne;
    _red = east countSide list _triggerOne;
    if (_blue > _red) then 
    {
        if (_blueing != 1) then
        {
            if (_JDT == 0) then
            {
                _JDT = _JDT + 1;
                _blueing = _JDT/100;            
            }else{
                if (_reding != _zero) then
                {
                    _JDT = _JDT - 1;    
                    _reding = _JDT/100;
                }else{
                    _JDT = _JDT + 1;
                    _blueing = _JDT/100;
                };                    
            };
        }else{};
    };
    if (_red > _blue) then
    {
        if (_reding != 1) then
        {
            if (_JDT == 0) then
            {
                _JDT = _JDT + 1;    
                _reding = _JDT/100;
            }else{
                if (_blueing != _zero) then
                {
                    _JDT = _JDT - 1;
                    _blueing = _JDT/100;
                }else{
                    _JDT = _JDT + 1;
                    _reding = _JDT/100;
                };                    
            };
        }else{};
    };
    if (((_blue + _red) == 0) && (_JDT != 0) && (_JDT != 100)) then 
    {
        if (_blueing > _reding) then 
        {
            _JDT = _JDT - 1;
            _blueing = _JDT/100;
        };
        if (_reding > _blueing) then 
        {
            _JDT = _JDT - 1;
            _reding = _JDT/100;
        };
    };
    if (_xxoo) then
    {
        if (_JDT == 0) then 
        {
            _setText ctrlSetTextColor [0, 0, 0, 0];
        };
        if (_blueing > _reding) then 
        {
            _setText ctrlSetTextColor [0, 0, 255, 0.7];
            _setText progressSetPosition _blueing;
        };
        if (_reding > _blueing) then
        {
            _setText ctrlSetTextColor [255, 0, 0, 0.7];
            _setText progressSetPosition _reding;
        };
    };
    //hint format ["%1\n%2\n%3",_JDT,_blueing,_reding];
    {
        if ((!(_x in list _triggerOne)) && (_xxoo)) then
        {     
            _x call JDTG;
            _xxoo = false;
        };
    }foreach units player;
    sleep 1; 
};

Share this post


Link to post
Share on other sites

for example,there are six positions (a、b、c、d、e、f)east base in near A,west near F。when game started,east take done positions A before they cant take B,this is also true for the west。

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

×