コード例 #1
0
        public override void Load()
        {
            base.Load();

            MyScriptWrapper.AlarmLaunched += MyScriptWrapper_AlarmLaunched;

            // Turn off sunwind, meteorwind and icestorm
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.SunWind, false);
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.MeteorWind, false);
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.IceStorm, false);

            // Add Fourth Reich FalseId to inventory if player already haven't got one
            MyScriptWrapper.AddFalseIdToPlayersInventory(MyMwcObjectBuilder_FactionEnum.FourthReich);

            // Add Radar Jammer to player inventory
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetPlayerInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_Tool, (int)MyMwcObjectBuilder_SmallShip_Tool_TypesEnum.RADAR_JAMMER, 1f);

            // Add Hacking Tool to player inventory
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_2, 1f, true);
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_3, 1f, true);

            // Set musicmood right from script start
            MyAudio.ApplyTransition(MyMusicTransitionEnum.TensionBeforeAnAction);

            m_Slave = (MySmallShipBot)MyScriptWrapper.TryGetEntity(328);
            MySession.PlayerFriends.Add(m_Slave);
            m_Slave.Follow(MySession.PlayerShip);
            m_Slave.SetName("Slave");
        }
コード例 #2
0
 private void M11TalkToReefOnOnMissionLoaded(MyMissionBase sender)
 {
     m_marcus.Follow(MySession.PlayerShip);
     m_ravenguyBot.Follow(MySession.PlayerShip);
     m_ravengirlBot.Follow(MySession.PlayerShip);
     MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Victory, 3, "KA02");
     m_reef.LookTarget = MySession.PlayerShip;
 }
コード例 #3
0
        private void UseCatacombsOnOnMissionSuccess(MyMissionBase sender)
        {
            var sir = (MySmallShipBot)MyScriptWrapper.GetEntity((uint)EntityID.BotTemplar);

            sir.SetWaypointPath("ChurchPatrol");
            sir.PatrolMode = MyPatrolMode.ONE_WAY;
            sir.Patrol();

            m_marcus.Follow(MySession.PlayerShip);
            m_ravengirlBot.Follow(MySession.PlayerShip);
            m_ravenguyBot.Follow(MySession.PlayerShip);
        }
コード例 #4
0
        private void SetBotPath(MySmallShipBot bot)
        {
            bot.WaypointPath = MyWayPointGraph.GetPath(m_wayPointPath);
            bot.PatrolMode   = PatrolMode;

            //check if any leader present
            Bot leader = m_botShips.Find(s => (s.Ship != null && s.Ship.Leader == null));

            if (leader != null)
            {
                bot.Follow(leader.Ship);
            }
            else if (bot.WaypointPath != null)
            {
                bot.Patrol();
            }

            if (Leader != null)
            {
                bot.Follow(Leader);
            }
        }
コード例 #5
0
        private void OnSuccesfindMarcusSmallShip(MyMissionBase sender)
        {
            if (m_marcus != null)
            {
                MyScriptWrapper.HideEntity(m_marcusPlacHolder);

                m_marcus.Enabled  = true;
                m_marcus.Visible  = true;
                m_marcus.ActiveAI = true;
                m_marcus.Follow(MySession.PlayerShip);

                var position = m_marcusPlacHolder.GetPosition();

                m_marcus.WorldMatrix = m_marcusPlacHolder.WorldMatrix;
            }

            MyScriptWrapper.Highlight((uint)EntityID.MarcusPlaceholder, false, this);
        }
