Thread: Stats Questions
View Single Post
  #4  
Old 11-16-2011, 02:15 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

This was our solution for scores for triggered events. If the blue team should receive for example 50 points for a mission goal, I named the trigger "ScoreBlue50" and the following On Trigger Method added 50 points to the int ScoreBlue:

Code:
public override void OnTrigger(int missionNumber, string shortName, bool active) 
    {
       base.OnTrigger(missionNumber, shortName, active); 

  if (shortName.StartsWith("ScoreRed"))
        {
            StringBuilder b = new StringBuilder(shortName);
            string Number = b.Replace("ScoreRed", "").ToString();
            int Redresult = 0;

            if (int.TryParse(Number, out Redresult))
                ScoreRed += Redresult; 
  
            GamePlay.gpLogServer(null, "The RAF succesfully accomplished one objective: \nTeam scores - RAF {0}: LW {1}", new object[] {ScoreRed, ScoreBlue });
        }
		  if (shortName.StartsWith("ScoreBlue"))
        {
            StringBuilder b = new StringBuilder(shortName);
            string Number = b.Replace("ScoreBlue", "").ToString();
            int Blueresult = 0;

            if (int.TryParse(Number, out Blueresult))
                ScoreBlue += Blueresult; 
   
            GamePlay.gpLogServer(null, "The LW succesfully accomplished one objective: \nTeam scores - RAF {0}: LW {1}", new object[] {ScoreRed, ScoreBlue });
        }
}
Reply With Quote