Jump to content

Event Triggers


Rudel_chw

Recommended Posts

Hello,

 

The admittedly obsolete DCS manual says about event triggers:

 

"Setting triggers to events can reduce the CPU workload and also provide some unique trigger mechanisms. The following events are available:

 

 ON DESTROY. Trigger's conditions are evaluated whenever any unit is destroyed.

 

 ON CRASH. Trigger's conditions are evaluated whenever the player crashes.

 

 ON EJECT. Trigger's conditions are evaluated whenever the player ejects.

 

 ON PILOT DEAD. Trigger's conditions are evaluated whenever the player is killed. "

 

I’ve found that the last three events are actually triggered not only when the player is affected, but also whenever a script spawned aircraft crashes, ejects or kills it pilot ..- for example when using RAT.

 

Is there an extra condition that I could use to be sure that the event corresponds to the player’s aircraft?

 

Thanks for any help.


Edited by Rudel_chw

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Use the scripting engine to check if it was the player that initiated the event. Thats about it. As far as triggers go the event functionality is quite limited and not all that needed to save on CPU workload unless you are playing with an incredibly old PC with a mission with hundreds of triggers each with at least a dozen conditions to check.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Use the scripting engine to check if it was the player that initiated the event. Thats about it.

 

Hello, thanks for the answer .. unfortunately, I still dont know enough scripting, so I'm sticking to the basic trigger functionality for now.

 

Experimenting a bit more with the ME, I finally choose to ues the UNIT ALIVE condition on a SWITCHED CONDITION ... thus, this gets executed each time a unit's slot gets occupied by the player, like this:

 

ANNeGLv.jpg

 

My mission has two player slots: for ground start or for a shorter mission with air start:

 

5aAk3CA.jpg

 

I tested it and works quite well, this is when the player choses the air start aircraft:

 

JaPaLJD.jpg

 

... and then when he changes slot to the other aircraft:

 

IbJiDvc.jpg

 

For each slot that the player selects, I turn on a different Flag, so the rest of the triggers can know which aircraft is in use at any given time. Then the trigger for Crashing the aircraft is now like this:

 

55pml57.jpg

 

Flag 80 is ON if the player is using the "Trainee Air-Start" Unit; and Flag 90 is ON if the player is using the Ground start unit (Trainee)

 

So, I thinks that now I've the original problem under control :D

 

Thanks a lot for your views, I'm sure that eventually I will have to learn scripting ... but for simpler missions I'm traying to stay with the trigger events :)

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

@Rudel_chw

 

Capturar información de eventos vía script es bastante sencillo.

 

Es tan simple como obtener el nombre de la unidad (o grupo) del iniciador y compararlo con el del jugador (también puedes tratar de obtener el nombre del jugador directamente, si existe).

Si concuerda, la lógica que hayas escrito se pone en marcha, de lo contrario, no ocurre nada.

 

Por ejemplo, hace poco escribí una lógica en MOOSE que hacía precisamente esto:

 

 

local Mi_Avion = UNIT:FindByName("Nombre de unidad del avión en ME")

 

Mi_Avion:HandleEvent(EVENTS.Land) -- Suscribe tu avión a su evento de aterrizaje

 

function Mi_Avion:OnEventLand(EventData) -- Crea una función que se activará cada vez que tu avión aterrice. "EventData" es el parámetro del que obtendremos la información del iniciador

 

local Nombre_Jugador_Aterrizaje = EventData.IniPlayerName -- Esto nos devolverá el nombre del jugador que pilota el avión iniciador del evento.

-- Si el avión está controlado por un jugador, nos dará su nombre, pero si está controlado por AI, nos devolverá "nil"

 

if Nombre_Jugador_Aterrizaje ~= nil -- Creamos el chequeo para ver si hay un jugador en el avión o no. Si lo hay, recibiremos un mensaje al aterrizar, con su nombre. Si no lo hay, nos dará "nil", el mensaje no se enviará

then

MESSAGE:New(Nombre_Jugador_Aterrizaje.." has landed!",10):ToAll()

 

end

end

 

 

Viendo tus capturas de pantalla, yo creo que esa jungla de triggers que tienes ahí es bastante más complicada y difícil de manejar que la mayoría de scripts que he visto o escrito.

 

Si alguna vez decides empezar a programar en Lua, puedes mandarme privados con cualquier duda que tengas. Si yo no puedo solucionar tus dudas, seguramente podré decirte donde encontrar las respuestas. :thumbup:


Edited by Hardcard
Link to comment
Share on other sites

...

Viendo tus capturas de pantalla, yo creo que esa jungla de triggers que tienes ahí es bastante más complicada y difícil de manejar que la mayoría de scripts que he visto o escrito.

 

Thanks a lot for the script, for sure I will experiment with it a bit :)

 

Regarding my jungle of triggers :) .. actually it isn't hard to mantain, tough I would love an easy way to do cut/paste so I can transfer trigger sequences onto other missions

 

Si alguna vez decides empezar a programar en Lua, puedes mandarme privados con cualquier duda que tengas. Si yo no puedo solucionar tus dudas, seguramente podré decirte donde encontrar las respuestas. :thumbup:

 

Thanks a lot for the offer, will have it present for whenever I finally do step up on scripting ... sorry for answering using english, but dont want to break any rules here :)

 

Cheers and best regards

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...