コード例 #6
0
        public override void Load()
        {
            // HACK: ...adding dead entities (dead by solar wind or anything)
            // These entities probably died after Reichstag A mission was successful, so they were not indestructible, solar wind came and eat them
            var colonel  = MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_WaltherStauffenberg);
            var valkyrie = MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_Disabled_03);

            if (colonel == null || valkyrie == null)
            {
                var sector = MyLocalCache.LoadSector(new MyMwcSectorIdentifier(MyMwcSectorTypeEnum.STORY, null, this.GetCurrentSector(), String.Empty));
                var bots   = sector.SectorObjects.OfType <MyMwcObjectBuilder_SmallShip_Bot>();
                foreach (var bot in bots)
                {
                    if (colonel == null && bot.EntityId == (uint)EntityID.Bot_WaltherStauffenberg ||
                        valkyrie == null && bot.EntityId == (uint)EntityID.Bot_Disabled_03)
                    {
                        MyEntities.CreateFromObjectBuilderAndAdd(bot.DisplayName, bot, bot.PositionAndOrientation.GetMatrix());
                    }
                }
            }

            base.Load();

            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.FourthReich, MyMwcObjectBuilder_FactionEnum.Rainiers, MyFactions.RELATION_BEST);

            MySmallShipBot FoRrepresentative = (MySmallShipBot)MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_WaltherStauffenberg);

            MyScriptWrapper.ChangeFaction(FoRrepresentative, MyMwcObjectBuilder_FactionEnum.FourthReich);
            FoRrepresentative.IsDestructible = false;
            MySmallShipBot Hans = (MySmallShipBot)MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_Hans);
            MySmallShipBot Karl = (MySmallShipBot)MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_Karl);

            Hans.IsDestructible = false;
            Karl.IsDestructible = false;
            Hans.Follow(FoRrepresentative);
            Karl.Follow(FoRrepresentative);

            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.Bot_Disabled_01), true, false);
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.Bot_Disabled_02), true, false);
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.Bot_Disabled_03), true, false);
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.Bot_Disabled_04), true, false);
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.Bot_Disabled_05), true, false);
        }
コード例 #7
0
        public override void Load() // Code in that block will be called on the load of the sector
        {
            base.Load();

            MySmallShipBot FoRrepresentative = (MySmallShipBot)MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_WaltherStauffenberg);

            MyScriptWrapper.ChangeFaction(FoRrepresentative, MyMwcObjectBuilder_FactionEnum.FourthReich);
            FoRrepresentative.IsDestructible = false;
            MySmallShipBot Hans = (MySmallShipBot)MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_Hans);
            MySmallShipBot Karl = (MySmallShipBot)MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_Karl);

            Hans.IsDestructible = false;
            Karl.IsDestructible = false;
            Hans.Follow(FoRrepresentative);
            Karl.Follow(FoRrepresentative);

            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.CalmAtmosphere); // Sets music group to be played in the sector - no matter if the mission is running or not

            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.FourthReich, MyMwcObjectBuilder_FactionEnum.Rainiers, MyFactions.RELATION_NEUTRAL);
        }
