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
  #41  
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
  #42  
Old 09-26-2011, 02:21 PM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

Quote:
Originally Posted by FG28_Kodiak View Post
@David198502
You are from vienna, so i think you can speak german.
I've made step by step tutorials in german:
http://forum.sturmovik.de/index.php/board,17.0.html
ja ich sprech Deutsch.hey danke! werd mir mal das genauer anschauen!!
Edit: sehr gute Artikel hast du da zusammengestellt!und das schöne daran, sie sind wirklich stepbystep Instruktionen die jeder verstehen kann!danke nochmals!!!
__________________

Last edited by David198502; 09-26-2011 at 02:25 PM.
Reply With Quote
  #43  
Old 09-26-2011, 05:41 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

red_bomb1 TPassThrough 3 1 270836 152088 300

Very good thanks Ataros!

To Ming-parse then:-

If a Red bomber crosses a radius of 300m from a point X = 270836, Y = 152088
Then a trigger is generated

So str[0] and str[1] are XY coordinates?

Ahah yes they are, I tested this by dropping numbers in from known object positions and that looks good

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

1 or 2 is army (red/blue)


Ground unit red = 3 1
Ground unit blue = 3 2

Is that ok?

I will need to find out the first TPassThrough parameter, I can't see TPassThrough in the dlls

Ataros please is it possible for you to build a small test script with a simple "Plane crossed radius" message when triggered?

This now is where we (learners) all run into problems, we can see what needs to be done but it is at the end of a long lonely corridor

The usual links to the needed dlls then and the script begins, I will already be in flight some miles from the trigger zone at Biggin Hill for this test, I will be in a Single mission with an airstart, I will be in an RAF SPitfire

I will not be using a Trigger built in the FMB, not to complicate things with simpler ways (for bolting-on universal use later) - I will get Biggin's coordinates for the needed str[0] and str[1]

First call could be 'Are there any planes in the mission?' and the first message could be the type of plane I am flying

(That will be useful for people to play with, by modifying for 'Are there any trains...' '...ships in the mission' and so on, for a toe-in-the-water)

If there are planes in the mission, set up the test-trigger radius and get the message ready

This is the tricky bit Mayday Mayday

If you are busy, no worries and thanks again for the great info

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

red_bomb1 - is just a name I gave to my trigger in FMB. It is not related to bombers, it can be any name.

Quote:
Ground unit red = 3 1
Ground unit blue = 3 2
Is that ok?
Sorry, I do not remember, maybe it is army pass through. Try setting a desired trigger in FMB and then open mis file in notepad to see how to name the trigger correctly.

I do not know C# syntax and grammar good enough to write scripts myself. I can only read and copy-paste them and advise where you can find appropriate examples.

If you paste the below code into a script and make an "army passthrough" trigger in FMB called "incoming" (no quotes) at desired location, the script would print a message for you.

