Jump to content

Possible to get a Trigger if fired in a zone?


Go to solution Solved by Exorcet,

Recommended Posts

Posted

I see many missles can trigger a action when fired into a zone.

I find M151 APKWS for example. But i dont find (i use it in the Kiowa) the normal M151 Hydras for example.
Are this the same missles (rockets) for the trigger?

And i dont find the gun.

Explain:
I have a mission with a base camp where i have to stop shoting inside, if allied forces arrived and entered the base. If i shoot inside the base after allied troops entered the triggerzone i wanna trigger a soundaction which jells at me to stop shooting (with ANY weappon)

 

BTW: Are there fireplases/campfires as add on which can be placed into field camps?

Specs:
12th Gen Intel(R) Core(TM) i9-12900K   3.20 GHz,  RAM 128 GB, Win11 Home, RTX3080Ti

  • Solution
Posted

I can't access DCS at the moment so I might have made minor errors, but you could use an event handler to do what you want.

 

https://wiki.hoggitworld.com/view/DCS_func_addEventHandler

 

It would look something like this:

name = "playernamehere"
player = Unit.getByName(name)
zonecheck = trigger.misc.getUserFlag(1)

Getlaunch = {}
function Getlaunch:onEvent(event)
if zonecheck == true and event.id == 1 and event.initiator == player or zonecheck == true and event.id == 23 and event.initiator == player then
trigger.action.setUserFlag(2, true)
end
end
world.addEventHandler(Getlaunch) 

 

"name" is the variable containing the player unit's name (as found in the mission editor) which must be wrapped in quotes and is passed to the variable "player" which points to the player's unit. "zonecheck" exists to check if the player is in the zone. It is set to retrieve the value of flag 1 which would be set in the mission trigger list to turn true when the player is in the zone. Flag names are arbitrary so it doesn't have to be flag 1, but the flag name must be consistent between the triggers and event handler.

The handler starts with "Getlaunch =" and checks that "zonecheck" is true (is the player in the zone?), that the event happening is shot (event 1) or shooting start (event 23), and that the initiator of the event is the player. If all of these things are true at once, flag 2 will be set to true. Again this flag can be named anything. Add another trigger to the mission that to play the message to stop shooting when trigger 2 is true. Alternatively you can add a message output directly to the event handler with outText or one of its derivatives:

 

https://wiki.hoggitworld.com/view/DCS_func_outText

https://wiki.hoggitworld.com/view/DCS_func_outTextForGroup

trigger.action.outText('Stop shooting', 10, false)

As an example where the message "Stop Shooting" is displayed to all players for 10 seconds with the option to clear other messages set to false.

 

Summary:

Add zone and player unit to map

Add trigger to set flag to true when player is in zone

Add trigger to add event handler to mission

Add trigger to send message when event handler flag is set to true (or add message to event handler)

Awaiting: DCS F-15C

Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files

 

  • Recently Browsing   0 members

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