TheTrooper Posted May 9, 2021 Posted May 9, 2021 (edited) Hi, is there a way to script a unit to have 100% guns? It'm starting it at 0% but if it fires a missile to give it 100% guns. or even better actually a script to tell if a unit has fired? I would probably need something else though to give them their chaff and flares back later when required as I guess chaff or flares would also trigger it. Edited May 9, 2021 by TheTrooper ----------------------------------------------- Intel® Core™i7 Quad Core Processor i7-6700 (3.4GHz) 8MB Cache | 32GB HyperX FURY DDR4 2133MHz | MSI GeForce RTX 2070 ARMOR 8G |SSD 1TB 970 EVO Plus M.2
cfrag Posted May 9, 2021 Posted May 9, 2021 I'm not quite sure what your question is. 2 hours ago, TheTrooper said: Hi, is there a way to script a unit to have 100% guns? If by 100% guns you mean 100% of possible ammo, yes. But you can only control that before you spawn the unit when you create the payload table 2 hours ago, TheTrooper said: It'm starting it at 0% but if it fires a missile to give it 100% guns. I don't know what that means 2 hours ago, TheTrooper said: or even better actually a script to tell if a unit has fired? Yes, you can detect if a unit has fired. These are the events that you can subscribe to be notified, and I believe the S_EVENT_SHOOTING_START is the one you are interested in 2 hours ago, TheTrooper said: I would probably need something else though to give them their chaff and flares back later when required as I guess chaff or flares would also trigger it. I don't know what that means
toutenglisse Posted May 9, 2021 Posted May 9, 2021 3 hours ago, TheTrooper said: Hi, is there a way to script a unit to have 100% guns? It'm starting it at 0% but if it fires a missile to give it 100% guns. or even better actually a script to tell if a unit has fired? I would probably need something else though to give them their chaff and flares back later when required as I guess chaff or flares would also trigger it. Yes, but only using workaround that is not optimal. The only way to turn an active unit with 0%gun to 100%gun, except rearm at base of course, is to replace it by same unit with same parameters (at the time you replace it) + 100%gun. It will be a dynamically created unit (you'll only be able to "work" on it by script, not with mission editor). You can make this happen when this unit shoots a missile, but the missile has to be "fire and forget" as the shooting unit will instantly disappear. Here an example : Mig29s invincible with 1 R77 and 0%gun VS F/A-18c invincible with 100%gun. When the Mig29s shoots with R77 it is replaced by another one with no missile and 100%gun. (replacement is not perfect as shared parameters are : point in space, heading and speed, but not same attitude/banking) test-replace-rearm2.miz
Recommended Posts