Kocrachon Posted July 11, 2019 Share Posted July 11, 2019 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. Link to comment Share on other sites More sharing options...
Grimes Posted July 11, 2019 Share Posted July 11, 2019 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 Server, Scripting 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 More sharing options...
Hardcard Posted July 12, 2019 Share Posted July 12, 2019 Does Unit.getAmmo() detect external fuel tanks as well? [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Grimes Posted July 12, 2019 Share Posted July 12, 2019 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 Server, Scripting 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 More sharing options...
Kocrachon Posted July 12, 2019 Author Share Posted July 12, 2019 Thanks grimes! Link to comment Share on other sites More sharing options...
Hardcard Posted July 12, 2019 Share Posted July 12, 2019 @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? [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Grimes Posted July 12, 2019 Share Posted July 12, 2019 Nope. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting 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 More sharing options...
johnv2pt0 Posted August 4, 2019 Share Posted August 4, 2019 Would you mind sharing your work? This would be extremely useful for my squad Link to comment Share on other sites More sharing options...
Recommended Posts