Announcement

Collapse
No announcement yet.

Help with messages

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with messages

    I've done a TvT mission that works great locally. However I've tried to do a work around to display the scores to all players. However, i'm getting a script error. I'm trying to avoid using CBA_fnc_globalExecute to get the messages to appear to all clients.

    Anybody able to take a look....I'm unable to for the next little bit.

    --link removed--

    this one runs server only
    Code:
    //maxwellMonitor.sqf
    //[-1, {player globalChat _this}, "TEST"] call CBA_fnc_globalExecute;
    _blueInZone = list maxBlue;
    _opInZone = list maxOp;
    _run = true;
    blueScore = 0;
    opScore = 0;
    bluSc = "";
    opSC = "";
    _winningScore = 29; //adjust to 30 to publish
    bluSc = str blueScore;
    publicVariable bluSc;
    opSc = str opScore;
    publicVariable opSc;
    
    while {_run} do
    {
    	if (count list maxBlue < count list maxOp) then
    	{
    		opScore = opScore + 1;
    		if (blueScore > 0) then
    		{
    			blueScore = blueScore - 1;
    		};
    	};
    	if (count list maxBlue > count list maxOp) then
    	{
    		blueScore = blueScore + 1;
    		if (opScore > 0) then
    		{
    			opScore = opScore - 1;
    		};
    	};
    	//hintSilent format ["BLUFOR: %1 ------- OPFOR: %2",blueScore,opScore];
    	bluSc = str blueScore;
    	publicVariable bluSc;
    	opSc = str opScore;
    	publicVariable opSc;
    	
    	sleep 10;
    	
    	if (blueScore > _winningScore && opScore <= _winningScore) then
    	{
    	//	hint "BLUFOR WIN!";
    		_run = false;
    		missionStatus = "bluforWin";
    		publicVariable missionStatus;
    	};
    	if (blueScore <= _winningScore && opScore > _winningScore) then
    	{
    	//	hint "OPFOR WIN!";
    		_run = false;
    		missionStatus = "opforWin";
    		publicVariable missionStatus;
    	};
    	if (count list maxBlue < 1 && count list maxOp < 1) then
    	{
    	//	hint "Camp Maxwell is neutral";
    		blueScore = 0;
    		opScore = 0;
    	};
    	sleep 3;
    };
    this one runs on all clients
    Code:
    //playerMessages.sqf
    
    sleep 30;
    _run = true;
    
    
    while {_run} do
    {
    	hintSilent format ["BLUFOR: %1 ------- OPFOR: %2",bluSc,opSc];
    	sleep 3;
    };
    I get an undeclared variable error from playerMessages.sqf and the value it shows is "any". It works like a dream on my machine.
    Last edited by Unkl; 08-18-2013, 11:32 AM.
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member
    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
    "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

  • #2
    Re: Help with messages

    I defined the variables in a trigger that will fire on all machines. I'm guessing that the script maxwellMonitor.sqf wasn't running because it was in the isServer part of my init.sqf and there is no player on the server?

    Still not getting any values showing up in the messages.

    https://www.dropbox.com/s/5gku8seklu...v1.Stratis.pbo
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member
    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
    "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

    Comment


    • #3
      Re: Help with messages

      Any specific reasons why you are converting blueScore to a string before making it public? I don't think this is the issue, but if you can use "blueScore" instead of recreating them as a string in blueSc you are essentially making it less that could possibly go wrong.

      I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

      Comment


      • #4
        Re: Help with messages

        Code:
        bluSc = str blueScore;
        publicVariable bluSc;
        //and
        opSc = str opScore;
        publicVariable opSc;
        //and
        publicVariable missionStatus;
        should be
        Code:
        bluSc = str blueScore;
        publicVariable "bluSc";
        //and
        opSc = str opScore;
        publicVariable "opSc";
        //and
        publicVariable "missionStatus";
        make sure those quotes are on your variables whenever you do publicvariable.
        http://community.bistudio.com/wiki/publicVariable

        And I would recomment to add this at different intervals:
        Code:
        If ((bluescore > _winningscore) && (opscore > _winningscore)) then {
        _totalscore = (bluescore - opscore)/(abs (bluescore - opscore));
        
        Switch {_totalscore} do
        {
        Case 1 : {hint "blufor wins!"; _run = false; missionStatus = "bluforWin"; publicVariable "missionStatus"};
        Case -1 : {hint "opfor wins!"; _run = false; missionStatus = "opforWin"; publicVariable "missionStatus"};
        Case 0: {hint "SUDDEN DEATH"; if (playsound==false) then {playsound = true; publicVariable "playsound"};
        };
        };
        description.ext
        Code:
        class CfgSounds
        {
        	sounds[] = {};
        	class suddendeath
        	{
        		name = "suddendeath";
        		sound[] = {"SUDDENDEATH.ogg", 1, 1};
        		titles[] = {};
        	};
        };
        playermessage.sqf
        Code:
        //playerMessages.sqf
        
        sleep 30;
        _run = true;
        _runtime = 3;
        
        while {_run} do
        {
                if ((playsound==true)&&(missionStatus != "bluforWin")&&(missionStatus != "opforWin")) then {playsound "suddendeath"; _runtime = 46.332};
        	hintSilent format ["BLUFOR: %1 ------- OPFOR: %2",bluSc,opSc];
        	sleep _runtime;
        };
        https://www.dropbox.com/s/76a26i129r...UDDENDEATH.ogg

        This just ends it if they are both above winning score, your two conditions only resolve if one is below.(hopefully this works!)
        And for sudden death play some epic music! (Please)
        Last edited by Yink; 08-19-2013, 12:07 PM.
        Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

        Comment


        • #5
          Re: Help with messages

          Nice find Yink! I can't believe I looked over that!

          I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

          Comment


          • #6
            Re: Help with messages

            sorry about the typo (stupid brackets):
            Code:
            Case 0: {hint "SUDDEN DEATH"; if (playsound==false) then {playsound = true; publicVariable "playsound"}};
            Last edited by Yink; 08-20-2013, 12:22 AM.
            Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

            Comment


            • #7
              Re: Help with messages

              Thanks guys. The quotes made the hints show up on all players. Now the end trigger fails...thats another day...

              I've also found problems passing anything but strings through public variables but that may be because of the quotes too. I'll test some more.
              |TG-189th| Unkl
              ArmA 3 Game Officer
              Dean of Tactical Gamer University
              189th Infantry Brigade Member
              SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
              "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

              Comment

              Connect

              Collapse

              TeamSpeak 3 Server

              Collapse

              Advertisement

              Collapse

              Twitter Feed

              Collapse

              Working...
              X