#41
|
|||
|
|||
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:
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; } } |
#42
|
||||
|
||||
Quote:
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. |
#43
|
|||
|
|||
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 |
#44
|
|||
|
|||
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:
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; } } 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. |
#45
|
|||
|
|||
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 |
#46
|
|||
|
|||
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. |
#47
|
||||
|
||||
Quote:
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 |
#48
|
|||
|
|||
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:
Ming |
#49
|
|||
|
|||
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. |
#50
|
|||
|
|||
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 |
|
|