ADHS Posted October 16, 2022 Posted October 16, 2022 (edited) Hello. I am setting a Team-Balance script. S_BIRTH gives the info of CLIENT/AI spawn so to increase the Counter to +1. With CLIENT all goes fine, but i've stacked on how to get and minus an AI's loss. Mist destroy group, dcs deactivate group, they don't trigger a "loss" event. Tried S_DEAD, S_PILOT_DEAD etc. Only S_LOST worked, but only if EXPLODE the Unit. Looking for an alternative way, more quiet and less dangerous for the neighbours . Thank you. Edited October 16, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits.
toutenglisse Posted October 16, 2022 Posted October 16, 2022 7 hours ago, ADHS said: ...Mist destroy group, dcs deactivate group, they don't trigger a "loss" event... I can be wrong, but here you seem to have your event ? When you use Unit or Group.getByName():destroy(), you can also at the same time adjust your counter ? (- 1 for Unit or - #(Group.getByName():getUnits()) for a Group) 1
ADHS Posted October 16, 2022 Author Posted October 16, 2022 (edited) toutenglisse Hello and thank you for your reply. Yes, i did that at destroy/respawn stage, but once the goal for this function is to be fully automate, i based it on BIRTH/DEATH/ENTER/LEAVE for both AI and CLIENT. Looking for the AI "death" EVENT part, that will make this function fully stand-alone and operational. Besides that, i am curious to find out which EVENT can cooperate with AIs at such occasions. This is the overall flow: 1. Event handler. if Event.id == BIRTH, DEAD, LOST, ENTER, LEAVE, PILOT_DEAD, LAND etc then ALFA() 2. ALFA() If CATEGORY == 0 PLANE or 1 HELI then BHTA() 3. BHTA() If COUNTER_RED ~= COUNTER_BLUE if COALITION == 1 or 2 if CLIENT or not CLIENT then COUNTER_RED +/- or COUNTER_BLUE +/- Respawn or Destroy AI_GROUP I think it may be a matter of what DCS assumes as DEAD or ALIVE at runtime, even if an object has been activated/deactivated or destroyed/respawned by DCS or MIST functions. Thank you Indeed Mist/DCS can destroy an AI_GROUP, is not there anymore, but EVENTs are ignoring this action. All AI_GROUPs, are GROUP with just one UNIT, so Mist/DCS can destroy/respawn type of GROUP, with LATE ACTIVATION. CLIENT is under S_ENTER and S_LEAVE events. AI is under S_BIRTH and (S_LOST for now, after EXPLOSION) events. AI destroy/respawn (1st stage) depends of CLIENT's action S_ENTER or S_LEAVE. AI destroy/respawn (2nd stage) depends if CLIENTs are against AIs (scenario). Edited October 17, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits.
ADHS Posted October 17, 2022 Author Posted October 17, 2022 31 minutes ago, toutenglisse said: I don't know. I fail to understand. In short: I am looking for the S_EVENT that triggers once an AI is dead. Democracy was already invented, while Scrat was eating oak fruits.
toutenglisse Posted October 17, 2022 Posted October 17, 2022 1 hour ago, ADHS said: In short: I am looking for the S_EVENT that triggers once an AI is dead. For everything that happens during the mission, the available events obviously can detect it (crash, kill, pilot dead, landing back at base, etc...). If you destroy() / deactivateGroup() by script there is no event but as your script uses these functions, you can also add anything you want for taking in account this destruction. (ex : get AI coalition before destruction, adjust counter for that coalition, and destruct) You also have the possibility to add a loop when AI spawns to periodically check if alive (MIST groupIsDead - DCS World Wiki - Hoggitworld.com or any similar function) but it's probably not what you want. Maybe if you want to share your script I can better understand your issue, but actually I can't get it. 1
toutenglisse Posted October 17, 2022 Posted October 17, 2022 hi @Flappie I don't think so as this other thread is only about ground vehicles.
cfrag Posted October 18, 2022 Posted October 18, 2022 On 10/16/2022 at 2:51 PM, ADHS said: . Looking for an alternative way, more quiet and less dangerous for the neighbours If you can't get events to work reliably, maybe you can try and do some active polling (say every 60 seconds or so): use coalition.getGroups(coalitionId , GroupCategory) with groupCategoy = 0 (Airplane) to get all aircraft groups per side. Then iterate all units in each group, and check if a unit has getPlayerName() implemented - if so, that unit is a player. Add them all up and with a single pass you can count for each side the number of planes and players. Even if you have a total of 100 active planes, that processing load is negligible - especially if you only check once every minute. 1 1
ADHS Posted October 22, 2022 Author Posted October 22, 2022 Thank you both, i will try to code your suggestions. Democracy was already invented, while Scrat was eating oak fruits.
Recommended Posts