Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Adding Aircraft LUA Script Help

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Adding Aircraft LUA Script Help Page: [1]
Login
Message << Older Topic   Newer Topic >>
Adding Aircraft LUA Script Help - 6/8/2017 7:57:01 AM   
butch4343

 

Posts: 327
Joined: 3/26/2015
Status: offline
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
Post #: 1
RE: Adding Aircraft LUA Script Help - 6/8/2017 8:21:14 AM   
Owllord


Posts: 96
Joined: 7/15/2014
From: Tokyo, Japan
Status: offline
I am not sure, but could the missing space before latitude be causing the issue?

(in reply to butch4343)
Post #: 2
RE: Adding Aircraft LUA Script Help - 6/8/2017 9:47:00 AM   
Rory Noonan

 

Posts: 2816
Joined: 12/18/2014
From: Brooklyn, NY
Status: offline

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!

(in reply to butch4343)
Post #: 3
RE: Adding Aircraft LUA Script Help - 6/8/2017 2:52:51 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
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


< Message edited by stilesw -- 6/8/2017 2:53:21 PM >

(in reply to butch4343)
Post #: 4
RE: Adding Aircraft LUA Script Help - 6/9/2017 10:00:34 AM   
butch4343

 

Posts: 327
Joined: 3/26/2015
Status: offline
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

(in reply to butch4343)
Post #: 5
RE: Adding Aircraft LUA Script Help - 6/9/2017 10:15:43 AM   
Rory Noonan

 

Posts: 2816
Joined: 12/18/2014
From: Brooklyn, NY
Status: offline
No trouble at all butch; for real time help there's a few Lua wizards on the CMANO discord at: https://discord.gg/zbJyQAX

(in reply to butch4343)
Post #: 6
RE: Adding Aircraft LUA Script Help - 6/9/2017 11:12:34 AM   
mikmykWS

 

Posts: 11524
Joined: 3/22/2005
Status: offline
Good job guys!

Mike

_____________________________


(in reply to Rory Noonan)
Post #: 7
RE: Adding Aircraft LUA Script Help - 6/9/2017 2:07:00 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
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

(in reply to butch4343)
Post #: 8
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Adding Aircraft LUA Script Help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.781