ED Forums

ED Forums (https://forums.eagle.ru/index.php)
-   Mission Editor Discussion and Questions (https://forums.eagle.ru/forumdisplay.php?f=210)
-   -   RN-24/28 Classnames? (https://forums.eagle.ru/showthread.php?t=245239)

Kocrachon 07-11-2019 06:14 PM

RN-24/28 Classnames?
 
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

Code:

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.

Grimes 07-11-2019 11:00 PM

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:

Code:

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


Hardcard 07-12-2019 12:41 AM

Does Unit.getAmmo() detect external fuel tanks as well?

Grimes 07-12-2019 01:13 AM

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.

Kocrachon 07-12-2019 03:01 AM

Thanks grimes!

Hardcard 07-12-2019 05:15 PM

@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?

Grimes 07-12-2019 10:37 PM

Nope.

johnv2pt0 08-04-2019 06:50 AM

Would you mind sharing your work? This would be extremely useful for my squad


All times are GMT. The time now is 10:51 AM.

Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.