void TradeWithVolodia_Success(MyMissionBase sender) { MyScriptWrapper.GetEntity((uint)EntityID.Hub1).Enabled = true; MyScriptWrapper.GetEntity((uint)EntityID.Hub2).Enabled = true; MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.Mothership)); MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.CommandoSpawnPoint); //aktivace spawnpointu pri startu mise MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.VolodiaCommandoSpawnPoint); //aktivace spawnpointu pri startu mise MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.VolodiaCommandoSpawnPoint2); //aktivace spawnpointu pri startu mise var detector = MyScriptWrapper.GetDetector((uint)EntityID.DummyNearFrequencyHub); detector.On(); }
public override void ValidateIds() // checks if all IDs in enum are loaded correctly { foreach (var value in Enum.GetValues(typeof(EntityID))) { MyScriptWrapper.GetEntity((uint)((value as EntityID?).Value)); } foreach (List <uint> list in m_ValidateIDlists) { foreach (var item in list) { MyScriptWrapper.GetEntity(item); } } }
private void MyScriptWrapper_OnDialogueFinished(MyDialogueEnum dialogue, bool interrupted) { if (dialogue == MyDialogueEnum.CHINESE_ESCAPE_0100_INTRODUCTION) { MyScriptWrapper.PlayDialogue(MyDialogueEnum.CHINESE_ESCAPE_0200_IT_IS_TRAP); } else if (dialogue == MyDialogueEnum.CHINESE_ESCAPE_0200_IT_IS_TRAP) { MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Rainiers, MyMwcObjectBuilder_FactionEnum.China, MyFactions.RELATION_WORST); MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3, "MM01"); m_motherShipSpeed = MOTHERSHIP_FULLSPEED; foreach (var spawn in m_spawnCompanions) { MyScriptWrapper.ChangeFaction(spawn, MyMwcObjectBuilder_FactionEnum.China); foreach (var bot in MyScriptWrapper.GetSpawnPointBots(spawn)) { if (bot.Ship != null) { MyScriptWrapper.ChangeFaction(bot.Ship.EntityId.Value.NumericValue, MyMwcObjectBuilder_FactionEnum.China); bot.Ship.SpeedModifier = 1f; MyScriptWrapper.SetEntityDestructible(bot.Ship, true); m_attackerBots.Add(bot.Ship); } } } m_detectorFirst.Off(); m_detectorFirst.OnEntityEnter -= DetectorActionFirst; m_detectorSecond.OnEntityEnter += DetectorActionSecond; m_detectorSecond.On(); m_reassignBotTargets = true; //AssignTargetsToBots(); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification( MyTextsWrapperEnum.WatchMothershipHealth, MyHudConstants.ENEMY_FONT, 8000, null)); } else if (dialogue == MyDialogueEnum.CHINESE_ESCAPE_0300_ON_THIRD) { MyScriptWrapper.PlayDialogue(MyDialogueEnum.CHINESE_ESCAPE_0400_ON_NINE); } }
public override void Load(MyMissionBase sender) { base.Load(sender); m_detector = MyScriptWrapper.GetDetector(m_detectorID); if (m_detector != null) { m_detector.OnEntityEnter += OnDetector; m_detector.On(); } m_currentWave = 0; m_spawnedBots = new List <MyEntity>(); }
/* void FreeMothershipMSSuccess(MyMissionBase sender) * { * MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Mothership_Spawn_1); * MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Mothership_Spawn_2); * MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Mothership_Spawn_3); * sender.OnMissionSuccess -= FreeMothershipMSSuccess; * * }*/ void FreePilotsMSSuccess(MyMissionBase sender) { foreach (var spawn in m_pilotsSpawn) { MyScriptWrapper.ActivateSpawnPoint(spawn); } MyScriptWrapper.DeactivateSpawnPoint((uint)EntityID.Endless_spawn); //MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Mothership_Spawn_1); //MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Mothership_Spawn_2); //MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Mothership_Spawn_3); MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3); //sender.OnMissionSuccess -= FreePilotsMSSuccess; }
private bool CheckWin() { foreach (uint item in Puzzle) { var puzzleDetector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity(item)); MyDummyPoint dummyPoint = (MyDummyPoint)puzzleDetector.Parent; if (dummyPoint.Color != Color.Green.ToVector4()) { Reset(); return(false); } } return(true); }
private void StartRace() { Name = m_normalName; ReloadAdditionalHubInfo(); foreach (MyRacer racer in m_racers) { racer.StartRace(); } MyScriptWrapper.PlaySound3D(m_detector, MySoundCuesEnum.VocRace03cleanStart); if (RaceStarted != null) { RaceStarted(); } }
public override void ValidateIds() { base.ValidateIds(); foreach (var entityIds in new List <List <uint> > { m_scanners1IDs, m_minesDummies }) { foreach (var entityId in entityIds) { MyScriptWrapper.GetEntity(entityId); } } }
private List <MySmallShipBot> GetBotsFromSpawnpoints(IEnumerable <uint> spawnPoints) { var result = new List <MySmallShipBot>(); foreach (var spawnPoint in spawnPoints) { var bots = MyScriptWrapper.GetSpawnPointBots(spawnPoint); foreach (var bot in bots) { result.Add(bot.Ship); } } return(result); }
private void RaceStarted() { MySmallShipBot challenger = (MySmallShipBot)MyScriptWrapper.GetEntity("Challenger"); challenger.LookTarget = null; MySmallShipBot racer3 = (MySmallShipBot)MyScriptWrapper.GetEntity("Racer3"); racer3.LookTarget = null; MySmallShipBot racer2 = (MySmallShipBot)MyScriptWrapper.GetEntity("Racer2"); racer2.LookTarget = null; }
private void StartPositionEntered(MyEntityDetector sender, MyEntity entity, int meetcriterias) { if (m_unfollowedCompanions == false) { MyScriptWrapper.StopFollow(m_marcus); MyScriptWrapper.StopFollow(m_tarja); MyScriptWrapper.StopFollow(m_vitolino); m_unfollowedCompanions = true; } if (sender == m_detector_ReachStart && entity == MySession.PlayerShip) { m_playerIsOnStart = true; } }
void O05MetZappasFirstGangmanSuccess(MyMissionBase sender) { foreach (var spawn in new List <uint> { (uint)EntityID.MomoGangMember1, (uint)EntityID.MomoGangMember2 }) { var entity = MyScriptWrapper.GetEntity(spawn) as MySmallShipBot; if (entity != null) { entity.LookTarget = null; } MyScriptWrapper.ChangeFaction(entity, MyMwcObjectBuilder_FactionEnum.Slavers); } }
void OnEntityDeath(MyEntity entity, MyEntity killedBy) { if (MyScriptWrapper.IsPlayerShip(killedBy) && !m_shootWarningSent) { m_shootWarningSent = true; MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.DontShoot, MyHudConstants.ENEMY_FONT, 10000)); return; } if (MyScriptWrapper.IsPlayerShip(killedBy) && !MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_ASSAULT)) { Fail(MyTextsWrapperEnum.DontShoot); } }
public override void ValidateIds() { var list = new List <uint>(); list.AddRange(m_hideEntities); foreach (var u in list) { MyScriptWrapper.GetEntity(u); } base.ValidateIds(); }
public void LaunchAlarm(object sender, MyEntity entity) { if (!AlarmOn) { if (OnAlarmLaunchned != null) { OnAlarmLaunchned(sender, entity); } MyScriptWrapper.OnAlarmLaunched(this, entity); AlarmOn = true; AggroBots(entity); } }
public override void Load() { //Because he has different position from junkyard race MyEntity manjeet = MyScriptWrapper.GetEntity((int)EntityID.FlyToManjeet); manjeet.SetPosition(new Vector3(-7529.0f, -3368.0f, 5938.0f)); m_marcusForCrashDialoguePlayed = false; MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapperOnOnSpawnpointBotSpawned; MyScriptWrapper.OnBotReachedWaypoint += MyScriptWrapperOnOnBotReachedWaypoint; MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished; MyScriptWrapper.OnEntityAtacked += MyScriptWrapperOnOnEntityAtacked; MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.CalmAtmosphere, 0, "KA01"); MyScriptWrapper.OnSentenceStarted += MyScriptWrapper_OnSentenceStarted; m_speakWithPoliceDialogueFinished = false; m_ravenGuy = (MySmallShipBot)MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.VALENTIN)); m_ravenGuy.SleepDistance = 8000; m_gameVolume = MyScriptWrapper.GetGameVolume(); m_ravenGirl = (MySmallShipBot)MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.TARJA)); m_ravenGirl.SleepDistance = 8000; m_marcus = (MySmallShipBot)MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MARCUS)); m_marcus.SleepDistance = 8000; m_madelyn = MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MADELYN)); MyScriptWrapper.SetEntityDestructible(m_madelyn, false); m_madelyn.SetWorldMatrix(MyScriptWrapper.GetEntity((uint)EntityID.MadelynStart).WorldMatrix); m_madelynTurrets = new MyPrefabLargeWeapon[3]; m_madelynTurrets[0] = (MyPrefabLargeWeapon)MyScriptWrapper.GetEntity("BackTurretM"); m_madelynTurrets[1] = (MyPrefabLargeWeapon)MyScriptWrapper.GetEntity("FrontTurretM"); m_madelynTurrets[2] = (MyPrefabLargeWeapon)MyScriptWrapper.GetEntity("BottomTurretM"); MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint)EntityID.EACMothershipContainer1), -1, true); MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint)EntityID.EACMothershipContainer2), -1, true); m_ravenGuyIn = false; m_madelynMoving = false; m_madelynMoving2 = false; m_desperationFadeout = false; base.Load(); }
private void DisableScanner2_Success(MyMissionBase sender) { Components.Remove(m_deadlyScanners); MyScriptWrapper.SetEntitiesEnabled(m_scanners1IDs, false); var bots = MyScriptWrapper.GetSpawnPointBots((uint)EntityID.SpawnAlarm2); foreach (var bot in bots) { var smallShipBot = bot.Ship; smallShipBot.SetWaypointPath("group3"); smallShipBot.PatrolMode = MyPatrolMode.ONE_WAY; smallShipBot.Patrol(); } }
public override void ValidateIds() { foreach (var value in Enum.GetValues(typeof(EntityID))) { MyScriptWrapper.GetEntity((uint)((value as EntityID?).Value)); } foreach (var value in m_eruptionDetectors) { MyScriptWrapper.GetEntity(value); } foreach (var value in m_meteorDetectors) { MyScriptWrapper.GetEntity(value); } }
void O07DSpeakWithMomoLoaded(MyMissionBase sender) { m_momoBoss.LookTarget = MySession.PlayerShip; foreach (var spawn in new List <uint> { (uint)EntityID.SP4_1, (uint)EntityID.SP4_2, (uint)EntityID.MomoZappaSP }) { MyScriptWrapper.ChangeFaction(spawn, MyMwcObjectBuilder_FactionEnum.Slavers); foreach (var bot in MyScriptWrapper.GetSpawnPointBots(spawn)) { MyScriptWrapper.SetEntityDestructible(bot.Ship, true); MyScriptWrapper.ChangeFaction(bot.Ship, MyMwcObjectBuilder_FactionEnum.Slavers); } } }
public override void Load() // Code in that block will be called on the load of the sector { base.Load(); MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3); // Sets music group to be played in the sector - no matter if the mission is running or not base.Load(); m_Detector1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector1)); m_Detector1.OnEntityEnter += Detector1Action; m_Detector1.On(); m_Detector2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector2)); m_Detector2.OnEntityEnter += Detector2Action; m_Detector2.On(); }
private void AddLabelToCurrentCheckPoint() { string label = (m_currentCheckPointIndex + 1).ToString(CultureInfo.InvariantCulture) + "/" + m_raceLocations.Count.ToString(CultureInfo.InvariantCulture); m_raceLocations[m_currentCheckPointIndex].Entity = MyScriptWrapper.GetEntity(m_raceLocations[m_currentCheckPointIndex].LocationEntityIdentifier); SetLocationVisibility(true, m_raceLocations[m_currentCheckPointIndex].Entity, MyGuitargetMode.Objective); MyHudIndicatorFlagsEnum flags = MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE; MyHud.ChangeText(m_raceLocations[m_currentCheckPointIndex].Entity, new StringBuilder(label), MyGuitargetMode.Objective, 0, flags); }
public override bool IsSuccess() { if (m_success) { return(true); } if (m_botToTalk != null && Vector3.DistanceSquared(m_botToTalk.GetPosition(), MySession.PlayerShip.GetPosition()) <= m_distanceToTalk * m_distanceToTalk) { MyScriptWrapper.Follow(MySession.PlayerShip, m_botToTalk); m_botToTalk.LookTarget = MySession.PlayerShip; return(true); } return(false); }
public override void Update(MyMissionBase sender) { base.Update(sender); var progress = sender.MissionTimer.ElapsedTime / (float)m_time; if (progress < 1.0f && m_shipMoving) { var position = Vector3.SmoothStep(m_trajectory.From, m_trajectory.To, progress); MyScriptWrapper.Move(m_ship, position); } else { StopShip(); } }
private void FindArtifactOnOnMissionLoaded(MyMissionBase sender) { sender.SetLocationVisibility(true, MyScriptWrapper.GetEntity((uint)EntityID.Box1Marker), MyGuitargetMode.Objective); sender.SetLocationVisibility(true, MyScriptWrapper.GetEntity((uint)EntityID.Box2Marker), MyGuitargetMode.Objective); sender.SetLocationVisibility(true, MyScriptWrapper.GetEntity((uint)EntityID.Box3Marker), MyGuitargetMode.Objective); sender.SetLocationVisibility(true, MyScriptWrapper.GetEntity((uint)EntityID.Box4Marker), MyGuitargetMode.Objective); InitDetector((uint)EntityID.Box1Marker, Box1Entered); InitDetector((uint)EntityID.Box2Marker, Box2Entered); InitDetector((uint)EntityID.Box3Marker, Box3Entered); InitDetector((uint)EntityID.Box4Marker, Box4Entered); MyScriptWrapper.Highlight((uint)EntityID.PrefabArtifact, true, this); }
private void DetectorOnOnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias) { var isEnteredWithDrone = MyGuiScreenGamePlay.Static.IsControlledDrone && entity == MyGuiScreenGamePlay.Static.ControlledDrone; if (MyScriptWrapper.IsPlayerShip(entity) || isEnteredWithDrone) { m_detector.Off(); MyScriptWrapper.PlayDialogue(m_dialogueId); if (OnDialogStarted != null) { OnDialogStarted(); } } }
private void Script_BotReachedWaypoint(MyEntity bot, MyEntity waypoint) { MySmallShipBot challenger = (MySmallShipBot)MyScriptWrapper.GetEntity("Challenger"); MySmallShipBot racer2 = (MySmallShipBot)MyScriptWrapper.GetEntity("Racer2"); MySmallShipBot racer3 = (MySmallShipBot)MyScriptWrapper.GetEntity("Racer3"); if (waypoint == MyScriptWrapper.GetEntity((uint)EntityID.ChallengerStartPosWaypoint) && bot == challenger) { m_challengerIsOnStart = true; MySmallShipBot botship = (MySmallShipBot)bot; botship.LookTarget = MyScriptWrapper.GetEntity((uint)EntityID.LookAtDummy); racer3.LookTarget = MyScriptWrapper.GetEntity((uint)EntityID.LookAtDummy); racer2.LookTarget = MyScriptWrapper.GetEntity((uint)EntityID.LookAtDummy); } }
void DestroyedTransformator(MyMissionBase sender) { foreach (var Light in m_greenLights) { var item = MyScriptWrapper.TryGetEntity(Light); if (item != null) { item.MarkForClose(); } } foreach (var Light in m_redLights) { MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity(Light)); } }
public override void Load() { m_emptyString = new StringBuilder(); m_isFailed = false; if (BotLoaded != null) { foreach (var racerName in RacerNames) { MySmallShipBot racer = (MySmallShipBot)MyScriptWrapper.GetEntity(racerName); BotLoaded(racer); } } MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapper_OnSpawnpointBotSpawned; ResetStart(); m_raceLocations = new List <MyMissionLocation>(); foreach (uint u in m_checkpointsIDs) { MyMissionLocation loc = new MyMissionLocation(m_sector, u); MyEntity entity; MyEntities.TryGetEntityById(new MyEntityIdentifier(u), out entity); loc.Entity = entity; m_raceLocations.Add(loc); } m_isStartingGame = true; m_startingTime = 0; m_detector = MyScriptWrapper.GetDetector(m_detectorID); if (m_detector != null) { m_detector.OnEntityEnter += OnDetectorEnter; m_detector.OnEntityLeave += OnDetectorLeave; m_detector.On(); } foreach (var myRacer in m_racers) { myRacer.Load(); } m_currentCheckPointIndex = 0; m_restartRace = false; base.Load(); }
public override void Update() { if (m_dummy == null) { return; } base.Update(); if (m_invalid) { return; } if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() < FailDistanceTooShort) { MyScriptWrapper.PlayDialogue(ShortDialog); m_target.SpeedModifier = 2.00f; m_dummy = null; } if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() < FailDistanceTooShort + WarningDelta) { MyScriptWrapper.AddNotification(m_notificationWarningSlowDown); m_notificationWarningSlowDown.Appear(); } else { m_notificationWarningSlowDown.Disappear(); } if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() > FailDistanceTooFar) { MyScriptWrapper.PlayDialogue(FarDialog); m_dummy = null; } if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() > FailDistanceTooFar - WarningDelta) { m_notificationWarningHurry.Appear(); MyScriptWrapper.AddNotification(m_notificationWarningHurry); } else { m_notificationWarningHurry.Disappear(); } }
public override void Load() // Code in that block will be called on the load of the sector { base.Load(); MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapperOnOnSpawnpointBotSpawned; MyScriptWrapper.OnBotReachedWaypoint += MyScriptWrapperOnBotReachedWaypoint; MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.DesperateWithStress); // Sets music group to be played in the sector - no matter if the mission is running or not m_ravenguyBot = MyScriptWrapper.GetEntity("RavenGuy") as MySmallShipBot; m_ravengirlBot = MyScriptWrapper.GetEntity("RavenGirl") as MySmallShipBot; m_marcus = MyScriptWrapper.GetEntity("Marcus") as MySmallShipBot; m_reef = MyScriptWrapper.GetEntity((uint)EntityID.FrancisReef) as MySmallShipBot; m_barkeeper = MyScriptWrapper.GetEntity((uint)EntityID.Barkeeper) as MySmallShipBot; MyScriptWrapper.SetEntityEnabled((uint)EntityID.FactoryFound, false); }