Example #1
0
        /// <summary>
        /// Creates a new trigger
        /// </summary>
        /// <param name="interval">The interval at which the trigger will run</param>
        /// <param name="count">How many times the trigger will round (0 for infinite times)</param>
        /// <param name="method">The name of the method that is going to be called when the trigger executes</param>
        /// <param name="id">The id for the trigger</param>
        private void CreateTrigger(int interval, int count, string method, string id = "")
        {
            IObjectTimerTrigger timerTrigger = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");

            timerTrigger.SetIntervalTime(interval);
            timerTrigger.SetRepeatCount(count);
            timerTrigger.SetScriptMethod(method);
            timerTrigger.CustomId = id;
            timerTrigger.Trigger();
            timerTrigger.SetWorldPosition(Game.GetSingleObjectByCustomId("TriggersPosition").GetWorldPosition());
        }