Difference between revisions of "ScenEdit AddUnit"
Line 21: | Line 21: | ||
--For Latitude and Longitude: Lat, Lon, Long, are all valid ways to input Latitude and longitude. | --For Latitude and Longitude: Lat, Lon, Long, are all valid ways to input Latitude and longitude. | ||
− | --Altitude: | + | --AIRCRAFT SPECIFIC |
+ | --Altitude: Only valid for aircraft, if a number is passed to this function it will assume its in meters, otherwise pass a string in with units; for example: "5000 ft", "2000 m", "40000 ft" | ||
+ | --Alt is also a valid way to input altitude | ||
+ | --Loadoutid: Only valid for aircraft, denotes the loadout's id. | ||
+ | |||
+ | |||
+ | |||
+ | --OPTIONAL ARGUMENTS: | ||
+ | |||
+ | --Heading: Can be a number in degrees specifying the heading of the unit | ||
+ | |||
+ | --Autodetectable: Can be 0, 1, "yes", "no", "true", "false" | ||
+ | |||
+ | --HoldPosition: Can be 0, 1, "yes", "no", "true", "false" | ||
+ | |||
+ | --HoldFire: Can be 0, 1, "yes", "no", "true", "false" | ||
+ | |||
+ | --Proficiency: Can be "Novice", "Cadet", "Regular", "Veteran", "Ace" | ||
+ | |||
+ | --An example of a very long ScenEdit_AddUnit command | ||
+ | f15 = ScenEdit_AddUnit({type = 'Aircraft', name = 'F-15C Eagle', loadoutid = 16934, heading = 0, dbid = 3500, side = 'NATO', Latitude="N46.00.00",Longitude="E25.00.00",altitude="5000 ft",autodetectable="false",holdfire="true",proficiency="Ace"}) | ||
+ | |||
+ | --And the same command without optional arguments (And different lat/lon/alt) | ||
+ | f15 = ScenEdit_AddUnit({type = 'Air', name = 'F-15C Eagle', loadoutid = 16934, dbid = 3500, side = 'NATO', Lat="5.123",Lon="-12.51",alt=5000}) --note altitude will be 5000m | ||
+ | |||
+ | --Having the "f15 = ScenEdit_AddUnit..." at the beginning of the line allows one to assign this f15 to a mission by using f15.guid | ||
+ | ScenEdit_AssignUnitToMission(f15.guid, "Southern Ukraine AAW Patrol") | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 10:12, 22 November 2014
<syntaxhighlight lang="lua"> --basic function: newship = ScenEdit_AddUnit({type="Ship", name = "USS Test", side = "United States", DBID = 1023, Latitude = "S 50.23.41", Longitude = 5.2}) print(newship.guid) -- prints the ship's unique id
--advanced function:
newship = ScenEdit_AddUnit({type="Ship", name = "USS Test", side = "United States", DBID = 1023, Latitude = "S 50.23.41", Longitude = 5.2})
--Type: Can be one of the following: Ship, Submarine, Aircraft, Facility --For Type: Sub, Air, Land are also valid.
--Name: Can be any string
--Side: Can be any side's name. 'PlayerSide' is a special value that will evaluate to the player's side
--DBID: Database id
--Latitude: Can be a string with a number in it ("5.1"), a number (5.1), or a latitude string specifying degrees minutes and seconds "S 50.23.41" --Longitude: Can be a string with a number in it ("5.1"), a number (5.1), or a latitude string specifying degrees minutes and seconds "S 50.23.41" --For Latitude and Longitude: Lat, Lon, Long, are all valid ways to input Latitude and longitude.
--AIRCRAFT SPECIFIC --Altitude: Only valid for aircraft, if a number is passed to this function it will assume its in meters, otherwise pass a string in with units; for example: "5000 ft", "2000 m", "40000 ft" --Alt is also a valid way to input altitude
--Loadoutid: Only valid for aircraft, denotes the loadout's id.
--OPTIONAL ARGUMENTS:
--Heading: Can be a number in degrees specifying the heading of the unit
--Autodetectable: Can be 0, 1, "yes", "no", "true", "false"
--HoldPosition: Can be 0, 1, "yes", "no", "true", "false"
--HoldFire: Can be 0, 1, "yes", "no", "true", "false"
--Proficiency: Can be "Novice", "Cadet", "Regular", "Veteran", "Ace"
--An example of a very long ScenEdit_AddUnit command f15 = ScenEdit_AddUnit({type = 'Aircraft', name = 'F-15C Eagle', loadoutid = 16934, heading = 0, dbid = 3500, side = 'NATO', Latitude="N46.00.00",Longitude="E25.00.00",altitude="5000 ft",autodetectable="false",holdfire="true",proficiency="Ace"})
--And the same command without optional arguments (And different lat/lon/alt) f15 = ScenEdit_AddUnit({type = 'Air', name = 'F-15C Eagle', loadoutid = 16934, dbid = 3500, side = 'NATO', Lat="5.123",Lon="-12.51",alt=5000}) --note altitude will be 5000m
--Having the "f15 = ScenEdit_AddUnit..." at the beginning of the line allows one to assign this f15 to a mission by using f15.guid ScenEdit_AssignUnitToMission(f15.guid, "Southern Ukraine AAW Patrol")
</syntaxhighlight>