private void Shoot(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(); }
public static IObjectTimerTrigger SetTimer(string met, string id, int times, int delay) { tTrigger = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); tTrigger.CustomId = id; tTrigger.SetScriptMethod(met); tTrigger.SetIntervalTime(delay); tTrigger.SetRepeatCount(times); tTrigger.Trigger(); return(tTrigger); }
/// <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()); }
private IObjectTimerTrigger CreateTimer(int interval, int count, string method, bool trigger) { IObjectTimerTrigger trig = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); trig.SetIntervalTime(interval); trig.SetRepeatCount(count); trig.SetScriptMethod(method); if (trigger) { trig.Trigger(); } return(trig); }
public void OnStartup() { bool success = Int32.TryParse(Game.Data, out GamesPlayed); if (!success) { GamesPlayed = 0; } else { GamesPlayed++; } Game.RunCommand("/MSG This script has been running for " + GamesPlayed + " maps"); IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer.SetIntervalTime(1000); Timer.SetRepeatCount(0); Timer.SetScriptMethod("ShowGameDotData"); Timer.Trigger(); }
public void OnStartup() { m_rnd = new Random((int)DateTime.Now.Millisecond * (int)DateTime.Now.Minute * 1000); if (Game.IsFirstUpdate) { CheckMessage(); m_minute = DateTime.Now.Minute; if (m_minute >= 30) { m_minute -= 30; } BalanceTeams(false); // after 3 seconds - rebalance teams if anyone left. IObjectTimerTrigger timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); timer.SetRepeatCount(2); timer.SetIntervalTime(1000); timer.SetScriptMethod("RecheckBalance"); timer.Trigger(); } }
// Run code before triggers marked with "Activate on startup" but after players spawn from SpawnMarkers. public void OnStartup() { // Bool variable to set mode (1 player in game is HALE) MODE = false; m_rnd = new Random((int)DateTime.Now.Millisecond * (int)DateTime.Now.Minute * 1000); // By default HALE cannot tp or ZA WARUDO and no one zombifyes on death tpEnabled = false; warudoEnabled = false; zombifyHumansOnDeath = false; // Initate all HALE types HALENAMES = new string[5]; HALENAMES[0] = "Saxton Fale"; HALENAMES[1] = "Sin Feaster"; HALENAMES[2] = "Speedy Fale"; HALENAMES[3] = "DIO"; HALENAMES[4] = "Dom Toretto"; // Every 200ms, delete all items from HALE RemoveHaleItemsTimer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); RemoveHaleItemsTimer.SetRepeatCount(0); RemoveHaleItemsTimer.SetIntervalTime(200); RemoveHaleItemsTimer.SetScriptMethod("RemoveHaleItems"); // Trigger for displaying HALE status for players DisplayHaleStatusTimer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); DisplayHaleStatusTimer.SetRepeatCount(0); DisplayHaleStatusTimer.SetIntervalTime(1000); DisplayHaleStatusTimer.SetScriptMethod("DisplayHaleStatus"); // Player key input ( for hale teleport) Events.PlayerKeyInputCallback.Start(OnPlayerKeyInput); // Set lastTeleported to game start lastTeleported = Game.TotalElapsedGameTime; lastWarudod = Game.TotalElapsedGameTime; // Trigger for HALE action cooldown. HaleMovementStopper = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); HaleMovementStopper.SetRepeatCount(1); HaleMovementStopper.SetIntervalTime(500); HaleMovementStopper.SetScriptMethod("ToggleHaleMovement"); // Trigger for HALE beginning cooldown. In the beginning set to stop HALE for 5s HaleStartCooldown = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); HaleStartCooldown.SetRepeatCount(1); HaleStartCooldown.SetIntervalTime(5000); HaleStartCooldown.SetScriptMethod("ToggleHaleMovement"); // Trigger for disabling player input for 2-3 seconds (ZA WARUDO). PlayerMovementStopper = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); PlayerMovementStopper.SetRepeatCount(1); PlayerMovementStopper.SetIntervalTime(750); PlayerMovementStopper.SetScriptMethod("TogglePlayerMovement"); // Time trigger for reanimating players ReanimateTrigger = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); ReanimateTrigger.SetRepeatCount(0); ReanimateTrigger.SetIntervalTime(200); ReanimateTrigger.SetScriptMethod("ReanimatePlayers"); // On death trigger for ondeath event for zombie hale IObjectTrigger deathTrigger = (IObjectTrigger)Game.CreateObject("OnPlayerDeathTrigger"); deathTrigger.SetScriptMethod("ondeath"); // At the beginning of the game set next HALE SetHale(); HelloHale(); zombies.Clear(); }
public void Fast(TriggerArgs args) { foreach (IObject missile in Game.GetMissileObjects()) { if (missile is IObjectWeaponItem) { float speed = 100; if ((speed > 1 || ((IObjectWeaponItem)missile).WeaponItemType == WeaponItemType.Rifle) && !(missile.CustomId == "ScriptMarkedMissile") && (!(ThrownWeapons.Contains(missile.Name)) || AccelerateThrownWeapons) && !DisableThrowning) { missile.SetLinearVelocity(missile.GetLinearVelocity() * ThrowSpeedMultiply); missile.CustomId = "ScriptMarkedMissile"; if ((CreateFireCircleOnImpact || CreateExplosionOnImpact)) { IObjectTargetObjectJoint targetjoint = (IObjectTargetObjectJoint)Game.CreateObject("TargetObjectJoint", missile.GetWorldPosition(), 0f, missile.GetLinearVelocity(), missile.GetAngularVelocity()); targetjoint.SetTargetObject(missile); targetjoint.CustomId = "destructjoint"; } if (CreateRandomImpact && Rnd.Next(0, RandomProb) == 0) { int x = Rnd.Next(0, 25); IObjectTargetObjectJoint targetjoint = (IObjectTargetObjectJoint)Game.CreateObject("TargetObjectJoint", missile.GetWorldPosition(), 0f, missile.GetLinearVelocity(), missile.GetAngularVelocity()); targetjoint.SetTargetObject(missile); if (x < 25) { targetjoint.CustomId = "Minejoint"; missile.SetLinearVelocity(missile.GetLinearVelocity() * 1.5f); IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer.SetIntervalTime(500); Timer.SetRepeatCount(1); Timer.SetScriptMethod("Mine"); Timer.Trigger(); } if (x >= 9 && x < 15) { targetjoint.CustomId = "Grenadejoint"; missile.SetLinearVelocity(missile.GetLinearVelocity() * 1.5f); IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer.SetIntervalTime(250); Timer.SetRepeatCount(1); Timer.SetScriptMethod("grenade"); Timer.Trigger(); } if (x >= 3 && x < 9) { targetjoint.CustomId = "Bazookajoint"; missile.SetLinearVelocity(missile.GetLinearVelocity() * 1.5f); IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer.SetIntervalTime(250); Timer.SetRepeatCount(1); Timer.SetScriptMethod("bazooka"); Timer.Trigger(); } if (x <= 2) { targetjoint.CustomId = "Electricjoint"; missile.SetLinearVelocity(missile.GetLinearVelocity() * 1.5f); } } if (IncreaseMeleeWeaponMass && ((IObjectWeaponItem)missile).WeaponItemType == WeaponItemType.Melee) { missile.SetMass((float)0.8); } } if ((CreateFireCircleOnImpact || CreateExplosionOnImpact) && speed < 4 && missile.CustomId == "ScriptMarkedMissile") { missile.TrackAsMissile(false); } if (DisableThrownWeaponsCollision || DisableThrowning) { if (ThrownWeapons.Contains(missile.Name)) { missile.TrackAsMissile(false); } } if (DisableThrowning) { missile.TrackAsMissile(false); if (speed > 5) { missile.SetLinearVelocity(missile.GetLinearVelocity() / 3); } } if (SetMissileOnFire && !DisableThrowning && (missile.CustomId == "ScriptMarkedMissile")) { missile.SetMaxFire(); missile.SetHealth(100); } } } }
/// <summary> /// This method is executed when map starts /// </summary> public void OnStartup() { if (CreateFireCircleOnImpact || CreateExplosionOnImpact || CreateRandomImpact) { /* This timer controls fire circles, explosions on impact and/or random impacts */ IObjectTimerTrigger Timer0 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer0.SetIntervalTime(75); Timer0.SetRepeatCount(0); Timer0.SetScriptMethod("VeryFast"); Timer0.Trigger(); } IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer.SetIntervalTime(100); Timer.SetRepeatCount(0); Timer.SetScriptMethod("Fast"); Timer.Trigger(); IObjectTimerTrigger Timer2 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer2.SetIntervalTime(400); if (CreateRandomImpact) { Timer2.SetIntervalTime(100); } Timer2.SetRepeatCount(0); Timer2.SetScriptMethod("Slow"); Timer2.Trigger(); if (GiveWeaponDefault) { Game.WriteToConsole("Weapon " + GiveWeaponDefault.ToString() + " is going to be given to players!"); IObjectTimerTrigger Timer3 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); Timer3.SetIntervalTime(15000); Timer3.SetRepeatCount(0); if (ThrownWeaponsClass.Contains(DefaultWeapon)) { // Chosen weapon is a thrown weapon. Timer3.SetScriptMethod("MidOne"); } if (RifleWeaponsClass.Contains(DefaultWeapon)) { // Chosen weapon is a rifle. Timer3.SetScriptMethod("MidTwo"); } if (HandWeaponsClass.Contains(DefaultWeapon)) { // Chosen weapon is a hand weapon. Timer3.SetScriptMethod("MidThree"); } if (MeleeWeaponsClass.Contains(DefaultWeapon)) { // Chosen weapon is a melee weapon. Timer3.SetScriptMethod("MidFour"); } if (MakeShiftWeaponsClass.Contains(DefaultWeapon)) { // Chosen weapon is a throwable weak weapon. Timer3.SetScriptMethod("MidFive"); } Timer3.Trigger(); } }