![]() |
|
#1
|
|||
|
|||
![]()
you misunderstand me..the AI i am talking about are player abandoned air craft not scripted AI
__________________
Gigabyte Z68 Intel 2500K (@4.3 ghz)212 CM Cooler 8GB Ram EVGA 660SC (super clocked) 2GB Vram CORSAIR CMPSU-750TX 750W 64 GB SSD SATA II HD WIN7 UL 64BIT |
#2
|
|||
|
|||
![]()
Sample use of triggers to load a new mission into current one.
Quote:
It does not work on static objects completely as intended but works for aircraft I think. File attached |
#3
|
|||
|
|||
![]()
More experiments with scripting. New version of Battle of France mission here http://forum.1cpublishing.eu/showpos...1&postcount=12
|
#4
|
|||
|
|||
![]()
bottom of that script says timeout 1 which is one sec. set that to 60 and your planes will despawn after 60 sec which is enough time for an aircraft to hit the ground when you bail and despwan
![]() |
#5
|
|||
|
|||
![]()
... my head hurts trying to understand this..
![]() Does anyone fancy writing a fuckwits guide to all this, err sorry i mean a dummies guide? It would be very much appreciated, i'd buy the 1st round or virtual beers! I'm keen to create MP missions but trying to gain the level of understanding needed from these forums and google translations is rather daunting. And i suspect waiting for an official manual would be foolish, considering the flight manual produced. But thanks for all the help provided here, it is appreciated.. just a bit confusing for a new mission builder. |
#6
|
|||
|
|||
![]() Quote:
This is a sample script to create a small 'campaign' containing a main mission and 3 sub-missions. Copy this script to Notepad and save it as sample.cs into the same folder your mission will be located, e.g. C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\ Scripts have to be saved with .cs extension and have the same name as the main mission. Create and edit your main mission in FMB. In this example the main mission name should be sample.mis because the script name is sample.cs. Make sure you have both sample.mis and sample.cs in the following directory (on the drive you have your Documents folder): C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\ Create and edit 3 missions you want to be loaded into the main mission with FMB. Put these 3 missions in the same directory, name them as mission1.mis, mission2.mis and mission3.mis. That's it. In case you saved your mission files into other directory than Multi/Dogfight/Dogfight/My_mis1/ , then edit 3 filepaths in this file. e.g. the line GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission1.mis" contains the path to the 1st sub-mission. * Change message text after GamePlay.gpHUDLogCenter commands to whatever you like (usually mission objectives and their location on the map). The text in this example is visible to both sides for simplicity. You may wish to download and use Microsoft Visual Studio 2010 Express to open and edit .cs files. It is free and makes .cs files easy to read and understand. Download link http://www.microsoft.com/express/Dow...2010-Visual-CS All text after // marks are comments describing what the script does. You may play your mission in MP or as a SP mission if you create a passworded server. I hope to put up some missions using this script to Repka server soon. Code:
/**** * Brief startup guide to scripting. * This is a sample script to create a small 'campaign' containing a main mission and 3 sub-missions. * * Copy this script to Notepad and save it as sample.cs into the same folder your mission will be located, e.g. * C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\ * Scripts have to be saved with .cs extension and have the same name as the main mission. * Create and edit your main mission in FMB. In this example the main mission name should be sample.mis because the script name is sample.cs. * Make sure you have both sample.mis and sample.cs in the following directory (on the drive you have your Documents folder): * C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\ * Create and edit 3 missions you want to be loaded into the main mission with FMB. * Put these 3 missions in the same directory, name them as mission1.mis, mission2.mis and mission3.mis. * That's it. * * In case you saved your mission files into other directory than Multi/Dogfight/Dogfight/My_mis1/ , than edit 3 filepaths in the script file. * e.g. the line GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission1.mis" contains the path to the 1st sub-mission. * * * Change message text after GamePlay.gpHUDLogCenter commands to whatever you like (usually mission objectives and their location on the map). * The text in this example is visible to both sides for simplicity. * * You may wish to download and use Microsoft Visual Studio 2010 Express to open and edit .cs files. It is free and makes .cs files easy to read and understand. * Download link http://www.microsoft.com/express/Downloads/#2010-Visual-CS * * All text after // marks are comments describing what the script does. * You may play your mission in MP or as a SP mission if you create a passworded server. * Have fun! and S! from 3GIAP * * Feel free to delete all the comments above and including this line from this file. ****/ using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { public override void OnTickGame() { // loads the 1st sub-mission in 10 min and repeates it every 60 min. if (Time.tickCounter() % 108000 == 18000) // 108000 = 60 min repeat. 18000 = 10 min delay. // pls. note!!! the 1st figure above must be always larger than 2nd! { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission1.mis"); // prints message on screen after mission load GamePlay.gpHUDLogCenter("Hello, world! Mission1.mis loaded!"); // prints message on screen in 10 minutes / 600 seconds double initTime = 0.0; Timeout(initTime += 600, () => { GamePlay.gpHUDLogCenter("10 minutes into the 1st mission! Wow! It works!!!"); }); // prints message on screen in 5 minutes / 300 seconds Timeout(initTime += 300, () => { GamePlay.gpHUDLogCenter("Wholy s.. it works!!!"); }); } // loads the 2nd sub-mission, etc. the same way if (Time.tickCounter() % 108000 == 54000) // 108000 = 60 min repeat, 54000 = 30 min delay. { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission2.mis"); GamePlay.gpHUDLogCenter("Mission2.mis loaded!"); double initTime = 0.0; Timeout(initTime += 600, () => { GamePlay.gpHUDLogCenter("Mission2 10 min message!"); }); Timeout(initTime += 300, () => { GamePlay.gpHUDLogCenter("Mission2 15 min message!"); }); } // loads the 3rd sub-mission if (Time.tickCounter() % 108000 == 90000) // 60 min repeat, 50 min delay { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission3.mis"); GamePlay.gpHUDLogCenter("Mission3.mis loaded!"); double initTime = 0.0; Timeout(initTime += 600, () => { GamePlay.gpHUDLogCenter("Mission3 10 min message!"); }); Timeout(initTime += 300, () => { GamePlay.gpHUDLogCenter("Now it really works! You are a genius! Have fun!"); }); } } } Last edited by Ataros; 10-14-2011 at 08:03 AM. |
#7
|
|||
|
|||
![]()
Hi all, and sorry Klem, I can´t help you...
![]() I started now with my attempt to get familar with scripting and C#... ![]() ![]() I read through this thread a several times and copied some samples of the outlined scripts. The problem at hand now, is that I want to include a script in the submissions, which will be loaded into a main, basic-map. This submission script shall contain Sec 1- the trigger messages, Sec 2-the instruction messages for new players and players which just took off (WIP:Message shall only be shown, if trigger is not activated yet) Sec 3- a count of trigger states, so very time a victory-trigger is set to true a counter raises the number for the side, which activated the trigger Sec 4- clean up procedure at a certain time from begin of submission, removing all AI loaded into the basic map with the submission Following questions appeared now at this stage: (A) I already found out how to theoretically get the trigger messages running, still have to get it right, how to show the message only if the otherside (red/blue) has not activated their trigger yet. Is thiss possible by something like this? if (<Trigger Red won> == active || <Trigger Blue won> == acitve) <message red won> (B) How do I get rid off of all the AI loaded on the basic map, when the submission has done its job? I wanted to try following script sample to remove the AI after an hour into the submission: //////////////// Section 4: get rid off all AI loaded with submission //mod-start by SNAFU -> ZIEL: nach 1h AI-Flieger entfernen public override void OnTickGame() { double initTime; if (Time.tickCounter() % 108000 == 10799) // 108000=1h { //mod-end by SNAFU foreach (int army in GamePlay.gpArmies()) { foreach (AiAirGroup group in GamePlay.gpAirGroups(army)) { if (ActorName.MissionNumber(group.Name()).Equals(Miss ionNumber)) /// <- delete line to kill all { AiActor[] members = group.GetItems(); for (int i = members.Length - 1; i > -1; i--) { (members[i] as AiAircraft).Destroy(); } } } foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army)) { if (ActorName.MissionNumber(group.Name()).Equals(Miss ionNumber)) /// <- delete line to kill all { AiActor[] members = group.GetItems(); for (int i = members.Length - 1; i > -1; i--) { (members[i] as AiGroundActor).Destroy(); } } } } } (C) I now loaded a briefing message into the basic map, so every player joining and taking off, will be briefed into the actual ongoing submission. The basic map listens to all events introduced with the submissions, ok. But... If the the submission is over, how does the main script notice the that the submissions states, messages (f.e. the briefing messages) are not valid anymore? Ist that the "puplic override" I see everywhere? Here the template for the submission script and sorry for all the silly questions: ![]() Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission ////////////////////////////////////////////////////////////////////////////////////// ///////////Section 1: Trigger messages ///to copy into /////////////////////////////////////////////////Section 3: Briefing for new players ///WIP if (<Trigger missions success red/blue> = false) /////WIP: Trigger Condition for Mission red/blue != true { public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); AiAircraft aircraft = actor as AiAircraft; if (aircraft != null) switch (aircraft.Army()) { case 1: if (aircraft.Type() == AircraftType.Bomber) /////////////Nachricht für neue Spieler { GamePlay.gpHUDLogCenter(new Player[] {player},"Red Bomber Task"); } /////////roter Bomber else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Red Fighter Task"); } ///////////roter Jäger break; case 2: if (aircraft.Type() == AircraftType.Bomber) { GamePlay.gpHUDLogCenter(new Player[] { player }, "Blue Bomber Task"); } ////////////blauer Bomber else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Blue Fighter Task"); } //////////// blauer Jäger break; } } public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftTookOff(missionNumber, shortName, aircraft); if (GamePlay.gpPlayer().Place() != aircraft) return; switch (aircraft.Army()) { case 1: if (aircraft.Type() == AircraftType.Bomber) /////////////Nachricht für neue Spieler { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Bomber Task"); } /////////roter Bomber else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Fighter Task"); } ///////////roter Jäger break; case 2: if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber)) { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Blue Bomber Task"); } ////////////blauer Bomber else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Bomber Task"); } //////////// blauer Jäger break; } } ///WIP } ////////////////////////////////////////////////////////////////////////////////////// //////////////// Section 3: Trigger count for overall win condition // still no idea ////////////////////////////////////////////////////////////////////////////////////// //////////////// Section 4: get rid off all AI loaded with submission //mod-start by SNAFU -> ZIEL: nach 1h AI-Flieger entfernen public override void OnTickGame() { double initTime; if (Time.tickCounter() % 108000 == 10799) // 108000=1h { //mod-end by SNAFU foreach (int army in GamePlay.gpArmies()) { foreach (AiAirGroup group in GamePlay.gpAirGroups(army)) { if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) /// <- delete line to kill all { AiActor[] members = group.GetItems(); for (int i = members.Length - 1; i > -1; i--) { (members[i] as AiAircraft).Destroy(); } } } foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army)) { if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) /// <- delete line to kill all { AiActor[] members = group.GetItems(); for (int i = members.Length - 1; i > -1; i--) { (members[i] as AiGroundActor).Destroy(); } } } } } Last edited by SNAFU; 06-21-2011 at 02:45 PM. |
#8
|
|||
|
|||
![]()
Script to destroy actors in a mission (e.g. before loading new one to server).
This kills mission (or submission) own actors. To kill all actors 'living' on a server (e.g. loaded by other missions) remove the lines put in blue color. Code:
foreach (int army in GamePlay.gpArmies()) { foreach (AiAirGroup group in GamePlay.gpAirGroups(army)) { if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) { AiActor[] members = group.GetItems(); for (int i = members.Length - 1; i > -1; i--) { (members[i] as AiAircraft).Destroy(); } } } foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army)) { if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) { AiActor[] members = group.GetItems(); for (int i = members.Length - 1; i > -1; i--) { (members[i] as AiGroundActor).Destroy(); } } } } May need some testing and fine-tuning. Last edited by Ataros; 05-03-2011 at 08:03 AM. |
#9
|
|||
|
|||
![]()
~S
I would appear Beta 4 breaks all of these kill actor scripts... well it does 4 me |
#10
|
|||
|
|||
![]()
Phew its not just our server then, I rolled back to Beta 1 and the scripts work again.
|
![]() |
|
|