Adding Aircraft LUA Script Help (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios



Message


butch4343 -> Adding Aircraft LUA Script Help (6/8/2017 7:57:01 AM)

Guys once again I stand before you, cap in hand,

Im looking to tap into your LUA knowledge. I want add a aircraft inflight, so I used the search function and found the following post by gunner98

ScenEdit_AddUnit({type='Ship', side='NATO Support', name='AOE 6 Supply', dbid='490', heading='240', latitude='55.3474463444513', longitude='-35.1083051655598'})

Just change up everything inside the '..' to what you need. You can get the Lat/Long by clicking your mouse on the map where you want it - leave the pointer there and use the hotkey 'Ctrl x', it is now in your computers clipboard and you can paste it.



So I tried that changing it too:

ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066'})

I tried that various things as below, I wondered where the aircrafts altitude is added in so I tried adding that in as well, but got the following results:

>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066'})

ERROR: Sequence contains no matching element
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066' altitude='5000'})

ERROR: [string "Console"]:1: '}' expected near 'altitude'
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066','5000'})

ERROR: Sequence contains no matching element
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066})

ERROR: [string "Console"]:1: unfinished string near ''104.916723814066}) '
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066.})

ERROR: [string "Console"]:1: unfinished string near ''104.916723814066.}) '
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066,})

ERROR: [string "Console"]:1: unfinished string near ''104.916723814066,}) '


I wondered if anyone fancied giving me a few pointers or helping me work out where I have gone wrong?

Kind Regards

Butch




Owllord -> RE: Adding Aircraft LUA Script Help (6/8/2017 8:21:14 AM)

I am not sure, but could the missing space before latitude be causing the issue?




Rory Noonan -> RE: Adding Aircraft LUA Script Help (6/8/2017 9:47:00 AM)


quote:

Guys once again I stand before you, cap in hand,

Im looking to tap into your LUA knowledge. I want add a aircraft inflight, so I used the search function and found the following post by gunner98

ScenEdit_AddUnit({type='Ship', side='NATO Support', name='AOE 6 Supply', dbid='490', heading='240', latitude='55.3474463444513', longitude='-35.1083051655598'})

Just change up everything inside the '..' to what you need. You can get the Lat/Long by clicking your mouse on the map where you want it - leave the pointer there and use the hotkey 'Ctrl x', it is now in your computers clipboard and you can paste it.



So I tried that changing it too:

ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066'})

I tried that various things as below, I wondered where the aircrafts altitude is added in so I tried adding that in as well, but got the following results:

>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066'})

ERROR: Sequence contains no matching element
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066' altitude='5000'})

ERROR: [string "Console"]:1: '}' expected near 'altitude'

Missing a comma after the longitude value.

quote:


>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066','5000'})

ERROR: Sequence contains no matching element

The altitude key needs to be specified: altitude=5000

quote:


>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066})

ERROR: [string "Console"]:1: unfinished string near ''104.916723814066}) '

the value for longitude is missing a ' -- you can either add an extra ' or get rid of the one that's already there (numbers in this table don't need quote marks, just strings)

quote:


>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066.})

ERROR: [string "Console"]:1: unfinished string near ''104.916723814066.}) '
>> ScenEdit_AddUnit({type='aircraft', side='A', name='OV-10A Bronco', dbid='3007', heading='240',latitude='19.1811289766319', longitude='104.916723814066,})

ERROR: [string "Console"]:1: unfinished string near ''104.916723814066,}) '


Same issue.

It gets easier with practice!




stilesw -> RE: Adding Aircraft LUA Script Help (6/8/2017 2:52:51 PM)

This works for me:

ScenEdit_AddUnit({
type = 'Aircraft',
name = 'MiG-29K Fulcrum',
loadoutid = 16934,
heading = 0,
dbid = 3320,
side = 'Red',
latitude='39.2',
longitude='18.7',
altitude="36000 ft",
autodetectable="false",
holdfire="false",
loadoutid=17526,
proficiency=4
})

-Wayne




butch4343 -> RE: Adding Aircraft LUA Script Help (6/9/2017 10:00:34 AM)

Guys, just wanted to say, a thousand thank you’s for the help, I really mean that.
I ended up using Waynes code, and bit by bit I managed to get it to do what I wanted.
BTW Wayne, there appears to be two loadout IDs in your code, that threw me a little to start with [;)]

But genuinely one and all, thanks again for the help.

No doubt Ill be back scrounging up help shortly lol

Butch




Rory Noonan -> RE: Adding Aircraft LUA Script Help (6/9/2017 10:15:43 AM)

No trouble at all butch; for real time help there's a few Lua wizards on the CMANO discord at: https://discord.gg/zbJyQAX




mikmykWS -> RE: Adding Aircraft LUA Script Help (6/9/2017 11:12:34 AM)

Good job guys!

Mike




stilesw -> RE: Adding Aircraft LUA Script Help (6/9/2017 2:07:00 PM)

Butch,

Yup, my oversight! Don't need both loadoutids. I was changing stuff and left one in. With two I believe it uses the second one encountered.

-Wayne




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.310547