Greeting all on the ATAG Forum
I wonder if there's a possibility in CloD to delay the start off time of an AI- flight.
Till so far I can't find a way to make that happen.
Can somebody help me here?
Barraclough
Greeting all on the ATAG Forum
I wonder if there's a possibility in CloD to delay the start off time of an AI- flight.
Till so far I can't find a way to make that happen.
Can somebody help me here?
Barraclough
Hi, look at this, maybe it helps..
http://jimeez.weebly.com/triggers.html
cheers Larry
You can use triggers and actions, if you so desire. USe the Ttime trigger and put an action to it (the action being spawn a flight of a/c). This example is from an old multiplayer mission:
in the script:
In the .mis fileCode:base.OnTrigger(missionNumber, shortName, active); if ("F1".Equals(shortName) && active) { AiAction action = GamePlay.gpGetAction("action1"); if (action != null) { action.Do(); } Timeout(10, () => sendScreenMessageTo(2, "Do 17's requesting escort! Meet at Calais at 6km in 10 minutes", null)); Timeout(600, () => sendScreenMessageTo(1, "Do 17's have been spotted over Calais @ 6000m heading west!", null)); GamePlay.gpGetTrigger(shortName).Enable = false; }
When I have time later I can send you the whole mission for reference if you like. But this is the only way I know how, there may be a better way - not sure!Code:[AirGroups] BoB_LW_KuFlGr_706.03 [BoB_LW_KuFlGr_706.03] Flight0 1 2 3 Flight1 11 12 Class Aircraft.Do-17Z-2 Formation ECHELONLEFT CallSign 29 Fuel 100 Weapons 1 1 1 1 1 1 5 2 SpawnFromScript 1 Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 [BoB_LW_KuFlGr_706.03_Way] NORMFLY 343645.93 209815.65 6000.00 250.00 NORMFLY 265839.98 218732.06 6000.00 250.00 NORMFLY 245338.44 222772.07 6000.00 250.00 GATTACK_POINT 225078.39 228480.06 6000.00 250.00 NORMFLY 220038.89 230488.22 6000.00 250.00 NORMFLY 224067.89 236254.89 6000.00 250.00 NORMFLY 230789.18 236714.16 6000.00 250.00 LANDING 311609.17 190444.20 6000.00 250.00 [Trigger] F1 TTime 1200 [Action] action1 ASpawnGroup 1 BoB_LW_KuFlGr_706.03
~S~
Thanks very much LARRY69 for the link to Basic Triggers,good old Kodiak's tutorial and you too ATAG_Freya for your Time trigger script example.
Think this information is sufficient and will be a great help, if not I let you know.
cheers Barraclough
Hi Larry69 and ATAG_Freya
Successfully spawned an AI- flight, that's ok now. But I wonder if there's a way by script to delay just the start off time of an AI flight, while the planes are visible from game-start on at their hangars or spawning points.
Barraclough
5th discord: https://discord.gg/SwgEreD
5th discord: https://discord.gg/SwgEreD
Deleted by GANIX.
Last edited by GANIX; Apr-11-2023 at 13:41.
Hello,
Yes, Ganix puts the finger on it.
I found a solution (for MP or lobby)
You need to know the name of the group to destroy. Please note, you need to prefix the name with '0:' (don't know why and to lazy to find the reason)
This solution parse all groups in all army (function DestroyTarget() called by menu). The group name is compared to the one to destroy.
Once the group found, check each actor if it is an AI (we don't want commit a suicide or kill one of our wingmen), if not a player we can destroy the actor.
You can test it with this mission and code.
Hope that help.
Mission :
Script :Code:[PARTS] core.100 bob.100 tobruk.100 [MAIN] MAP Land$English_Channel_1940 DespawnAfterLandingTimeout 600 BattleArea 0 0 393215 393215 5000 TIME 10.0000002421439 WeatherIndex 0 CloudsHeight 1000 BreezeActivity 10 ThermalActivity 10 [GlobalWind_0] Power 3.000 0.000 0.000 BottomBound 0.00 TopBound 1500.00 GustPower 0 GustAngle 45 [splines] [AirGroups] BoB_RAF_F_FatCat_Early.01 [BoB_RAF_F_FatCat_Early.01] Flight0 1 2 3 4 Class Aircraft.SpitfireMkIIa Formation VIC3 CallSign 26 Fuel 100 Weapons 1 Skill 0.84 0.53 0.53 0.37 0.37 0.53 0.53 0.53 Aging 0 [BoB_RAF_F_FatCat_Early.01_Way] NORMFLY 206207.10 160896.00 500.00 300.00 NORMFLY 206438.40 160896.00 500.00 300.00 NORMFLY 206668.80 188543.10 500.00 300.00 NORMFLY 240998.40 212275.20 500.00 300.00 NORMFLY 277401.60 247065.60 500.00 300.00 [CustomChiefs] [Stationary] [Buildings] [BuildingsLinks] [BirthPlace] BirthPlace_0 1 203903 159513 500 5 0 1 . . . 0 [BirthPlace0] Aircraft.SpitfireMkIIa
Code:using System; using maddox.game; using maddox.game.world; using maddox.GP; using part; public class Mission : AMission { private void setMainMenu(Player player) { GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Destroy group" }, new bool[] { true }); } public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex) { if (ID == 0) { if (menuItemIndex == 1) { try { DestroyTarget(); } catch(Exception ex) { GamePlay.gpLogServer("OnMenu : " + ex.Message); } } } } public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); try { setMainMenu(player); } catch(Exception ex) { GamePlay.gpLogServer(ex.Message); } } private bool isAIPlane(AiAircraft aircraft) { if (aircraft == null) return false; for (int i = 0; i < aircraft.Places(); i++) { if (aircraft.Player(i) != null) return false; } return true; } private void DestroyTarget() { try { foreach (int army in GamePlay.gpArmies()) { foreach (AiAirGroup group in GamePlay.gpAirGroups(army)) { if(group.Name() == "0:BoB_RAF_F_FatCat_Early.01") { foreach (AiAircraft item in group.GetItems()) { if(isAIPlane(item) == true) { item.Destroy(); } } } } } } catch(Exception ex) { } } }
"You can teach monkeys to fly better than that!"
Win 11 Pro - I5-12600KF - 32GB Ram - RTX 3080 TI 12GB (non OC) - SSD Sata 970 GBB (System) - NVMe 980 GB (games storage) - Lenovo 27'' 144Hz - HP Reverb G2 v2 -
WMR environment : Empty room (SkySpaces) - SteamVR resolution : 2192x2144 (48%)
nVidia driver : 536.23
Bookmarks