Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2011, 02:37 AM
Sokol1's Avatar
Sokol1 Sokol1 is offline
Approved Member
 
Join Date: Oct 2007
Posts: 727
Default

Quote:
Originally Posted by Lookaloft View Post
Unfortunately I can’t get the Naryv script to work. I copied the script in Notepad and saved it under ANSI as an cs mission.
I copy the script direct in FMB window, so when save the mission the script is save too.



After a ''perfect'' wheels up landing they send me winch, fuel, ammo and bombs (spend previous load before landing)!
Ambulance is not need.

Sokol1
Reply With Quote
  #2  
Old 01-17-2012, 06:22 PM
AKA_Scorp AKA_Scorp is offline
Approved Member
 
Join Date: Jan 2011
Posts: 31
Default

Quote:
One work-around for this I had a play with was to fake it by taking the existing player/position and then destroying/recreating the same type of aircraft, i.e. you get refueled and re-armed, plus could even put a delay on that too. I know it's not realistic, but a 5 minute re-arm/refuel custom script does appeal.
Probably seems like a dumb question but what is the command to spawn an aircraft as described above.

Thanks
Reply With Quote
  #3  
Old 01-18-2012, 07:40 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by AKA_Scorp View Post
Probably seems like a dumb question but what is the command to spawn an aircraft as described above.

Thanks
Load a ready submission which contains an aircraft or dynamical create a submission file with a script and then load it. Check out how naryv creates tanks in his examples attached in a sticky thread above.
Reply With Quote
  #4  
Old 01-18-2012, 06:07 PM
AKA_Scorp AKA_Scorp is offline
Approved Member
 
Join Date: Jan 2011
Posts: 31
Default

Quote:
Originally Posted by Ataros View Post
Load a ready submission which contains an aircraft or dynamical create a submission file with a script and then load it. Check out how naryv creates tanks in his examples attached in a sticky thread above.
OK, I can see the principle of the section file and how to create a sub mission from script. I'm sure I could put in static objects, chiefs and AI flights but how do I force a human pilot into an aircraft at a specific coordinate?

Thanks
Reply With Quote
  #5  
Old 01-18-2012, 06:12 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Player Class: PlaceEnter(Actor, Placeindex)
example:
player.PlaceEnter(Aircraft, 0);
Reply With Quote
  #6  
Old 01-18-2012, 06:41 PM
AKA_Scorp AKA_Scorp is offline
Approved Member
 
Join Date: Jan 2011
Posts: 31
Default

Quote:
Originally Posted by FG28_Kodiak View Post
Player Class: PlaceEnter(Actor, Placeindex)
example:
player.PlaceEnter(Aircraft, 0);
Thanks,
Reply With Quote
  #7  
Old 05-22-2016, 07:01 AM
flug32 flug32 is offline
Approved Member
 
Join Date: Feb 2016
Posts: 4
Thumbs up New/updated service vehicle, ambulance, fire truck mission plug-in

Thanks to everyone who posted about the ambulance script on this thread. I've worked on an updated version of it that is designed to work in multiuser servers (though it should work offline just as well).

- Vehicles spawn in along with you & then drive off (ie, your service vehicles just finished with getting your a/c ready, then they drive off)

- When you land (full stop landing--putting chocks in will make sure) the fuel & repair trucks will come trundling up pretty soon.

- Whenever you crash, even just borking up a takeoff & damaging your propeller & undercarriage, you'll soon be visited by an ambulance and a fire truck. Even if you crash out in the middle of nowhere. Only exception would be in water--they if close to the shore the emergency vehicles will do their best & drive right up to the shore. (Rescue boats will hae to come in a future version I guess. Someone to pick you up when you parachute in could be a future improvement as well.)

- Vehicles mostly avoid you but if you hit them they WILL damage you. So you have to look sharp & avoid.

- Vehicles travel to & from Spawn Points (ie, "Birthplace" in the .mis files) preferentially. They always travel more or less directly between the target aircraft & an area immediately around the spawn point .This gives you general control over where the vehicles appear & where they travel to/park just by moving the spawn point at your airfield in FMB.

- I couldn't get the "reuse old vehicles at the same airport" code to work at all, so this simply spawns in new vehicles every time & then spawns them out after they are no longer needed. It seems to work fine so far.

-You're welcome to use as is or adapt for use in your own scripts, missions, servers, etc.

- It's designed to be a painless plug-in to any existing mission. It's a self-standing mission, so you just put it in your mission folder & then load it as a sub-mission during OnBattleStarted().

ZIP file with script & mission files, sample code, instructions all in one

FILE: auto-generate-vehicles.cs

<see separate message>

