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-24-2011, 12:16 AM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

To make step by step instructions even for basic C# operations/methods usable in CloD would be a full-time job for a small team of programmers

I'm not sure that you're getting it. The subtle counter-intelligence thing I mean

Cards on the table then.

We know that Kodiak can do all this stuff we need to find out about, if we're gentle and coaxing we might get a tutorial, just one person with knowledge and prepared to share can make a big difference

For example many of us have used 3D tutorials to learn 3D work from online tutorials it's our heritage - people in the communities helping others. We worked out how the RoF FMB worked and shared/pooled our knowledge...

http://riseofflight.com/forum/viewtopic.php?f=64&t=348

We don't need a team of professionals, we already have enough savvy people around to create tutorials - look at Vanderstok's RoF FMB-tutorial videos

http://riseofflight.com/forum/viewto...ers+vanderstok

Can everybody please concentrate and allow Kodiak to find out that he is needed and there is an international audience waiting to buy cold beers for him

It's not the C# that's the problem, that's simple because all the unknowns are known, we just read a book and Hello World arrange the parts. It's the not-knowing how most of the CoD FMB pieces fit together because we have no documentation. If CoD documentation is going to be RoF all over again then someone needs to ask the wise man for help while trying not to actually grovel

We're not wanting to make any conditions or to be too demanding, just chatting on a user forum where the Great Bear is prowling...

Do I make myself clear without belabouring it

if you understand C# basics than neither samples nor the manual would be needed, just some help and advice on particular issues which can be easily obtained on these forums

How can I detect that a damaged plane in an RTB-ing four-flight is inbound to the airfield to possibly make a crash landing?

Detect the plane passing some distance-radius from the runway let's focus on that

I'm taking you at your word as I know enough about C# to type in the solution. When you've found it and I quote easily

We don't know "It's what we don't know we don't know..." exactly what we need to know to master the CoD FMB but - don't ask, don't get. But on the other hand we must always be making concrete cases and asking for worked examples to make life easier for our tutors, focus.

Being Russian or German first-language is of course making distribution of information difficult for us all in the beginning, we must encourage our German and Russian friends to help English-localise posted German and Russian FMB tutorials. They're ahead of the game and why not

Ming
Reply With Quote
  #2  
Old 09-24-2011, 08:32 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by Mington View Post

How can I detect that a damaged plane in an RTB-ing four-flight is inbound to the airfield to possibly make a crash landing?

Detect the plane passing some distance-radius from the runway let's focus on that
Here is list of methods published here before which are quite self-explanatory (more methods were added in recent beta patch)