Code:
    public override void OnTrigger(int missionNumber, string shortName, bool active) 
    {
       base.OnTrigger(missionNumber, shortName, active); 

          if ("incoming".Equals(shortName) && active) 
          { 
               
                // include other operations here, e.g. loading submissions with ambulance, etc.
                GamePlay.gpHUDLogCenter("Airgroup incoming");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
    }
If you want to generate triggers via script you should study all naryv's examples more carefully as this way needs some advanced knowledge of C# which I do not have to the degree allowing to reproduce the script for a different mission. You as a C# programmer should better understand this deep-level programming (e.g. dynamic segment file generation, string operations, etc). For me it is really advanced stuff that I can only understand 70% at best but not to reproduce.

Try studying this improved version of naryv's mission http://forum.1cpublishing.eu/showpos...00&postcount=9 My description explains what the script does.

hc_wolf's missions based on these examples has comments in English. I think he learned how they work very well and can provide some help as well. His recent mission was posted in the main section yesterday http://forum.1cpublishing.eu/showthread.php?t=26464

upd. Looks like
Ships "TPassThrough 4"
Ground "TPassThrough 3"
Army "TPassThrough 2"

Last edited by Ataros; 09-26-2011 at 07:42 PM.
Reply With Quote
  #45  
Old 09-27-2011, 12:37 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Thank you very much Ataros, much appreciated mate

I only know Basic and assembly language but we only need to know enough of C# to build scripts, we're using a very small subset of C# because we are running code in some sort of C# emulator. Maddox takes care of all the really difficult stuff thank goodness or there would be error-crashes galore

Doing the practical work you have set me - I realise that I have done no work on FMB triggers (as opposed to scripting triggers) and I must get your example to work... thanks again, the FMB panel of triggers/actions etc looks very interesting

Ming
Reply With Quote
  #46  
Old 09-27-2011, 01:02 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

I think Basic is not object-oriented. If this is the case make sure to read a couple of very short articles about classes
here http://www.aspfree.com/c/a/C-Sharp/C...ses-Explained/
or here http://www.csharp-station.com/Tutorials/Lesson07.aspx#
or http://csharp.net-tutorials.com/classes/introduction/

It helped me to understand C# scripts a lot.

Last edited by Ataros; 09-27-2011 at 01:07 PM.
Reply With Quote
  #47  
Old 09-27-2011, 04:55 PM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Default

Quote:
Originally Posted by Ataros View Post
I was as frustrated as you are when I tried to make a mission for Repka #1 back in April. It was even worse because there were no examples available.

Now there are plenty of examples and missions posted in this section. Of cause it is not easy to find them if you did not follow the discussion from April. It takes time, weeks and months, to learn something new.

If you tell what modules you would like to use in your mission I will try to tell you in which threads/examples they are available.

It is better to start a new thread for each new module you need. Kodiak and other people knowing C# are very helpful and helped me a lot even back in April not having any manual (they just looked up lists of methods, etc. from .dll files in Visual Studio):

(Quoted.....)

Sorry, do not remember who posted this This shows that for people who know C# it is really easy to learn everything needed from game dll-s themselves.
Hi Ataros

many thanks for the piece on Visual Studio. I have it now and been looking at the methods etc. It is starting to make some sense but I am still grappling with it.

I have succeeded in one test module to determine the sector I am in and report it to myself, just a test to help me get to grips with how it all goes together. Now working on SayToGroup which Kodiak put me on to as I'd like to avoid those banner messages if I can.

Anyway, still early days but thanks and special thanks for that library zip.
__________________
klem
56 Squadron RAF "Firebirds"
http://firebirds.2ndtaf.org.uk/



ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU
Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders
Reply With Quote
  #48  
Old 09-27-2011, 05:56 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

many thanks for the piece on Visual Studio

Yes thanks Ataros, that's very useful

I have succeeded in one test module to determine the sector I am in and report it to myself

Nice one, and any code you're working on would be valuable for inspection klem, this sounds the way to go, to get feedback from small test sections, what plane we're in, small steps

I wonder if the 'get' command/method can be used to get at variables and display info

http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx

C# is a bit flash. For example get is an 'accessor' apparently. Who writes this stuff

Quote:
When you reference the property, except as the target of an assignment, the get accessor is invoked to read the value of the property
That's what we're after for testing, ways to get and set properties. Or variables as we used to call them <runs away>

Ming
Reply With Quote
  #49  
Old 09-27-2011, 06:42 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

simply said get; and set; are short versions for class design.

example:

public class test()
{
public string Name {get; set;}
}

so you can use:
test newobject = new test();

newobject.Name = "test1"; // this is the set
string test2 = newobject.Name; // this is the get


the long version

public class test()
{
private string name;

public void SetName (string newname)
{
name = newname;
}

public string GetName ()
{
return name;
}
}
so you must use:
test newobject = new test();

newobject.SetName("test1");
string test2 = newobject.GetName();

only a simple example.
Reply With Quote
  #50  
Old 09-27-2011, 07:23 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Thanks Kodiak!

Kodiak can you tell us how to get at variables in the maddox dlls please?

I use pseudo-code to give an example-

I imagine something like Airfield.FlakCannon.Temperature

Airfield.FlakCannon.Temperature is a variable and it is 200 (Centigrade)

If Airfield.FlakCannon.Temperature > 199 Then-

HoseDownCannon()

This means- if an airfield flak cannon is getting hot, pour cold water on to the barrel

Can we use get to return the temperature of the flak cannon barrel? Can we use get to return values of variables deep inside the Maddox dlls in running missions?


Coincidentally Kodiak - I am coming here now to say that I have my Hello World thanks to you

And now I can see a trigger working, and I understand that everything will work. I think I am in love with Maddox team

For FMB-nuts

For the script code-

using System;
using maddox.game;
using maddox.game.world;

public class Mission : maddox.game.AMission
{
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);

if ("CrossLake".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("Now crossing the lake");
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
}

This above is Kodiak's code with an identifiable (to me) object to get near, the lake north of Sandwich on the 1940 map. Nothing is happening but if you make small stubs like this you can see things like-

For at least singleplayer missions, missionNumber and shortName do not need to be known... I look at variables and wonder where they are, but for testing purposes some things can remain unknown
____________________________

For the mission text after including Kodiak's script and setting the trigger-

[PARTS]
core.100
bob.100
[MAIN]
MAP Land$English_Channel_1940
BattleArea 150000 100000 100000 150000 1000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 10
ThermalActivity 10
player BoB_RAF_F_19Sqn_Early.000
[GlobalWind_0]
Power 3.000 0.000 0.000
BottomBound 0.00
TopBound 1500.00
GustPower 5
GustAngle 45
[splines]
[AirGroups]
BoB_RAF_F_19Sqn_Early.01
[BoB_RAF_F_19Sqn_Early.01]
Flight0 1
Class Aircraft.SpitfireMkI
Formation VIC3
CallSign 31
Fuel 100
Weapons 1
Scramble 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[BoB_RAF_F_19Sqn_Early.01_Way]
NORMFLY 248451.23 259151.63 500.00 300.00
NORMFLY 246594.30 247927.34 1000.00 300.00
[CustomChiefs]
[Stationary]
[Buildings]
[BuildingsLinks]
[Trigger]
CrossLake TPassThrough 0 247385 252352 1900
________________________________

Observe dear learner-comrade that making an entry in the Edit/script/Triggers code-box creates the [Trigger] entry at the end there ^. The trigger is your Player plane crossing the radius around the lake

For the universal AirfieldEmergency script version, all airfields in the mission must be known, and all must have a detection-radius

Sometimes we RTB, but sometimes we need to land at an Alternate airfield. Sometimes we do not know what airfield we must land at - we only care that we can land our plane and maybe stay alive too

To be more efficient we do not need to cover all airfields, we can emergency-cover airfields in the immediate area - not the area west of London when we are defending ships in the Channel area for example

In Il-2 online campaigns (SEOW) we often land damaged at the nearest airfield and we pray it's a friendly airfield. Imagine if fire engines had come out to meet us. But wait- imagine if it's an enemy airfield and flak-defence spawns...

Ming
Reply With Quote
Reply


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 07:18 AM.


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