View Single Post
  #1  
Old 01-12-2012, 10:01 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default Simple HUD timer test script

The following code is a simple visual reference HUD timer to test mission operation periods.

Example: to check that missions load at specific time or not or other timed periods.

Set ts value for interval period required(in seconds), as 60 the HUD will display the following, then by intervals of 60secs adding each time.

Elapsed Time:Min:1 Secs:60 Ticks:1800

Note:ticks can be varible, however in this case ts count multiplied by 30
(near enough for visual, ingame checks)

Feel free to use and modify.

Code:
/**missiontesttimer.cs**/
//
//By Smokeynz
//lastmod 13/1/2012

using System;
using System.Collections;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using System.Collections.Generic;
using System.Diagnostics;

public class Mission : AMission
{ 
      
    //Goes with time indicator, set period for cycle repeat period: value = seconds   
    private double timeValue = 60; 
    private double time;

    public override void OnTickGame()
    {
        base.OnTickGame();
        
        /*=========================================*/

        // Time. current() in seconds from Battle Start
        if (Time.current() >= time)
        {
            GamePlay.gpHUDLogCenter("Elapsed Time:Min:" + time / 60 + " Secs:" + time + " Ticks:" + time * 30);
            ime = time + timeValue;
        }
        /*=========================================*/
        
    }   
}

Last edited by Smokeynz; 03-17-2012 at 08:20 PM.
Reply With Quote