コード例 #8
0
        public override void Load()
        {
            if (!IsMainSector)
            {
                return;
            }

            //add biochem ammo
            //MyScriptWrapper.GetPlayerInventory().AddInventoryItem(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_BioChem, 100f, true);
            //MyScriptWrapper.GetPlayerInventory().AddInventoryItem(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_BioChem, 100, true);
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetPlayerInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_BioChem, 100);
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_2, 1f, true);

            MyScriptWrapper.DeactivateSpawnPoint((uint)EntityID.SpawnpointAtWeHaveCompany);

            /*
             * MyMwcObjectBuilder_SmallShip_Player originalBuilder = MySession.PlayerShip.GetObjectBuilder(true) as MyMwcObjectBuilder_SmallShip_Player;
             * originalBuilder.ShipType = MyMwcObjectBuilder_SmallShip_TypesEnum.GETTYSBURG;
             * MySession.PlayerShip.Close();
             * MyEntities.CreateFromObjectBuilderAndAdd(null, originalBuilder, originalBuilder.PositionAndOrientation.GetMatrix());
             */
            m_panelsLeft = GetPanelsLeft((uint)EntityID.PanelsPrefabContainer);
            //MyAudio.ApplyTransition(MyMusicTransitionEnum.HeavyFight);

            MyScriptWrapper.SetPlayerFaction(MyMwcObjectBuilder_FactionEnum.Rainiers);
            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Rainiers, MyMwcObjectBuilder_FactionEnum.FourthReich, MyFactions.RELATION_BEST);
            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Rainiers, MyMwcObjectBuilder_FactionEnum.Euroamerican, MyFactions.RELATION_WORST);
            MyScriptWrapper.FixBotNames();

            MyEntityDetector startDetector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.StartDetector));

            startDetector.OnEntityEnter += StartDummyDetector;
            startDetector.On();

            MyEntityDetector Security01Detector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.SecurityDetector));

            Security01Detector.OnEntityEnter += StartSecurity01Detector;
            Security01Detector.On();

            MyEntityDetector Security02Detector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.SecurityDetector2));

            Security02Detector.OnEntityEnter += StartSecurity02Detector;
            Security02Detector.On();

            MyScriptWrapper.EntityClosing += EntityClosing;

            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.DestroyPanelsEnable1), false);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.CargoExitDoor), false);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.Doors1), false);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.DestroyPanelsEnable2), false);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.Doors3), false);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.Doors4), false);

            MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointSpawned;

            MyScriptWrapper.OnSentenceStarted += MyScriptWrapper_OnSentenceStarted;



            m_marcus = MyScriptWrapper.GetEntity("Marcus") as MySmallShipBot;

            //disable marcus
            if (m_marcus != null)
            {
                //MyScriptWrapper.DisableShip(m_ma);
                m_marcus.Enabled  = false;
                m_marcus.Visible  = false;
                m_marcus.ActiveAI = false;
                MyScriptWrapper.StopFollow(m_marcus);
                m_marcusInventory.Clear();
                m_marcusInventory.AddRange(m_marcus.Inventory.GetInventoryItems());
                m_marcus.Inventory.ClearInventoryItems();
            }

            //disable ships for marcus
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.MarcusFakeShip1));
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.MarcusFakeShip2));
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.MarcusPlaceholder));
            MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity((uint)EntityID.MarcusFakeShip3));


            m_marcusPlacHolder = MyScriptWrapper.GetEntity((uint)EntityID.MarcusPlaceholder);

            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((int)EntityID.SecurityHub), false);

            InitDetector((uint)75094, StartEACDetector);

            //add Raven Girl and Raven Guy
            //We need to replace old vitolino+tanja, because they have deutch smallships from doppelburg

            m_ravenguyBot = MyScriptWrapper.GetEntity("RavenGuy") as MySmallShipBot;
            m_ravenguyBot.SetName("Disabled_vitolino");
            m_ravenguyBot.MarkForClose();

            m_ravenguyBot = MyScriptWrapper.InsertFriend(MyActorEnum.VALENTIN);
            m_ravenguyBot.LeaderLostEnabled = true;
            m_ravenguyBot.Follow(MySession.PlayerShip);
            Matrix ravenguyPosition = Matrix.CreateWorld(MySession.PlayerShip.GetPosition() - Vector3.Right * 15, MySession.PlayerShip.WorldMatrix.Forward, MySession.PlayerShip.WorldMatrix.Up);

            m_ravenguyBot.SetWorldMatrix(ravenguyPosition);

            m_ravengirlBot = MyScriptWrapper.GetEntity("RavenGirl") as MySmallShipBot;
            m_ravengirlBot.SetName("Disabled_tanja");
            m_ravengirlBot.MarkForClose();

            m_ravengirlBot = MyScriptWrapper.InsertFriend(MyActorEnum.TARJA);
            m_ravengirlBot.LeaderLostEnabled = true;
            m_ravenguyBot.Follow(MySession.PlayerShip);
            Matrix ravengirlPosition = Matrix.CreateWorld(MySession.PlayerShip.GetPosition() + Vector3.Right * 15, MySession.PlayerShip.WorldMatrix.Forward, MySession.PlayerShip.WorldMatrix.Up);

            m_ravengirlBot.SetWorldMatrix(ravengirlPosition);

            base.Load();
        }