Need Help Again

I'm having problems getting the Sensor Group Colors TO Function.

This is what I have:
function DefaultGame::missionLoadDone(%game)
{
   //  walks through the mission group and sets the power stuff up
   //   - groups get initialized with power count 0 then iterated to
   //     increment powercount if an object within is powered
   //   - powers objects up/down
   //MissionGroup.objectiveInit();
   MissionGroup.clearPower();
   MissionGroup.powerInit(0);

   %game.initGameVars();  //set up scoring variables and other game specific globals

   // make team0 visible/friendly to all
   setSensorGroupAlwaysVisMask(0, 0xffffffff);
   setSensorGroupFriendlyMask(0, 0xffffffff);
   
   //and Teams 29 & 28
   setSensorGroupAlwaysVisMask(29, 0xffffffff);
   setSensorGroupFriendlyMask(29, 0xffffffff);
   setSensorGroupAlwaysVisMask(28, 0xffffffff);
   setSensorGroupFriendlyMask(28, 0xffffffff);
   
   // update colors:
   // - enemy teams are red
   // - same team is green
   // - team 0 is white
   for(%i = 0; %i < 32; %i++)
   {
//      %team = (1 << %i);
//      setSensorGroupColor(%i, %team, "0 255 0 255");
//      setSensorGroupColor(%i, ~%team, "255 0 0 255");
//      setSensorGroupColor(%i, 1, "255 255 255 255");
//      setSensorGroupColor(%i, 6, "255 0 255 255");//Purple (Zombies, Team 30)
      %team = (1 << %i);

	  //Make sure your not changing your teams color
      //If not change the enemy team's sensor color

      if(%i == 0) {
        setSensorGroupColor(%i,%team, "255 255 255 255");//White(Obs)
      }
      else if(%i == 30) {
        for(%x=0; %x < 32; %x++) {
        setSensorGroupColor(%i, %x, "255 0 255 255");
        }
      }
      else if(%i == 29) {
        for(%x=0; %x < 32; %x++) {
        setSensorGroupColor(%i, %x, "255 255 0 255");
        }
      }
      else {
        setSensorGroupColor(%i, %team, "255 0 0 255");
      }
      //----
      setSensorGroupColor(%i,%team, "0 255 0 255");//Green of course
      // setup the team targets (alwyas friendly and visible to same team)
      setTargetAlwaysVisMask(%i, %team);
      setTargetFriendlyMask(%i, %team);
   }

   //set up the teams
   %game.setUpTeams();

   //clear out the team rank array...
   for (%i = 0; %i < 32; %i++)
      $TeamRank[%i, count] = "";

   // objectiveInit has to take place after setupTeams -- objective HUD relies on flags
   // having their team set
   MissionGroup.objectiveInit();

   //initialize the AI system
   %game.aiInit();

   //need to reset the teams if we switch from say, CTF to Bounty...
   // assign the bots team
   if ($currentMissionType !$= $previousMissionType)
   {
      $previousMissionType = $currentMissionType;
      for(%i = 0; %i < ClientGroup.getCount(); %i++)
      {
	 %cl = ClientGroup.getObject(%i);
	 if (%cl.isAIControlled())
	    %game.assignClientTeam(%cl);
      }
   }

   //Save off respawn or Siege Team switch information...
   if(%game.class !$= "SiegeGame")
      MissionGroup.setupPositionMarkers(true);
   echo("Default game mission load done.");
}

The goal is to have team 30 be purple and team 29 to be yellow/gold

Comments

  • As I tried to explain before, setSensorGroupColor(%i, %team, %colour); sets the colour other teams appear as to team %i.

    Thus, if green were set for %i=29 and %team=(1 << 29), team 29 would see team 29 as green.
    If %i=29 and you applied the bitwise NOT operator to make ~%team, it would set team 29 to see any other team as the colour you selected (assuming the team is properly set up).

    Were you to set %team=(1 << 29) on every team %i except 29, the other teams would see 29 as the colour you set (though it can play willy-nilly on your radar if set improperly).
Sign In or Register to comment.