The mission file is just a stub and you don't need anything in it except the headers (and maybe not even those--I haven't really experimented). It just allows your main .cs file to load the auto-vehicle-generate.cs neatly as a sub-mission. However I like to keep a minimal .mis file in place with a map, weather, etc. because then you can edit & run it easily in FMB. That is helpful for testing. Here is my sample .mis file:

FILE: auto-generate-vehicles.mis

Code:
[PARTS]
  core.100
  bob.100
[MAIN]
  MAP Land$Online_Volcanic_Island
  BattleArea 6000 1700 21000 38000 1000
  TIME 12
  Army 1 gb
  Army 2 de
  WeatherIndex 0
  CloudsHeight 1000
  BreezeActivity 0
  ThermalActivity 0
[GlobalWind_0]
  Power 0.000 0.000 0.000
  BottomBound 0.00
  TopBound 1500.00
  GustPower 5
  GustAngle 0
[splines]
[CustomChiefs]
[Stationary]
[Buildings]
[BuildingsLinks]
[Airdromes]
In the MAIN mission script file you have something like this:
FILE: main.cs
Code:
  public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        ReadInitialSubmissions(MISSION_ID + "-auto-generate-vehicles", 0, 0); 
        //etc . . . your code

     }
        
    }
Here is the ReadInitialSubmission script I use:

Code:
    public void ReadInitialSubmissions(string filenameID, int timespread=60, int wait=0)
    {

         string MISSION_ID = "M001";
         
         string USER_DOC_PATH = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);   // DO NOT CHANGE
         string CLOD_PATH = USER_DOC_PATH + @"/1C SoftClub/il-2 sturmovik cliffs of dover - MOD/";  // DO NOT CHANGE
         string FILE_PATH = @"missions/Multi/MyMissionFolder";   // mission install directory (CHANGE AS NEEDED - your sub-mission .mis and .cs files should be in this directory)

        List<string> InitSubMissions = GetFilenamesFromDirectory(CLOD_PATH + FILE_PATH, filenameID); // gets .mis files with with word filenameID in them
        
        DebugAndLog ("Debug: Loading " + InitSubMissions.Count + " missions to load. " + filenameID + " " + CLOD_PATH + FILE_PATH);
        foreach (string s in InitSubMissions)
        {
            //Distribute loading of initial sub-missions over the first timespread seconds
            //If you make each sub-mission small enough it will load without a noticeable stutter
            //If they are large & make a noticeable stutter, probably best to load them all very near the beginning of the mission
            //so that all the stutters happen at that point
            if ((timespread==0) && (wait==0)) {
                GamePlay.gpPostMissionLoad(s);
                DebugAndLog( s + " file Loaded");          
            } else { 
              Timeout(wait + random.Next(timespread), () => {
              
                   GamePlay.gpPostMissionLoad(s);
                
             });   
           }  
        }

    }
You need to be sure that event triggers are enabled--and enabled in the right place. Similar code is already in auto-vehicle-generate.cs but I think perhaps you also need it in your main mission cs file. (In any event, if you've been trying to use triggers and having trouble, not having this flag set correctly, or setting it to late in the startup process, might be your problem.)

Code:
//////////////////////////////////////////////////////////////////////////////////////////////////

    //Listen to events of every mission
    public override void Init(maddox.game.ABattle battle, int missionNumber)
    {
        base.Init(battle, missionNumber);
        MissionNumberListener = -1; //Listen to events of every mission
        //This is what allows you to catch all the OnTookOff, OnAircraftDamaged, and other similar events.  Vitally important to make this work!
        //If we load missions as sub-missions, as we often do, it is vital to have this in Init, not in "onbattlestarted" or some other place where it may never be detected or triggered if this sub-mission isn't loaded at the very start.
    }

 //////////////////////////////////////////////////////////////////////////////////////////////////
Last, you must have lines like the following in the [rts] section of both your conf.ini and confs.ini file.

I believe that conf.ini pertains to your regular Launcher.exe process and confs.ini applies if you are running "Launcher.exe -server" as a dedicated server. Note that you will need to exit Launcher.exe, then edit and save conf.ini & confs.ini, then re-start Launcher.exe. If you don't follow this process, your conf.ini and/or confs.ini will be overwritten when Launcher.exe exits.

Code:
[rts]
scriptAppDomain=0 
;avoids the dreaded serialization runtime error when running server or testing missions in FMB
;per http://forum.1cpublishing.eu/showthread.php?t=34797
Lastly, thanks to everyone who has been posting here and in other forums. The code above includes tons of techniques and snippets borrowed from here and there. All horrible hacks and terrible formatting are my own

Again: ZIP file with script & mission files, sample code, instructions all in one

Last edited by flug32; 05-22-2016 at 11:00 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.