Jump to content

Recommended Posts

Posted

Following the discussion from here:

 

http://forums.eagle.ru/showthread.php?t=163316

 

I have created a mission that gets the behavior I want .... except for a good trigger.

 

As noted in the previous mentioned thread, I want the group to retreat to some "holding points" when fired upon until the threat is cleared.

 

I am having difficulty with the built-in triggers.

 

If I just use a "group in zone trigger", it works fine. But this is not satisfactory. Because the idea is that the group must be in the zone AND not under threat.

 

If I try some complicated business of "unit damaged/dead", it is a PIA if I have multiple units, but, worse, for some reason the units do not stick to their holding points until the all clear. The trigger is correctly activated, as evidenced by the green smoke, but the units quickly fly back on their normal mission route, resulting in all of them getting shot down.

 

I would love some hints from someone who understands the DCS Lua framework to help me express the following in Lua predicates:

 

- "If [Group] is firing/shooting and [Group] is in Zone A, then set Flag X value to N"

- "If [Group] have been shot and [Group] are firing/shooting, then set Flag X value to N"

- "If [Group] has been fired/shot/damaged by [Group], then set Flag X value to N"

x2.miz

Posted

Could you detail what is meant with shooting? I mean, cannons or missiles? DCS fires off an event when a missile is launched from a unit, but not when a cannon or guns are being used. Therefore, detecting when a unit is firing is going to be rather difficult.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Posted
Could you detail what is meant with shooting? I mean, cannons or missiles? DCS fires off an event when a missile is launched from a unit, but not when a cannon or guns are being used. Therefore, detecting when a unit is firing is going to be rather difficult.

 

Unfortunately, yes, I mean shooting with AA guns. The idea is the escorted aircraft break away from their mission route when attacked and resumed later.

 

I currently have implemented this by creating a trigger zone the same size as the weapons engagement zone of the enemy unit and the following conditions:

 

(1) if enemy unit is alive

(2) if any of group in trigger zone

 

This is based on the assumption that the enemy AI will always detect, target, and fire upon the group the moment they are in the engagement zone. So far, this works out OK.

 

I note that there is some really finickiness with waypoints. If any waypoints added/deleted, then I MUST delete and recreate both the tasking as well as the triggered "push AI task" command, even if the changed waypoints are not involved in any of this.

Posted

To track who used guns on who there is event: S_EVENT_HIT. The bug at the moment is it only works in single play or for the host, not for the clients in MP.

 

General script example:

hitEvHandler = {}
function hitEvHandler:onEvent(event)
   if (world.event.S_EVENT_HIT == event.id) then
       local _target = event.target:getName()
local _initiator = event.initiator:getName()
local _hitData = {_target, _initiator}
timer.scheduleFunction(whoDid, _hitData, timer.getTime() + 1)
end	
end
world.addEventHandler(hitEvHandler)

 

 

 

 

.

Posted
To track who used guns on who there is event: S_EVENT_HIT. The bug at the moment is it only works in single play or for the host, not for the clients in MP.

 

General script example:

hitEvHandler = {}
function hitEvHandler:onEvent(event)
   if (world.event.S_EVENT_HIT == event.id) then
       local _target = event.target:getName()
local _initiator = event.initiator:getName()
local _hitData = {_target, _initiator}
timer.scheduleFunction(whoDid, _hitData, timer.getTime() + 1)
end	
end
world.addEventHandler(hitEvHandler)

 

.

 

Thanks. It looks like all the information is here. Now I just have to learn the DCS scripting framework to put it to use!

  • Recently Browsing   0 members

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