nighteyes2017 Posted June 8, 2024 Posted June 8, 2024 Writing my first hook in the savedgames/scripts/hooks folder. When a player kills an AI unit, i want to know if it was a ground, air, sea or static type. catching the 'kill' game event, gives me access to the unittype. I then try: DCS.getUnitTypeAttribute( UnitType, 'category' ) but this does not give me anything. I tried: DCS.getUnitTypeAttribute( UnitType, '"DisplayName"' ), and this works, so the routine works, however i cannot find a list of what other strings i can access with the second parameter. anyone figured this out?
cfrag Posted June 8, 2024 Posted June 8, 2024 2 hours ago, nighteyes2017 said: DCS.getUnitTypeAttribute( UnitType, 'category' ) Where did you get that from? The DCS singleton isn't available in mission scripting, just on the server. I recommend that you try to invoke Object.getCategory(theUnit) to find out what general type of object you are dealing with Once that you have determined that it is of a type 1 (a Unit) perform local theGroup = Unit.getGroup(theUnit) to access the unit's group, and finally local theCat = Group.getCategory(theGroup) to find out if it's an aircraft, helo, ground, ship or train. Why such a roundabout way? Because Lua isn't OOP, and some of the accessors in DCS scripting environment are quite fubar.
nighteyes2017 Posted June 9, 2024 Author Posted June 9, 2024 (edited) It isn't mission scripting. It is a script from the Hook directory. So not in de mission file itself. Otherwise, it wouldn't be a problem. So this is available: https://wiki.hoggitworld.com/view/DCS_server_gameGUI Edited June 9, 2024 by nighteyes2017
Recommended Posts