EasyEB Posted September 23, 2020 Share Posted September 23, 2020 I'm having trouble getting AI planes to use specified weapons when scripting. If I load say an AI F-16 with Mavericks and GBU-12s and I specify weapon type "14" (GuidedBomb (LGB + TvGB + SNSGB) and give it an attack command, it still uses the missiles first until it runs out of them. Anyone know why, or if there is a workaround? Link to comment Share on other sites More sharing options...
toutenglisse Posted September 24, 2020 Share Posted September 24, 2020 I've not tested myself and probably it's not the same value, but during an event hit handler the value returned by event.weapon:getName() for a gbu12 (if I've noted correctly...) is : 16793344, and I used detection of this value to trigger other thing. But it's probably not a valid weapon flag I've not tried for an attack task "weaponType". Link to comment Share on other sites More sharing options...
EasyEB Posted October 3, 2020 Author Share Posted October 3, 2020 How do you make an eventhandler to get the weapon code? Link to comment Share on other sites More sharing options...
toutenglisse Posted October 3, 2020 Share Posted October 3, 2020 For exemple : if event.id == world.event.S_EVENT_HIT then MA_out(' ' .. event.target:getName() .. ' Got Shot by ' .. event.initiator:getName() .. ' with ' .. event.weapon:getName() .. '!', 10) if event.target:getName() == CoCenter and event.weapon:getName() == 16793344 then local Target = mist.utils.makeVec3(unitPosition, land.getHeight(unitPosition)) trigger.action.explosion(Target, 10000 ) end mist.removeEventHandler(BombStaticID) end It's just something I used for testing and kept noted somewhere - although I'm not 100% sure it was gbu12 that I used. Maybe another one but principle is the same. But is the value valid as weapon flag ? Link to comment Share on other sites More sharing options...
Recommended Posts