public override void Load() { base.Load(); m_dummy = MyScriptWrapper.GetEntity(m_dummyId); MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnDialogueFinished; m_notificationWarningHurry = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.HurryUp, MyGuiManager.GetFontMinerWarsRed()); m_notificationWarningSlowDown = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.SlowDown, MyGuiManager.GetFontMinerWarsRed()); MyScriptWrapper.AddNotification(m_notificationWarningHurry); m_notificationWarningHurry.Disappear(); MyScriptWrapper.AddNotification(m_notificationWarningSlowDown); m_notificationWarningSlowDown.Disappear(); m_invalid = false; //We prevent mission fail by this when skipping with ctrl+del if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() < FailDistanceTooShort) { m_invalid = true; } //We prevent mission fail by this when skipping with ctrl+del if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() > FailDistanceTooFar) { m_invalid = true; } }
protected void MyScriptWrapperOnOnHarvesterUse() { bool harvestingIn = false; MyScriptWrapper.GetEntitiesInDummyPoint((uint)EntityID.DontuseHarvestor1, m_entities); if (m_entities.Contains(MySession.PlayerShip)) { harvestingIn = true; } MyScriptWrapper.GetEntitiesInDummyPoint((uint)EntityID.Detector3, m_entities); if (m_entities.Contains(MySession.PlayerShip)) { harvestingIn = true; } if (harvestingIn) { if (m_harvesterWarningSend) { Fail(Localization.MyTextsWrapperEnum.DontHarvest); } MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.DontHarvest, MyGuiManager.GetFontMinerWarsRed(), 5000)); m_harvesterWarningSend = true; } }
void O10FindBombDealerLoaded(MyMissionBase sender) { m_manjeet.LookTarget = null; MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Special, 1, "MM01"); MyScriptWrapper.SetSleepDistance(m_marcus, 5000); MyScriptWrapper.StopFollow(m_marcus); m_marcus.SetWaypointPath("MarcusOut"); m_marcus.SpeedModifier = 2.0f; MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.MarcusIsLeavingForTarja, MyGuiManager.GetFontMinerWarsGreen(), 5000)); m_marcus.PatrolMode = MyPatrolMode.ONE_WAY; m_marcus.Patrol(); m_valentin = (MySmallShipBot)MyScriptWrapper.GetEntity("RavenGuy"); m_valentin.LeaderLostEnabled = true; MyScriptWrapper.MarkEntity(m_valentin, MyTextsWrapper.Get(MyActorConstants.GetActorDisplayName(MyActorEnum.VALENTIN)).ToString(), HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS, HUD.MyGuitargetMode.Friend); MyScriptWrapper.StopFollow(m_valentin); MyEntity valentinPosition = MyScriptWrapper.GetEntity((uint)EntityID.ValentinBRPosition); m_valentin.SetWorldMatrix(valentinPosition.WorldMatrix); m_tarja.LeaderLostEnabled = true; MyScriptWrapper.StopFollow(m_tarja); MyScriptWrapper.MarkEntity(m_tarja, MyTextsWrapper.Get(MyActorConstants.GetActorDisplayName(MyActorEnum.TARJA)).ToString(), HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS, HUD.MyGuitargetMode.Friend); MyEntity tarjaPosition = MyScriptWrapper.GetEntity((uint)EntityID.TarjaBRPosition); m_tarja.SetWorldMatrix(tarjaPosition.WorldMatrix); MyScriptWrapper.SetEntityDisplayName(m_tarja, MyTextsWrapper.Get(MyTextsWrapperEnum.Actor_Tarja).ToString()); MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.BombDealer)); }
private void OnDetectorLeave(MyEntityDetector sender, MyEntity entity) { if (m_isStartingGame) { MyScriptWrapper.RemoveEntityMark(m_detector); m_restartRace = true; MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.GoBackToStartingPosition, MyHudConstants.ENEMY_FONT, 5000)); Name = m_goBackName; for (int i = 0; i < notifyCount; i++) { if (notifications[i] != null) { notifications[i].Disappear(); } } if (OnStartNumberChanged != null) { OnStartNumberChanged(-1); } if (m_startSoundFinished) { MyAudio.Stop(); } } }
private void GetOreSubmissionSuccess(MyMissionBase sender) { MyScriptWrapper.EntityInventoryItemAmountChanged -= OreAmountChanged; // remove the mined plutonium to prevend stupid players from breaking the game MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.PlutoniumStored, MyGuiManager.GetFontMinerWarsBlue(), 5000, new object[] { URANITE_TO_OBTAIN })); MyScriptWrapper.RemoveInventoryItemAmount(MyScriptWrapper.GetPlayerInventory(), MyMwcObjectBuilderTypeEnum.Ore, (int)MyMwcObjectBuilder_Ore_TypesEnum.URANITE, URANITE_TO_OBTAIN); }
private void AddDroneNotification() { m_learnToUseDrone = MyScriptWrapper.CreateNotification( MyTextsWrapperEnum.HowToControlDrone, MyHudConstants.MISSION_FONT, 0, new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_DEPLOY), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_CONTROL) } ); MyScriptWrapper.AddNotification(m_learnToUseDrone); }
private void SpeakCaptainOnOnMissionSuccess(MyMissionBase sender) { MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.NewMissionRecieved, MyHudConstants.FRIEND_FONT, 10000)); var position = m_madelynDummy.GetPosition(); var rotation = m_madelynDummy.GetOrientation(); m_madelyn.MoveAndRotate(position, rotation); //m_madelyn.SetWorldMatrix(m_madelynDummy.GetWorldMatrixForDraw()); MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.PrefabContainer)); MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.Scanner1), false); MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.Scanner2), false); }
void AddPanelPercentNotification() { if (m_hudSolarPanelsCounter != null) { m_hudSolarPanelsCounter.Disappear(); } m_hudSolarPanelsCounter = MyScriptWrapper.CreateNotification( MyTextsWrapperEnum.SolarPanelsLeft, MyHudConstants.MISSION_FONT, 0, new object[] { (int)((1 - (float)m_panelsLeft / m_totalPanelCount) * 100) }); MyScriptWrapper.AddNotification(m_hudSolarPanelsCounter); }
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); } }
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 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() { base.Load(); MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished; m_notification = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.DoNotGoThere, MyGuiManager.GetFontMinerWarsRed()); m_target = MyScriptWrapper.GetEntity(m_targetId); MyScriptWrapper.MarkEntity(m_target, NameTemp.ToString(), MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_TEXT, MyGuitargetMode.Objective); MyScriptWrapper.AddNotification(m_notification); m_notification.Disappear(); }
private void MyScriptWrapperOnFadedOut() { MyScriptWrapper.FadedOut -= MyScriptWrapperOnFadedOut; MyScriptWrapper.FadeIn(); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000, new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT) } )); MyScriptWrapper.TakeControlOfLargeWeapon(m_madelynTurrets[m_activeTurret]); MyScriptWrapper.ForbideDetaching(); MyScriptWrapper.SwitchTowerPrevious += MyScriptWrapper_SwitchTowerPrevious; MyScriptWrapper.SwitchTowerNext += MyScriptWrapper_SwitchTowerNext; }
public override void Update() { base.Update(); if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() < WarningDistance) { m_notification.Appear(); MyScriptWrapper.AddNotification(m_notification); } else { m_notification.Disappear(); } if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() < FailDistance) { Fail(MyTextsWrapperEnum.Fail_LostTarget); } }
private void UpdateNotifications() { if (MissionTimer.ElapsedTime > m_startingTime) { if (startCounter == 3) { MyScriptWrapper.PlaySound3D(m_detector, MySoundCuesEnum.VocRace02countdown); } if (startCounter == 0) { notifications[0] = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.Start, MyHudConstants.MISSION_FONT, startingTimeTick); MyScriptWrapper.AddNotification(notifications[0]); m_isStartingGame = false; AddLabelToCurrentCheckPoint(); if (OnStartNumberChanged != null) { OnStartNumberChanged(startCounter); } StartRace(); } else { notifications[startCounter] = MyScriptWrapper.CreateNotification(startCounter.ToString(), MyHudConstants.MISSION_FONT, startingTimeTick); MyScriptWrapper.AddNotification(notifications[startCounter]); m_startingTime = MissionTimer.ElapsedTime + startingTimeTick; if (OnStartNumberChanged != null) { OnStartNumberChanged(startCounter); } startCounter--; } } }
private void DestroyGenerator_Loaded(MyMissionBase sender) { MyScriptWrapper.ActivateSpawnPoints(m_wavesApolloSpawns); MyScriptWrapper.ActivateSpawnPoints(m_wavesMarcusSpawns); m_marcus.StopFollow(); m_ravenGuy.StopFollow(); m_marcus.SetWaypointPath("MarcusLeaved"); m_marcus.PatrolMode = MyPatrolMode.ONE_WAY; m_marcus.SeeDistance = 250f; m_marcus.Patrol(); m_ravenGuy.SetWaypointPath("VitolinoLeaved"); m_ravenGuy.SeeDistance = 250f; m_ravenGuy.PatrolMode = MyPatrolMode.ONE_WAY; m_ravenGuy.Patrol(); m_generatorPosition = MyScriptWrapper.GetEntity((uint)EntityID.DestroyGenerator).GetPosition(); MyScriptWrapper.ActivateSpawnPoints(m_barricadeLoomers); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.MarcusAndValentinoLeavingParty, MyGuiManager.GetFontMinerWarsGreen(), 10000)); EveryoneAttackMadelyn(); }
void LootSucces(MyMissionBase sender) { MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Loot_Spawn); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.TarjaAndValentinStaying, MyGuiManager.GetFontMinerWarsGreen(), 5000)); }
private void MarcusLocationIntelOnOnMissionSuccess(MyMissionBase sender) { MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTexts.DownloadFailed, MyGuiManager.GetFontMinerWarsRed(), 5000)); }
public override void Load() { if (!IsMainSector) { return; } RemoveFriends(); MyScriptWrapper.DisableAllGlobalEvents(); m_attackerBots.Clear(); m_detectorFirst = MyScriptWrapper.GetDetector((uint)EntityID.DetectorFirst); m_detectorSecond = MyScriptWrapper.GetDetector((uint)EntityID.DetectorSecond); m_detectorThird = MyScriptWrapper.GetDetector((uint)EntityID.DetectorThird); m_detectorFirst.SetSensorDetectRigidBodyTypes(null); m_detectorSecond.SetSensorDetectRigidBodyTypes(null); m_detectorThird.SetSensorDetectRigidBodyTypes(null); m_madelyn = MyScriptWrapper.GetEntity("Madelyn"); //Because she was hidden in previous mission MyScriptWrapper.UnhideEntity(m_madelyn); m_transporter = MyScriptWrapper.GetEntity((uint)EntityID.Transporter); m_transporter.OnContactEvent += new Action <MyEntity>(m_transporter_OnContactEvent); m_reassignBotTargets = false; m_motherShipSpeed = MOTHERSHIP_FULLSPEED; MyScriptWrapper.PrepareMotherShipForMove(m_transporter); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000, new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT) } )); foreach (var item in m_spawnCompanions) { MyScriptWrapper.ActivateSpawnPoint(item); } var pos = MySession.PlayerShip.WorldMatrix.Translation; MySession.PlayerShip.WorldMatrix = m_transporter.WorldMatrix; Vector3 playerPos = m_transporter.WorldMatrix.Translation - 400 * m_transporter.WorldMatrix.Forward; MyScriptWrapper.Move(MySession.PlayerShip, playerPos); //MyScriptWrapper.EnablePhysics(MySession.PlayerShip.EntityId.Value.NumericValue, false); MyScriptWrapper.HideEntity(MySession.PlayerShip); m_towers[0] = MyScriptWrapper.GetEntity((uint)EntityID.Tower1); m_towers[1] = MyScriptWrapper.GetEntity((uint)EntityID.Tower2); m_towers[2] = MyScriptWrapper.GetEntity((uint)EntityID.Tower3); MyScriptWrapper.SetEntityPriority(m_towers[0], -1); MyScriptWrapper.SetEntityPriority(m_towers[1], -1); MyScriptWrapper.SetEntityPriority(m_towers[2], -1); MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint)EntityID.TowerDown), -1); MyScriptWrapper.TakeControlOfLargeWeapon(m_towers[m_activeTower]); MyScriptWrapper.ForbideDetaching(); MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Mystery); MyScriptWrapper.SwitchTowerPrevious += MyScriptWrapper_SwitchTowerPrevious; MyScriptWrapper.SwitchTowerNext += MyScriptWrapper_SwitchTowerNext; MyScriptWrapper.EntityDeath += MyScriptWrapper_OnEntityDeath; MyScriptWrapper.OnSpawnpointBotSpawned += BotSpawned; m_objective01_flyTowardsMadelyn.OnMissionLoaded += O01FlyTowardsMadelynLoaded; m_objective01_flyTowardsMadelyn.OnMissionSuccess += O01FlyTowardsMadelynSuccess; m_madelynDestinationReached = false; m_transporterDestinationReached = false; m_moveMadelynFlag = false; m_towersCount = 3; m_activeTower = 0; m_switchCounter = 0; MyScriptWrapper.DrawHealthOfCustomPrefabInLargeWeapon(MyScriptWrapper.GetEntity((uint)EntityID.TransporterShip)); MyScriptWrapper.DisableShipBackCamera(); m_detectorFirst.OnEntityEnter += DetectorActionFirst; m_detectorFirst.On(); MyScriptWrapper.OnDialogueFinished += MyScriptWrapper_OnDialogueFinished; base.Load(); }
private void SpeakCaptainOnOnMissionSuccess(MyMissionBase sender) { MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.NewMissionRecieved, MyHudConstants.FRIEND_FONT, 10000)); }