Jump to content

Lua Script Missile Types Question


Surrexen

Recommended Posts

I'm having trouble working out how to distinguish between certain missile types via a script.

 

If I have this:

 

local ShotWeapon = EventData.weapon:getDesc()

local ShotCategory = ShotWeapon.category

local ShotMissileCategory = ShotWeapon.missileCategory

local ShotMissileGuidanceType = ShotWeapon.guidance

 

And then test for this:

 

if ( ShotMissileCategory == 6 ) then

--do stuff

 

That will pick up Mavericks, Harms and oddly enough Harpoons. How can I then tell them apart? Also shouldn't Harpoon be classed as an Anti-Ship missile where ShotMissileCategory should equal 4 and not 6?

Link to comment
Share on other sites

getTypeName() works with any weapon object.

 

As for why the guidance type or missileCategory might not always have the expected values, it likely has to do with how the weapon is defined. As I understand it there are broad categories for weapons within the game and there is basically a template flight profile that weapons within that category follow. As some weapons get updated with AFMs or advanced behaviors the weapon might not fit that specific profile anymore. For instance most of the older ASM sea skim and then do a popup attack when near the target. The new Harpoon descends or maintains altitude until it finds a target, then sea skims, then depending on the setting do a popup attack or not. AI launched Harpoons still appear to follow the old profile though.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

getTypeName() works with any weapon object.

 

As for why the guidance type or missileCategory might not always have the expected values, it likely has to do with how the weapon is defined. As I understand it there are broad categories for weapons within the game and there is basically a template flight profile that weapons within that category follow. As some weapons get updated with AFMs or advanced behaviors the weapon might not fit that specific profile anymore. For instance most of the older ASM sea skim and then do a popup attack when near the target. The new Harpoon descends or maintains altitude until it finds a target, then sea skims, then depending on the setting do a popup attack or not. AI launched Harpoons still appear to follow the old profile though.

 

Stellar .. thanks heaps Grimes :thumbup:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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