void TeleportHaleToPlayers() { IPlayer[] players = Game.GetPlayers(); IPlayer plr = HALE; float HalePlace = HALE.GetWorldPosition().X; int faceDir = plr.GetFaceDirection(); int counter = 1; int index; bool isSideRight; while ((plr == HALE || plr.IsDead == true) & counter < 20) { index = m_rnd.Next(0, players.Length); isSideRight = HalePlace < players[index].GetWorldPosition().X; // Player on the right side? if (faceDir == 1 & isSideRight) { plr = players[index]; } // Player on the left side? else if (faceDir == -1 & !isSideRight) { plr = players[index]; } counter++; } Game.PlaySound("ChurchBell1", plr.GetWorldPosition(), 1); SFDGameScriptInterface.Vector2 nextPlace = plr.GetWorldPosition(); HALE.SetWorldPosition(nextPlace); }
void TeleportPlayerToSpawns(IPlayer plr) { IObject[] spawnAreas = Game.GetObjectsByName("SpawnPlayer"); int rnd = m_rnd.Next(0, spawnAreas.Length); SFDGameScriptInterface.Vector2 place = spawnAreas[rnd].GetWorldPosition(); plr.SetWorldPosition(place); }
public void render(IUser user) { if (user.GetPlayer() != null) { SFDGameScriptInterface.Vector2 zpos = user.GetPlayer().GetWorldPosition(); IPlayer zp = Game.CreatePlayer(zpos); zp.SetUser(user); zp.SetTeam(PlayerTeam.Team2); zombie(user); zombies.Add(zp); Game.ShowPopupMessage("WELCOME TO THE FAMILY"); } }
// Creates new TP-zone to save HALE from falling into death (with penalty of losing life) public void SetSafeZone(SFDGameScriptInterface.Vector2 pos, SFDGameScriptInterface.Point sizeFactor) { // Create a new trigger with the IObjectAreaTrigger saveHaleZone = (IObjectAreaTrigger)Game.CreateObject("AreaTrigger", pos); saveHaleZone.SetOnEnterMethod("KillZoneTrigger"); saveHaleZone.SetSizeFactor(sizeFactor); if (MODE) { Game.RunCommand("/MSG " + "SIZE : " + saveHaleZone.GetSize().ToString()); Game.RunCommand("/MSG " + "SIZEFACTOR : " + saveHaleZone.GetSizeFactor().ToString()); Game.RunCommand("/MSG " + "BASESIZE : " + saveHaleZone.GetBaseSize().ToString()); } }
// If falling thing is HALE, then tp to safety public void KillZoneTrigger(TriggerArgs args) { if (MODE) { Game.RunCommand("/MSG " + "Jotain rajalla"); } if (args.Sender == HALE) { int newHealth; if (HALENAMES[HALETYPE] == "Sick Father") { newHealth = (int)HALE.GetHealth() - 25; } else { newHealth = (int)HALE.GetHealth() - 50; } HALE.SetHealth(newHealth); IObject[] spawnAreas = Game.GetObjectsByName("SpawnPlayer"); int rnd = m_rnd.Next(0, spawnAreas.Length); SFDGameScriptInterface.Vector2 place = spawnAreas[rnd].GetWorldPosition(); if (newHealth < 0) { Game.RunCommand("/MSG " + "Ai saatana :( t. " + HALE.GetUser().Name); } else { Game.RunCommand("/MSG " + "EN KUOLE SAATANA t. " + HALE.GetUser().Name); HALE.SetWorldPosition(place); } } else if (zombifyHumansOnDeath == true) { if (args.Sender is IPlayer) { IPlayer plr = args.Sender as IPlayer; if (plr.GetTeam() == PlayerTeam.Team1) { TeleportPlayerToSpawns(plr); plr.Kill(); // render(plr.GetUser()); } } } }
// Try to modify Gib Zones to be non-lethal for HALE. public void ModGibZones() { string mapName = Game.MapName; if (mapName == "Hazardous") { SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-172, -120); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(52, 2); SetSafeZone(position, sizeFactor); } else if (mapName == "Police Station") { // Game.RunCommand("/MAPROTATION " + "10"); // for (int i = 0; i < 100; i++) // { // Game.RunCommand("/MSG " + "nothing suspicious here..."); // } // Bottom SFDGameScriptInterface.Vector2 position1 = new SFDGameScriptInterface.Vector2(-740, -128); SFDGameScriptInterface.Point sizeFactor1 = new SFDGameScriptInterface.Point(93, 3); // Left SFDGameScriptInterface.Vector2 position2 = new SFDGameScriptInterface.Vector2(-740, 230); SFDGameScriptInterface.Point sizeFactor2 = new SFDGameScriptInterface.Point(5, 45); SetSafeZone(position1, sizeFactor1); SetSafeZone(position2, sizeFactor2); } else if (mapName == "Canals") { SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-212, -164); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(37, 2); SetSafeZone(position, sizeFactor); } else if (mapName == "Castle Courtyard") { SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(360, -300); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(32, 2); SetSafeZone(position, sizeFactor); } else if (mapName == "Rooftops") { // Bottom SFDGameScriptInterface.Vector2 position1 = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor1 = new SFDGameScriptInterface.Point(125, 3); // Left SFDGameScriptInterface.Vector2 position2 = new SFDGameScriptInterface.Vector2(-500, 330); SFDGameScriptInterface.Point sizeFactor2 = new SFDGameScriptInterface.Point(5, 67); // Right - ei toimi? SFDGameScriptInterface.Vector2 position3 = new SFDGameScriptInterface.Vector2(500, 330); SFDGameScriptInterface.Point sizeFactor3 = new SFDGameScriptInterface.Point(5, 67); SetSafeZone(position1, sizeFactor1); SetSafeZone(position2, sizeFactor2); SetSafeZone(position3, sizeFactor3); } else if (mapName == "Chemical Plant") { // Left acid container SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-76, -120); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(14, 3); SetSafeZone(position, sizeFactor); } else if (mapName == "Sector 8") { // Bottom SFDGameScriptInterface.Vector2 position1 = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor1 = new SFDGameScriptInterface.Point(125, 3); // Left SFDGameScriptInterface.Vector2 position2 = new SFDGameScriptInterface.Vector2(-500, 330); SFDGameScriptInterface.Point sizeFactor2 = new SFDGameScriptInterface.Point(5, 67); // Right SFDGameScriptInterface.Vector2 position3 = new SFDGameScriptInterface.Vector2(500, 330); SFDGameScriptInterface.Point sizeFactor3 = new SFDGameScriptInterface.Point(5, 67); SetSafeZone(position1, sizeFactor1); SetSafeZone(position2, sizeFactor2); SetSafeZone(position3, sizeFactor3); } else if (mapName == "Rooftops II") { // Bottom SFDGameScriptInterface.Vector2 position1 = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor1 = new SFDGameScriptInterface.Point(125, 3); // Left SFDGameScriptInterface.Vector2 position2 = new SFDGameScriptInterface.Vector2(-500, 330); SFDGameScriptInterface.Point sizeFactor2 = new SFDGameScriptInterface.Point(5, 67); // Right SFDGameScriptInterface.Vector2 position3 = new SFDGameScriptInterface.Vector2(500, 330); SFDGameScriptInterface.Point sizeFactor3 = new SFDGameScriptInterface.Point(5, 67); SetSafeZone(position1, sizeFactor1); SetSafeZone(position2, sizeFactor2); SetSafeZone(position3, sizeFactor3); } else if (mapName == "Heavy Equipment") { // Bottom SFDGameScriptInterface.Vector2 position1 = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor1 = new SFDGameScriptInterface.Point(125, 3); // Right SFDGameScriptInterface.Vector2 position2 = new SFDGameScriptInterface.Vector2(500, 330); SFDGameScriptInterface.Point sizeFactor2 = new SFDGameScriptInterface.Point(5, 67); SetSafeZone(position1, sizeFactor1); SetSafeZone(position2, sizeFactor2); } else if (mapName == "Plant 47") { // Bottom SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(132, -172); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(16, 3); SetSafeZone(position, sizeFactor); } else if (mapName == "Old Warehouse") { // Bottom SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(125, 3); SetSafeZone(position, sizeFactor); } else if (mapName == "Tower") { // Bottom SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(125, 3); SetSafeZone(position, sizeFactor); } else if (mapName == "Pistons") { // Bottom SFDGameScriptInterface.Vector2 position1 = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor1 = new SFDGameScriptInterface.Point(125, 3); SetSafeZone(position1, sizeFactor1); // The GIB-buckets: SFDGameScriptInterface.Vector2 position2 = new SFDGameScriptInterface.Vector2(-216, -40); SFDGameScriptInterface.Point sizeFactor2 = new SFDGameScriptInterface.Point(10, 4); SetSafeZone(position2, sizeFactor2); } else if (mapName == "Facility") { // Bottom SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-500, -200); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(125, 5); SetSafeZone(position, sizeFactor); // Maybe left?? } else if (mapName == "Steamship") { // Bottom SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-500, -180); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(125, 5); SetSafeZone(position, sizeFactor); } else if (mapName == "East Warehouse") { // Bottom SFDGameScriptInterface.Vector2 position = new SFDGameScriptInterface.Vector2(-500, -150); SFDGameScriptInterface.Point sizeFactor = new SFDGameScriptInterface.Point(32, 5); SetSafeZone(position, sizeFactor); // Left?? } else { Game.RunCommand("/MSG " + "Mapissa " + mapName + ": Halen tervapeikko is off"); } }