Jump to content

Question for script guru: AI actions by script


chromium

Recommended Posts

Hi to all,

 

I'm looking for a script that let me activate a particolar AI triggered action (by index, if possibile) whitout having to use the trigger system "AI TASK" action.

 

The best way to explain what I'm looking for is by example:

 

I have a CAP flight with 5 waypoints: start (landed at airport, waiting for a start actions), hold, CAP1, CAP2 and CAP3. Hold waypoint is far inside friendly area while CAPs waypoints are placed in three different areas near the FLOT. In "Hold" waypoint advanced actions I set a 1.30 hours of orbit and In every "CAPn" waypoints I set a 15 minutes orbit, and then they come back to "Hold". The CAP actions is made by search and engage actions by a range of n miles, not by default "CAP" action (to ensure that my filght will engage only within a particoular range).

 

The movement from Hold to CAP1, CAP2 or CAP3 is done by triggered actions, and also the start-up and RTB switch waypoints command are in triggered actions, in this index order:

 

1. Start

2. RTB

3. go to CAP1

4. go to CAP2

5. go to CAP3.

 

The interesting things of this setup is that you can effectively copy and paste this flight between different missions by pressing CTRL-C and CTRL-V, having only to duplicate the triggers needed to perform the start and the "switch waypoints" actions, that are already part of the flight.

 

The point is that, for example, now I use SLmod to activate flags that command one of those actions, and I need 6 triggers for every flights: one for activate the script functions and one for each of the five triggered AI actions.

 

My first objective is to have a script command that activate the AI action instead of the trigger system AI TASK inbuild function (or a way to use this function by trigger).

 

My second objective is to get those scripts to be activated by chat, something like SLmod do with flags.

 

Obviously the second objective is pretty complicated... but even reach the first could be useful for me :).

 

Any help is appreciated :)

ChromiumDis.png

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.

Link to comment
Share on other sites

objective 2) is only possible by using slmod at the moment.

objective 1) is difficult to answer without knowing exactly what triggers you are using for your AI actions.

 

it may be possible to have

CONTINUOUS -> RANDOM(100) -> run script

 

your script will not only have to contain a check of the trigger actions and set a flag for use in a trigger for your AI TASK. Alternatively you could also do the AI TASKS in script also and in the same script file. In fact its possible to write the whole logice in 1 script file for a mission.

 

Maybe there is something in this thread that will point you in the right direction

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

 

p.s. I'm no Guru btw, more of a padawan.


Edited by Druid_

i7-7700K : 16Gb DDR4 2800 Mhz : Asus Mobo : 2TB HDD : Intel 520 SSD 240gb : RTX 2080ti: Win10 64pro : Dx10 : TrackiR4 : TM Warthog : ASUS ROG SWIFT PG348Q

Link to comment
Share on other sites

Objective 2 is not reachable by SLmod, because it can activate a flag and then I will need to use a trigger to activate a script (by Run Script) or an AI TASK. That Is why I need 6 trigger for every AI flight.

 

For Objective 1 is simple: I use a flag to run every AI TASK I need.

 

The perfect solution is the ability to activate directly a triggered action by SLmod, whithout having to create a script that traslate a flag activation (to date SLmod can activate flags) into a triggered action.

 

I already ask about this to Speed, but I believe that his work is already excellent and he has some feature already on the way... so it's non very likely to add this thing now (I believe) :).

 

PS:

Speed is a Jedi, you are a padawan... Am I a bunch of Tatooine sand? :p

ChromiumDis.png

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.

Link to comment
Share on other sites

Objective 2 is not reachable by SLmod, because it can activate a flag and then I will need to use a trigger to activate a script (by Run Script) or an AI TASK. That Is why I need 6 trigger for every AI flight.

No not at all. You would have one trigger

CONTINUOUS -> RANDOM(100) -> Run Script

 

then in that script you would use the function

trigger.misc.getUserFlag(string userFlagName)

to check any flags that may change and set tasks accordingly.

 

For Objective 1 is simple: I use a flag to run every AI TASK I need.

The above script would also be used for objective one in that case.


Edited by Druid_

i7-7700K : 16Gb DDR4 2800 Mhz : Asus Mobo : 2TB HDD : Intel 520 SSD 240gb : RTX 2080ti: Win10 64pro : Dx10 : TrackiR4 : TM Warthog : ASUS ROG SWIFT PG348Q

Link to comment
Share on other sites

  • Recently Browsing   0 members

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