Results 1 to 12 of 12

Thread: Triggers don't seem to work.

  1. #1
    Novice Pilot Aussie Pilot's Avatar
    Join Date
    Aug 2018
    Location
    Brisbane, Australia.
    Posts
    33
    Post Thanks / Like
    Total Downloaded
    0

    Triggers don't seem to work.

    Has anyone else noticed if the triggers have stopped working?

    I have a few new Tobruk Multiplayer missions with triggers set up the same as I usually do that don't seem to work. Simple triggers set up the same as other missions that I know work. ArmyAir Red with Pass through trigger but nothing spawns.
    Mission attached if someone can take a look please. Perhaps I'm missing something I've over looked.
    Attached Files Attached Files
    Cheers, Aussie Pilot.

  2. #2
    Supporting Member
    Join Date
    Dec 2019
    Posts
    180
    Post Thanks / Like
    Total Downloaded
    21.76 MB

    Re: Triggers don't seem to work.

    hi
    I tried running it and couldnt get anywhere because my kittyhawk seemed to be spawning off map without undercarriage and on/in ground - certainly not on an airfield ie the row of tomahawks on the field was not seen so I would guess I am not there. Without being able to take off there was no way for me to test the triggers. I assume this is happening at your end ok. In fact when I generated the plane it did not spawn me in the cockpit, I had to menu click to look at it.
    With a bit of time, I will convert it to single play and just spawn a red plane to fly through your trigger(s). One thing though did strike me that if the beau and hurris are triggered they are going to self trigger themselves by flying through the same trigger zone location without you having a script to null it (so a self perpetuating stream of them). But cannot test that at present.
    Then I will try and set up a spawn location that works for me and repeat as I could not work out how your were doing it (or why it doesnt for me).
    Some of these problems maybe purely how I have my game set up
    Also, as a comment, your front lines appear reversed which is some what confusing to me(ie kittyhawk field is on blue side of frontier).

  3. #3
    Novice Pilot Aussie Pilot's Avatar
    Join Date
    Aug 2018
    Location
    Brisbane, Australia.
    Posts
    33
    Post Thanks / Like
    Total Downloaded
    0

    Re: Triggers don't seem to work.

    Thanks for looking Stickz.

    If you're testing it by running your own multiplayer server ( which is how it is intended to be done) then make sure in your server realism settings you don't have "cannot select plane" or "cannot select side" checked by mistake. It will stop you from joining the mission properly.

    I purposely have the airfield set up behind the enemy lines as a forward base. They actually did have airfields set up like that during the war for harassing the enemy. They could all take off and drive vehicles away quickly in the event of being found. I also based it from a book I read.

    As for the Beaufighters and hurricanes setting the triggers off again, well i didn't realise that could happen so I'll make adjustments accordingly if i need to.
    Cheers, Aussie Pilot.

  4. #4
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Triggers don't seem to work.

    Quote Originally Posted by Aussie Pilot View Post
    Mission attached if someone can take a look please. Perhaps I'm missing something I've over looked.
    The attached file has no script file, just reference in the miss file for "PassRhrough" trigger and correspond "Actions" trigger.

    However is need a file "Allied 005 Tobruk. Reinforcements.cs" (script code).

    Because the trigger "Action" in FM is broken, hence need the CS code for re-activate the action.


  5. #5
    Supporting Member
    Join Date
    Dec 2019
    Posts
    180
    Post Thanks / Like
    Total Downloaded
    21.76 MB

    Re: Triggers don't seem to work.

    To add to what 1Lokos put above. I ran it as single player, ran an AI martlet through the trigger zone and nought triggered. I than resaved your script entry and reassociated the trigger name(s) with the hurri and beau spawns, saved and retried. This time they spawned ok (I have ran across this before having to resave the triggers even if not editted). This time they did appear and fly the routes. Good news is, they did not set off more triggers but when my martlet re-entered the zone they did. Oddly, it used to be that entering and leaving the zone used to trigger the event - so twice. This meant that it was essential to have the script text to deactivate the trigger to prevent it re-occuring on leaving the zone. Perhaps TF fixed this problem recently but caused the trigger to misfire as 1lokos refers to above. I just have a copy/paste file from sharpdevelop that I use so may not have seen it.
    I still seem to spawn in middle of nowhere trying multi player though.
    Gotta go, do duty and visit newly arrived grandchild (really feel old now)

  6. #6
    Novice Pilot Aussie Pilot's Avatar
    Join Date
    Aug 2018
    Location
    Brisbane, Australia.
    Posts
    33
    Post Thanks / Like
    Total Downloaded
    0

    Re: Triggers don't seem to work.

    Thanks again guys. I don't understand why they won't work, my older Battle of Britain missions work with triggers and no scripts.

    Anyway I tried two scripts, well they are the same really, just the first few lines differ a bit but it still doesn't work. Can you check the scripts for me please to see if they are what's needed. I copied them from the forum. One in named different so if you are going to test them in game you will need to correct it's name first. RAR attached.

    As for spawning into the mission Stickz, yes I spawn away from the runway as well, at the airfields default spawn points. It's a pain but I have tried creating closer ones but they never work properly either.
    Attached Files Attached Files
    Cheers, Aussie Pilot.

  7. #7
    Supporting Member
    Join Date
    Dec 2019
    Posts
    180
    Post Thanks / Like
    Total Downloaded
    21.76 MB

    Re: Triggers don't seem to work.

    hi Aussie pilot. There is nothing fundamental wrong with your mission. I think the triggers do work, just not sure if reliably. I would have to run it more often to get an idea for that (ie they did work the last try but have not had chance to retry).
    There are several potential issues though as you have it, firstly: using RedGroup army air means as I understood it, that any red flight entering the zone could repeatedly trigger it, but this is conjecture(Ive seldom used it cos I always assumed it would happen). Secondly; as it used to be, the Passthrough trigger would fire both on entering and leaving the zone.
    The second one here was historically always an issue that required a script to deactivate the trigger, so all my missions do that - cos of that I would not see if this was still a problem. But if you look in the much older ATAG mission scripts you will see mentioned way back. There are a set of youtube videos by boyzee (hope I spelt that right) from ACG and philstyle that will mention it I believe. And if done as multiplayer, any plane spawned entering that zone "should" generate a trigger which may not be desired either. So it would need deactivating via a script. If you ran it single player then changing from Group to either Player or specific flight would solve some of this, unless you reenter the zone.

    Now for the scripts - they wont work with your mission (assuming you didnt change from what posted initially). I dont know how much programming experience you have.
    OnTrigger(int missionNumber, string shortName, bool active) is called by the running game whenever a trigger is generated (ie by plane entering that zone). missionname parameter you can ignore here, shortName is the name of the trigger that has been generated. Yours are all named from 1 to 7. Active is true if the trigger has not been disabled.
    So ("Trigger_name".Equals(shortName) && active) needs to have a recognised name passed, so for "trigger_name" substitute one of "1", "2" ...."7". You then need an If statement for ever trigger name used. So a trigger is generated (say to spawn the beaufighters), shortName will then be assigned value 2. The If statements will then be ignored until value matches 2. Those scripts are never going to find a trigger generated called trigger_name so will fall out. This is why the script !Lokos provided you had the comment added about same as YourTriggerName.
    If the trigger has been deactivated, the if statement will be ignored (done by the setting shortName.active to false line).
    There is one advantage here: you are wanting both hurri and beaus to be generated together, so you could remove one trigger zone and have the If statement for zone 1 set both flights on route. Have not looked further at your LW spawns but I am guessing at present they could also be generated by a single trigger zone.

    Thus for a single trigger, the If statement could be
    if ("2".Equals(shortName) && active)
    {
    AiAction action = GamePlay.gpGetAction("2"); //same as YourTriggerName
    GamePlay.gpLogServer(null, "Generating Reinforcements", new object[] { }); //Testmessage or "Generating LW" for different trigger name
    if (action != null)
    {
    action.Do();
    }
    GamePlay.gpGetTrigger(shortName).Enable = false;
    }

    If the game is not generating the triggers, then the script will not work either, but we need to get to a starting line somewhere, and checking that we get triggers will do that.
    We (I guess) are 12 hours apart, but I can try to write you a script file that works with your mission as it is, if you have never tried. Take me time to test it, for one thing I'd have to move a cat, but once you see one it will be easy to see how it goes and how to use as a template for all missions.
    There are also other (arguably better ways) to set up these AI flights via sub-missions which I guess is what 1Lokos meant but thats going to muddy and complicate things more.
    As for my spawning - heh heh still not sure its even on the airfield although your spawn location is in right area - I can cross that bridge later.

  8. #8
    Supporting Member
    Join Date
    Dec 2019
    Posts
    180
    Post Thanks / Like
    Total Downloaded
    21.76 MB

    Re: Triggers don't seem to work.

    Hi Aussie pilot, been playing with this all afternoon. The triggers appear to work after I go through the trigger editor and re associate each action with the unit it was meant to spawn. I did this with the hurri and beaufighter spawns yesterday and they have triggered every time I ran the mission since, including having restarted the game. However neither of the 110 flights were triggering which used zones virtually alongside the others. So this afternoon after my earlier post I then associated one of the 110s flights with its action group link. Ran the mission and the 110s spawned. So I then re-associated the second flight with their action saved everything. and ran it and now both 110 flights trigger each time along with the hurricanes and beaufighters. It maybe worth you trying the same thing, associate them in the script menu, use the script option save button and then save the whole mission again and see if it works by running it. Mine is still running as a single player with an AI martlet triggering the zones. But they do reliably trigger like this for me. I am thinking that you may not have used the save button under the script editor but just relied on the mission editor save at some point.

    After that I wrote a script file to perform the same action and to disable each trigger once it has activated once. The 7zip file below has the mission and briefing, set up as a single player. The marlet spawns, flies SE into your trigger zone(s) and triggers the 2 allied flights plus the 2 flights of 110s. Also in the zip file are 2 scripts. One has the correct naming function so if in same directory as the mission files, will run with it once you have compiled it via the script file editor then saved it all. One script generates hurricane, beaufighter and single 110 flight via individual triggers (similar to how you set it up without the script). The second one generates the hurricane and beaufighter flights via a single trigger zone to show how you can remove several of the overlapping ones you have to simplify it all. It probably also reduces overheads for game tracking entries into and out of these zones. As each trigger fires a message will appear on the side of the screen.
    The only other alteration from your mission files (bar the AI marlet addition); in the mission file, I renamed the action group names for beaufighter and hurricanes. This was to a) make it easier for me to keep track of what I was doing and b) I thought it might help you to see how the names work within the script files (if you have little experience with it). Its fairly rudimentary, theres many out there that could make it far more sophisticated but I tried to get some thing to work that in case you have not used it before may help you see what goes on.
    If you want to try the second script, you will have to rename each (ie move the 001 in the name to the other file) and then most important go back into the script editor and compile it, save it then save the mission.
    I have done nothing to get the 109s to spawn, I suspect that will just require the same relinking to action group. I can try that easily enough later. I will next try spawning myself as in a multi player to check it can work as you wish it to ie for multiplayer. But I am going to have to try and get a spawn location that works for me which with my present rate of succes may need to be at 5000ft.
    Hope this makes sense to you

    Attached Files Attached Files

  9. #9
    Novice Pilot Aussie Pilot's Avatar
    Join Date
    Aug 2018
    Location
    Brisbane, Australia.
    Posts
    33
    Post Thanks / Like
    Total Downloaded
    0

    Re: Triggers don't seem to work.

    Wow Stickz thanks for doing all this and taking the time to explain it to me. It will take me a bit of time to go over it and see what you are explaining because I have never done scripting before, but after all your help i will definitely try and figure it out.

    Also, do you need a script for each trigger or will one cover them all?
    Last edited by Aussie Pilot; Feb-28-2022 at 20:21.
    Cheers, Aussie Pilot.

  10. #10
    Supporting Member
    Join Date
    Dec 2019
    Posts
    180
    Post Thanks / Like
    Total Downloaded
    21.76 MB

    Re: Triggers don't seem to work.

    hi Aussie pilot

    you can only have one script - as far as I understand. This is because only one method? can be operating at a time. My terminology for csharp and object orientated programming in general is pretty weak. I got a degree for computing back in 80/90s when it was all procedures and functions. I can read and debug it fairly well, but writing it (OOPs) is something of a black hole my brain refuses to enter.
    This bit could add more confusion - but you can have the main mission call a second (or more) mission file and in principle that sub-mission could have an associated script but I dont think the script will work as it clashes with the other(others more knowledgeable than me would have to say why). It helps that one of my sons has a degree in computer games programming at least until my eyes glaze over .

    So one script and that single script has to handle all triggers. If look at the scripts I put in the file, both do the same thing (actually one handles 4 triggers and one handles 3) but they do it in different ways. Which is why I say you have to rename the wanted one (cos the active one needs a name to match the mission file) and recompile it if you want to compare them. However a single trigger zone (or type)can generate several different responses which cannot be done without the scripts.
    Yo-Yo has a SP guide that goes into script writing in a pretty good straightforward way(much better than my teaching attempts). There are a lot of lessons for script writing here and even if some are fairly old dates, most of that information - and scripts are still relevant. I used a lot of them (probably labels me as a pirate) for learning how to get things to work (ie counting bombs falling in a designated zone). There is also reddogs storm of war stuff which has a lot of comments to help understand it - although its quite a lot to ingest if starting from scratch
    There is also a framework - multiplayer sample mission in this forum with help stuff by Artist, but again if coming to it from zero it is probably a bit overwhelming. Even if the title says multiplayer though it can be massaged to be used for co-op and single player and it can be used for virtually everything.

    Your best bet is to use an editor rather than the ingame one (for me its almost unreadable anyway). MS visual studio I think is most popular (I dont just because it is by MS), but they have huge advantages over the built in one (but still need to compile it in game).

  11. #11
    Supporting Member
    Join Date
    Dec 2019
    Posts
    180
    Post Thanks / Like
    Total Downloaded
    21.76 MB

    Re: Triggers don't seem to work.

    hi Aussie pilot, your trigger for the 110s work in multiplayer setup, and seem to be triggered by whichever friendly enters the zone first and its a once only occurence. First time I tried the Martlet triggered them (it started nearer & airborne), next time my aircraft triggered them (removed AI martlet). I have not tried the third 110 flight nor the 109s but see no reason if they are added to the script and associated with the correct unit in game that they wont generate as you want.

    I have no idea why your spawn location is giving me grief. It only seems to be a kittyhawk that is spawning at the map edge for some reason, a martlet or tomahawk spawn on the airfield with me in cockpit no problem. I setup another spawn point on the same field on one of the preset locations and I could pick whatever I set. So I swapped the locations of the 2 spawn round but it made sod all difference, your spawn point wont give me a kittyhawk to fly. I have absolutely no idea why, but I suspect that is something I have for my game with the kittyhawk - if you can spawn in kittyhawk with no trouble then I should just forget about it. Compared our spawn location setups and apart from me enabling a hurri there as well, there is no difference so hey ho.
    Not likely to get any more time for a while, (if you really need anything further help anyway) my daughter is bringing her new snapper (3day baby for the unitiated) tomorrow and gonna teach her to sim fly then I am down south coast until middle of next week for my aunts 90th. Dont get to see my relatives more than once a decade now (and that usually at funerals) so gonna try to enjoy a happy event for this decade.

  12. #12
    Novice Pilot Aussie Pilot's Avatar
    Join Date
    Aug 2018
    Location
    Brisbane, Australia.
    Posts
    33
    Post Thanks / Like
    Total Downloaded
    0

    Re: Triggers don't seem to work.

    Thanks for all you've done Stickz, I'll work my way through it and see how I go. If it doesn't work i'll just go back to my old way of setting them up and just have the planes start at mission start but use waypoints to get them where I want by a certain time. That always works, just need to start them off in the distance somewhere and work out my times.

    Enjoy your family.
    Cheers.
    Cheers, Aussie Pilot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •