mjeh Posted September 18, 2012 Posted September 18, 2012 Hi! I need to hook the event every time that a player mans an aircraft in multiplayer, and attach some trigger logic to that. So far I've tried the "takes control" event, this does not display the desired behaviour in a multiplayer game. The most successful attempt I've had so far is using "switched condition" event with condition "unit is alive" for each unit tagged as client controllable. This works fine but is exploitable since it does not trigger if the player selects a new aircraft from the same unit group, without dying/ crashing first (for example mid air). Any ideas would be greatly appreciated!
marcos Posted September 18, 2012 Posted September 18, 2012 There is a continuous check. Not sure if that will help though. Sorry.
mjeh Posted September 18, 2012 Author Posted September 18, 2012 A continuous check wouldn't be helpful in this case since I need the trigger to fire when, and only when, (but every time!) a client takes control of a client controllable aircraft. Thanks for your answer, though!
marcos Posted September 18, 2012 Posted September 18, 2012 Is there a way of looking at pilot skill level for that aircraft. Just brainstorming here.
mjeh Posted September 18, 2012 Author Posted September 18, 2012 the problem isn't in determining whether an aircraft is player controlled or not, it is in determining the moment when a player takes control of it and hooking an event trigger to it that said, even hooking the event that any aircraft spawns would be an improvement at this point in time
mjeh Posted September 18, 2012 Author Posted September 18, 2012 (edited) I'll give some more context for my problem, maybe this will help spark some ideas; I am making a competitive team effort mission where I want to penalize the team if its players choose to ditch their aircraft and get new ones instead of landing to rearm/ repair. I don't want it to be _impossible_ to ditch and get a new aircraft, I just want to penalize it (this isn't supposed to be a realistic mission by any measure) so that it becomes more of a tactical decision whether to ditch or whether to land The best solution I've come up with so far is as I said; Condition Switch event trigger with check for condition: Unit is alive ([client-controlled aircraft]) for each of the client-controlled aircraft followed by trigger logic (not important in the context) The reason this fails is as previously mentioned, the trigger fires the first time you get an aircraft (condition evaluates true), and then after that only if the aircraft actually _dies_ (condition evaluates false) before you get a new one (condition evaluates true again, thus a condition switch); if you get a new one (condition true) while the old one is still alive (condition true) the trigger won't fire (unswitched condition value) and the event will be uncaught, opening up possibilities to exploit these mechanics for the benefit of your team. Edited September 18, 2012 by mjeh
marcos Posted September 18, 2012 Posted September 18, 2012 Can you lower the fuel level in newly spawned planes, forcing them to land anyway? There is a SET FAILURE option. Can you link that to a UNIT ALIVE trigger?
mjeh Posted September 18, 2012 Author Posted September 18, 2012 certainly, but what's to stop them from simply ditching and getting a new aircraft instead of landing? therein lies the problem :)
chromium Posted September 18, 2012 Posted September 18, 2012 (edited) For your check, make so: 1. Create a Trigger zone that enclose the entire theatre of ops; 2. Create a Swithed condition UNIT INSIDE ZONE trigger that turn on a flag when your aircraft is spawn by a client. The flag will turn on your trigger logic and it will be reset after few seconds. By another "timed" trigger. ES: TRIGGER 1: SW.COND->UNIT INSIDE ZONE(yourfirstpilot)-> FLAG ON(n) TRIGGER 2: CONTINOUS->FLAG TRUE(n) + TIME SINCE FLAG(n,5) -> FLAG OFF(n) TRIGGER 3: SW.COND->FLAG TRUE(n)-> (Your action list) Works for me. If you want, you can also use a flag values to trigger different kind of action every time that an aircraft is re-spawned, but it's a bit more complicated. Else, some Dragon's mission have suck kind of logic to make at text apper every time that a pilot spawn in: you can just have a look at his missions to understand how you can work on it. About the SET FAILURE, AFAIK it doesn't work in multiplayer environment (I read something about here and there in the forum) Edited September 18, 2012 by chromium 1 Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
mjeh Posted September 18, 2012 Author Posted September 18, 2012 Actually a huge trigger zone with condition switch trigger to see if the unit is present will be sufficient even without the flag juggling, since I believe the client aircraft disappears instantly when you go to the aircraft select screen (I could be wrong here, will need some testing). Anyway, brilliant suggestion! Thanks! As for the set failure I suspect you're right since it seems (as with cockpit argument conditions and the "takes control" event) that it looks for -player- aircraft rather than -client- aircraft. well that's my theory anyway
chromium Posted September 18, 2012 Posted September 18, 2012 I needed the "flag play" cause i will use that as a "triggering event" for some random & timed trigger logic. Also, I don't know why but it feels a much more "solid" logic cause you can also set an istant message for debugging every time you trigger a flag on or off (I usually assign them to a dedicated flyable slot or, else, I delete them before releasing the mission). Glad to be helpful :) Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
mjeh Posted September 18, 2012 Author Posted September 18, 2012 argh, it seems I was wrong and this trigger zone solution suffers the same problem. I assumed your aircraft would immediately disappear when you seleted a new one, this is not the case unfortunately, and thus the switched condition does not come into play. I did however notice that you will always get a "player crashed"-message when you change aircraft, even when mid-air. Maybe I could hook the "on crash" event, hmm.
chromium Posted September 18, 2012 Posted September 18, 2012 ok I figured out how your cheater would work... I have no solution now, if the event tricks does not work. Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
mjeh Posted September 18, 2012 Author Posted September 18, 2012 Yes, me either :( The only thing I can think of right now would be to use some flag juggling to check number of flying NPCs everytime "on crash" event triggers (since it trigs on both players and NPCs so long as they're airborne) and if it didn't decrease then I can assume a player was the cause and do my trigger actions as necessary from there. I don't really have many airborne NPC units in the game, so this could be a passable solution in this case. Ugly, but if it works... We really need object references in the mission editor. Does lua-scripting give access to this?
BigfootMSR Posted September 18, 2012 Posted September 18, 2012 You are correct. Currently the set failure triggers do not work in the multiplayer environment. Which is a real shame mind you. It would be nice to have sometimes. DCS: A10C Warthog JTAC coordinate entry training mission http://www.digitalcombatsimulator.com/en/files/99424/ DCS: Blackshark 2 interactive training missions http://forums.eagle.ru/showthread.php?t=84612
Grimes Posted September 19, 2012 Posted September 19, 2012 Hmm, I sort of understand what you are wanting to do. I suppose the real question is what sort of penalty you are wanting to apply to users who do not land their aircraft. It is possible to create logic via triggers, but it is somewhat tedious for the more aircraft you add. Switched Condition> Unit Alive and Flag 1 True and Unit inside zone (airbase parameter)> Penalize Spawn Switched Condition > Unit inside zone (airbase parameter) and unit speed less than 10kph and time since flag 1 is 2 seconds> Flag 1 Off Switched Condition > Unit outside Zone (airbase parameter) and Speed more than 10kph Or Unit is Damaged> Flag 1 On Basically flag 1 is set true if the aircraft is damaged and/or leaves the airbase area. If the player returns to the airbase and stops then the flag is set false. The first trigger will only trigger if flag 1 is true when a player spawns in. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
mjeh Posted September 20, 2012 Author Posted September 20, 2012 Hm, nice way to track whether someone landed. Thanks for the tips :)
galevsky06 Posted July 12, 2013 Posted July 12, 2013 Hello, Are "in-zone" + "no-speed" + "on-the-ground" checks still the best way to detect human spawning ? Thank you.
Grimes Posted July 12, 2013 Posted July 12, 2013 With scripting or with triggers? With triggers yes that way still works. With scripting, you have several options available: 1. Event handler on: S_EVENT_PLAYER_ENTER_UNIT 2. Check to see if player didn't previously exist 3. The same sort of check but with scripting. 4. Insert other ways that probably exist here. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
galevsky06 Posted July 12, 2013 Posted July 12, 2013 (edited) With scripting or with triggers? With triggers yes that way still works. With scripting, you have several options available: 1. Event handler on: S_EVENT_PLAYER_ENTER_UNIT 2. Check to see if player didn't previously exist 3. The same sort of check but with scripting. 4. Insert other ways that probably exist here. I prefer with scripting. So, let's catch S_EVENT_PLAYER_ENTER_UNIT events. This is thrown whenever a client spawn into driven unit only or event observers, JTAC etc... ? it may be related to point 3 ? I would like to attach F-10 menu to each human... I think I have to do it each time the player spawn, to use its last unitId (I want to fetch player data into the function that executes radio command job). Thks for your help :thumbup: Edited July 12, 2013 by galevsky06
Grimes Posted July 12, 2013 Posted July 12, 2013 Well you could simply use an even handler with that event, which then calls whichever custom function you want. I don't know if it occurs with taking control of JTACs or ground units. I think I saw a script where someone basically iterated through each client and had an entry associated with that client "commsloaded = true/false" or something like that and kind of monitored the the status of the client to load/unload the F10 radios as needed. Honestly can't remember if the F10 commands stay with clients or not if they die/respawn. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
galevsky06 Posted July 12, 2013 Posted July 12, 2013 Well you could simply use an even handler with that event, which then calls whichever custom function you want. I don't know if it occurs with taking control of JTACs or ground units. I think I saw a script where someone basically iterated through each client and had an entry associated with that client "commsloaded = true/false" or something like that and kind of monitored the the status of the client to load/unload the F10 radios as needed. Honestly can't remember if the F10 commands stay with clients or not if they die/respawn. I will test soon :)
galevsky06 Posted July 13, 2013 Posted July 13, 2013 (edited) With scripting or with triggers? 1. Event handler on: S_EVENT_PLAYER_ENTER_UNIT Back to your idea, I fail to manage S_EVENT_PLAYER_ENTER_UNIT I did a small Events dumping feature for any Event, and what I have is: 00081.584 INFO SCRIPTING: ======================================================== 00081.584 INFO SCRIPTING: id = S_EVENT_BIRTH 00081.584 INFO SCRIPTING: time = 0 00081.584 INFO SCRIPTING: birth place = 5 00081.584 INFO SCRIPTING: Initiator: id=2 playerName=B-1 00081.584 INFO SCRIPTING: ========================================================No S_EVENT_PLAYER_ENTER_UNIT event caught, just BIRTH instead (when PAUSE is disabled, if you spawn with game on pause, your event is not sent:(). And note that NO EVENT AT ALL is thrown when taking JTAC position, or spawning into unit. :( I also dumped BirthPlace enum and Wiki is outdated: world.BirthPlace = { wsBirthPlace_Air, 0, wsBirthPlace_Ship, wsBirthPlace_RunWay, wsBirthPlace_Park, 0, 0, 0, wsBirthPlace_Heliport_Hot, wsBirthPlace_Heliport_Cold, wsBirthPlace_Ship_Cold, wsBirthPlace_Ship_Hot } Edited July 13, 2013 by galevsky06
galevsky06 Posted July 13, 2013 Posted July 13, 2013 Honestly can't remember if the F10 commands stay with clients or not if they die/respawn. It does ! I tried swaping many units, with F10 attachment only to the very first S_EVENT_BIRTH: you still have F10 if you go back to the first unit. => I only need a flag for each groupId into an array... without taking care of human leaving groups.
Recommended Posts