Code:
  protected AMission ()
 public virtual void Init (maddox.game.ABattle battle, int missionNumber)
 public virtual void Inited ()
 public virtual bool IsMissionListener (int missionNumber)
 public virtual void OnActorCreated (int missionNumber, string shortName, maddox.game.world.AiActor actor)
 public virtual void OnActorDamaged (int missionNumber, string shortName, maddox.game.world.AiActor actor, maddox.game.world.AiDamageInitiator initiator, part.NamedDamageTypes damageType)
 public virtual void OnActorDead (int missionNumber, string shortName, maddox.game.world.AiActor actor, System.Collections.Generic.List <DamagerScore> damages)
 public virtual void OnActorDestroyed (int missionNumber, string shortName, maddox.game.world.AiActor actor)
 public virtual void OnActorTaskCompleted (int missionNumber, string shortName, maddox.game.world.AiActor actor)
 public virtual void OnAiAirNewEnemy (maddox.game.world.AiAirEnemyElement element, int army)
 public virtual void OnAircraftCrashLanded (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
 public virtual void OnAircraftCutLimb (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft, maddox.game.world.AiDamageInitiator initiator, part.LimbNames limbName)
 public virtual void OnAircraftDamaged (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft, maddox.game.world.AiDamageInitiator initiator, part.NamedDamageTypes damageType)
 public virtual void OnAircraftKilled (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
 public virtual void OnAircraftLanded (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
 public virtual void OnAircraftLimbDamaged (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft, maddox.game.world.AiLimbDamage limbDamage)
 public virtual void OnAircraftTookOff (int missionNumber, string shortName, maddox.game.world.AiAircraft aircraft)
 public virtual void OnAutopilotOff (maddox.game.world.AiActor actor, int placeIndex)
 public virtual void OnAutopilotOn (maddox.game.world.AiActor actor, int placeIndex)
 public virtual void OnBattleInit ()
 public virtual void OnBattleStarted ()
 public virtual void OnBattleStoped ()
 public virtual void OnCarter (maddox.game.world.AiActor actor, int placeIndex)
 public virtual void OnMissionLoaded (int missionNumber)
 public virtual void OnPersonHealth (maddox.game.world.AiPerson person, maddox.game.world.AiDamageInitiator initiator, float deltaHealth)
 public virtual void OnPersonMoved (maddox.game.world.AiPerson person, maddox.game.world.AiActor fromCart, int fromPlaceIndex)
 public virtual void OnPersonParachuteFailed (maddox.game.world.AiPerson person)
 public virtual void OnPersonParachuteLanded (maddox.game.world.AiPerson person)
 public virtual void OnPlaceEnter (maddox.game.Player player, maddox.game.world.AiActor actor, int placeIndex)
 public virtual void OnPlaceLeave (maddox.game.Player player, maddox.game.world.AiActor actor, int placeIndex)
 public virtual void OnPlayerArmy (maddox.game.Player player, int army)
 public virtual void OnPlayerConnected (maddox.game.Player player)
 public virtual void OnPlayerDisconnected (maddox.game.Player player, string diagnostic)
 public virtual void OnSingleBattleSuccess (bool success)
 public virtual void OnTickGame ()
 public virtual void OnTickReal ()
 public virtual void OnTrigger (int missionNumber, string shortName, bool active)
 public virtual void Timeout (double sec, maddox.game.DoTimeout doTimeout)

 public maddox.game.ABattle Battle {get;}
 public maddox.game.IGamePlay GamePlay {get;}
 public int MissionNumber {get;}
 public int MissionNumberListener {set; get;}
 public maddox.game.world.ITime Time {get;}
Not being a C# expert but just having read 80% of samples posted here I guess you can use OnAircraftDamaged and OnAircraftLimbDamaged and OnAircraftCutLimb to start calculating distance from the damaged aircraft to the closest airfield. Then you can generate a new landing waypoint for the damaged group at this airfield. There is a "distance" function used in naryv examples and in vetochka campaign. Waypoint generation is also used in naryv examples. When the distance is appropriate you let an ambulance to start its way to a runway.

Another way is to use onTrigger method with really big trigger radius around an airfield and check what aircraft parts are damaged. There was a sample script posted in the main section that prints out damaged parts to a chat window. Therefore I guess it is possible to do this.

The 3rd alternative could be to combine both of the above ways and flag a damaged group OnAircraftDamaged and then onTrigger check if the incoming group is flagged as damaged. Again I do not know C# and can be wrong. It is better to start a new thread with these particular questions where real experts will offer their solutions.

hc_wolf combined several naryv examples and others' scripts into one mission. You can have a look at how he did this and do the same if you know C#. If no one can answer questions on this forums you can ask naryv directly as adonys did in this thread http://www.sukhoi.ru/forum/showthrea...=1#post1647624
Sometimes naryv does not answer if the functionality requested is not ready yet or does not work properly or is changing at the moment. All script methods are WIP I think ATM.

We will not see the manual till engine functionality and script methods are 90% finalized imho because there is no point to spend time on a manual that will not be valid in 2 months. I expect it to come with Battle for Moscow at the earliest. But again if you know C# you can find all necessary information on this forums in naryv, adonys, Kodiak, Wolf, TheEnlightenedFlorist, vetochka, stillborn, etc. examples.

Scripting discussion was started 5 months ago in this thread (Yes, I know it is hard for the first 6-8 weeks till you learn some basics ) http://forum.1cpublishing.eu/showthread.php?t=21518
Many of my noob's questions were answered there by С# programmers. Again this forum section has more then enough information to start programming for CloD if you know C# basics at least. Guys and a lady mentioned above have proved it many times already. This forum section is only 9 pages long not too much to look though to get all the information needed to be able do the same imho.

ps. Of cause I would be more than happy if Kodiak or other C# programmers agree to publish some tutorials but for me it is not clear if the tutorials should be about C# basics or about CloD methods and functions.

Last edited by Ataros; 09-24-2011 at 09:15 AM.
Reply With Quote
  #3  
Old 09-24-2011, 11:42 AM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Lovely to see things looking up

How to construct an AirfieldEmergency script from first principles while explaining the steps, that's what I'd like to see. A concrete example with commentary that's fairly simple (if the detecting of the damaged plane crossing the AlarmRadius can be done)

There's almost 800 references to Maddox functions, classes, methods and wotnot so I'm imagining that it's on

There's the introductory part to a script, where databases of functions, subroutines (BASIC/Visual Basic) we will need access to in the running script, these might be-

using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;

The script then begins and it's at this point that we pupils need statements commented please. We can figure out what each line of code means but it's like examining atoms without knowing about the Table of Elements. We can see that they're all different and they all must mean something, there must be some rhyme to it, we are not idiots

'We need this line to see if any planes are already in the mission' (the mission designer created an unknown number of planes)

'We need this line to step through each plane to see if it is damaged' (all planes in all running missions can be checked)

'This line instantiates/spawns a plane/vehicle at this XYZ position' (if the position is clear)

This scripter's commentary gives us a chance to ask the scriptwriter a sensible question... it's very difficult to ask sensible questions without a handle to hang the question on. For example how can you tell if a possible spawning position is clear of obstructions. But that's another story probably

Ming
Reply With Quote
  #4  
Old 09-24-2011, 12:07 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Wow thanks very much for your collection Ataros!

It is better to start a new thread for each new module you need

Wiil do, thanks

they just looked [FMB stuff] up

Kodiak works/worked for Maddox perhaps - this is a compliment btw. He/she definitely knows his stuff. Let's face it somebody has to

onTrigger method with really big trigger radius around an airfield

A trigger radius hmm - thanks (I'll see if I can trigger a message 'We see your plane incoming, it looks damaged...' to 'Crossed the airfield EmergencyAlertRadius')

Thinking out loud then- two airfields say Croydon and Biggin Hill and my single plane taking off at one airfield. Testing the other airfield's EmergencyAlert (procedure) - with a simple onscreen message if my plane trips the second airfield's trigger. Baby steps.

Adding the trigger in a script rather than via the FMB, to make it universal. Does the FMB write trigger code into the dot cs I wonder. I know that airfields have one radius and then another radius

Ming
Reply With Quote
  #5  
Old 09-24-2011, 12:24 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by Mington View Post

Adding the trigger in a script rather than via the FMB, to make it universal. Does the FMB write trigger code into the dot cs I wonder. I know that airfields have one radius and then another radius
Trigger has its own radius. It is set in FMB and is stored in a mission file, not in script file.

According to the devs to make FMB triggers work together with any script you can add this code to script. Action and trigger must have the same name in this case.
Code:
 
public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);        
        AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
        if (action != null)
            action.Do();
    }
There are other more advanced and complex possibilities. Check out the _Triggers and actions folder in my archive or search forums for trigger script.

ps. BTW are you one of simhq admins by chance? I have trouble registering at simhq forums somehow. Same nickname.

Last edited by Ataros; 09-24-2011 at 12:31 PM.
Reply With Quote
  #6  
Old 09-25-2011, 11:39 AM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Very nice thanks Ataros!

Trigger has its own radius. It is set in FMB and is stored in a mission file, not in script file

I am trying to think universally, where scripts are independent of missions, so setting the radius in the FMB (while working perfectly yes) is not what I'm after

An airfield built by construction engineers (looking forward to D-Day) would not have a radius but it would be an Airfield object and a script could (hopefully) read and return the AirfieldEmergency distance. That could be a constant couple of miles perhaps and would apply to all airfields, permanent or temporary. We often create small airfields fairly close together for multiplayer dogfights - created in Il-2 I mean

Thanks for that info mate, no I'm not an admin over there but I will advise admin Dart that you're having problems and get back to you

Ming
Reply With Quote
  #7  
Old 09-25-2011, 08:51 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

In this example naryv creates a mission file by script. http://forum.1cpublishing.eu/showthread.php?t=23493

The file is called triggersFile. Actually it is a "section" file, i.e. a segment of a mission file.
Code:
    public ISectionFile triggersFile
Then script writes triggers into this file at the locations of frontline markers placed in the original mission manually.

Code:
                    keyTr = "changeArmy" + i.ToString()+"_1";                                // попутно на маркере делаем два триггера - для каждой стороны  
                    valueTr = " TPassThrough 3 1 " + strs[0] + " " + strs[1] + " 500";       // "TPassThrough 3" - триггер сработает при заезде в него наземки, "1" красной, strs[0] + " " + strs[1] координаты, "500"- радиус триггера
                    triggersFile.add(sectionTr, keyTr, valueTr);                             // сохраняем триггер в файле триггерной миссии
                    keyTr = "changeArmy" + i.ToString() + "_2";                              // то же самое для синей стороны
                    valueTr = " TPassThrough 3 2 " + strs[0] + " " + strs[1] + " 500";       
                    triggersFile.add(sectionTr, keyTr, valueTr);                             // сохраняем триггер в файле триггерной миссии
500 - is radius of the trigger
Reply With Quote
  #8  
Old 09-26-2011, 12:00 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Thanks Ataros, hugely interesting

The clue that 500 is the radius no wait it's a radius- is that an airfield radius I wonder?

There are two radii for each airfield

This is a command to assemble a string, can you decode the string please? Something like-

TPassThrough

Ahah pass through, passes through, crosses a radius...

Decoding, building a string-

TPassThrough 3 1

strs[0] (red or blue maybe, 'red' from Babelfish)

strs[1] appears to be a 'coordinate' from Babelfish

-it gets quite complicated eg-

double y; double.TryParse( strs[1], out y);

500

Maybe the whole assembled string is a coordinate somewhere on the map, with a radius around the coordinate of 500m

Yes that sounds reasonable, if we can now work out a test value for the cryptic strs[1]

valueTr = " TPassThrough 3 1 " + strs[0] + " " + strs[1] + " 500";

Maybe the TPassThrough trigger is documented somewhere, I'll see what I can find, the mysterious (without C# string-operation knowledge) coordinate bit is interesting

'TPassThrough: gets active' - does this mean that some Boolean variable is set to True or False? How to link to the emergency ambulance method I wonder, If NoBellsAreRinging CarryOn = True

Working left for inspection

Ming

Quote:
TPassThrough: gets active after a GroundGroup or Airgroup or Player entering the Area
http://forum.1cpublishing.eu/showthr...413#post339413
Reply With Quote
  #9  
Old 09-26-2011, 01:54 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

500 is trigger radius, not airfield.

TPassThrough 3 - is type of trigger, 3 is for ground units pass through.

1 or 2 is army (red/blue)

For airgroup passthrough the type of trigger will be different iirc. If you place various triggers in FMB and then save and open the mission file in notepad you will see how different triggers are recorded into a mission file: name of trigger type of trigger side coordinates radius. E.g.
Code:
[Trigger]
  110_down TGroupDestroyed BoB_LW_LG2_I.01 49
  bauf_down TGroupDestroyed BoB_RAF_F_FatCat_Early.01 46
  blu_bomb1 TPassThrough 1 BoB_RAF_B_218Sqn.07 275948 207553 2800
  bauf_up TPassThrough 3 1 271200 153942 300
  110_up TPassThrough 3 1 269976 153045 300
  red_bomb1 TPassThrough 3 1 270836 152088 300

strs[0] + " " + strs[1] - coordinates of the frontline marker parsed from the main mission file earlier.

Quote:
Originally Posted by Ataros View Post
Then script writes triggers into this file at the locations of frontline markers placed in the original mission manually.
Then in onTrigger method you check if the trigger is active, e.g.
Code:
    public override void OnTrigger(int missionNumber, string shortName, bool active) 
    {
       base.OnTrigger(missionNumber, shortName, active); 

          if ("your_trigger_name".Equals(shortName) && active) 
          { 
                // optional if you have an action set in the mission file
                AiAction action = GamePlay.gpGetAction("your_action_name");
                if (action != null)
                {
                     action.Do();
                }
                // include other operations here, e.g. loading submissions
                GamePlay.gpHUDLogCenter("your onscreen message");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
    }
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 05:10 PM.


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