Jump to content

Recommended Posts

Posted

Hey All,

 

I'm trying to write a script that detects if an aircraft has specific munitions equiped.

 

Right now here is what I have

 

weapRestrict.weapon2BAN={"AIM-120C","AIM-120B","R-77"} (Example Munitions)

 

With

 

if weapRestrict.weapon2BAN[bwCount] == checkPayload[bCount].desc.typeName then
   trigger.action.outText("Restricted Weapon detected: " .. checkPayload[bCount].desc.typeName .. ", this weapon is BANNED,  ".. e.initiator:getPlayerName() .. " kicking to spectator", 120)

 

But I can't seem to figure out the name of the "Nukes" to add to my weapon2Ban list. I checked the Weapons Database file but I couldn't find them obviously as RN-28 or RN-24.

 

Im doing this instead of setting warehouse limits because warehouse limits break with patches frequently, so I wanted a more stable solution so I can leave on unlimited weapons.

Posted

Its a little weird.

 

"weapons.bombs.RN-24" and "weapons.bombs.RN-28" for the type name

 

For display name it is more normal as "RN-24" and "RN'-28".

 

A good way to figure it out is to iterate through Unit.getAmmo() for a given unit.

 

So something like:

 

local ammo = Unit.getByName('whatever'):getAmmo()
for i = 1, #ammo do
 env.info(ammo[i].desc.typeName)
 env.info(ammo[i].desc.displayName)
end

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

Posted

No its just an itemized list of how many of each type of ammunition are onboard. It gives no information for what is on each pylon. getFuel() can sort of be used if working under the assumption that a player will take full internal fuel + bags as getFuel represents internal fuel only. So if it is greater than 1 then fuel tanks are used.

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

Posted

@Grimes

 

Thanks for the answer.

 

Yes, I used the getFuel() check that you mentioned when I wrote my air refueling script. It works as intended, but I was hoping for a better way of doing it.

 

Isn't there a way of detecting the presence of external fuel tanks more directly?

  • 4 weeks later...
  • Recently Browsing   0 members

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