Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

New 15.1 Lua

 
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 >> Lua Legion >> New 15.1 Lua Page: [1]
Login
Message << Older Topic   Newer Topic >>
New 15.1 Lua - 3/21/2019 8:46:18 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I thought I might just show examples of some of the commands introduced with 15.1...and check CommandLua at same time . This might take a few days.
--
Sample scenario run commands on

Attachment (1)

< Message edited by michaelm75au -- 3/24/2019 1:02:42 AM >


_____________________________

Michael
Post #: 1
RE: New 15.1 Lua - 3/21/2019 8:51:30 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Play a sound effect from the sound\effects folder
ScenEdit_PlaySound('airplane_takeoff.mp3')

==============
Create a scenario attachment as a sound file and use it from AttachmentRepo
ScenEdit_UseAttachment('d86f4e24-7af0-48e8-ae1b-a02f574ce90e')

==============

_____________________________

Michael

(in reply to michaelm75au)
Post #: 2
RE: New 15.1 Lua - 3/21/2019 9:23:11 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Handle multiple fuel sources on a unit

local plane = ScenEdit_GetUnit({name='fight #1', guid='30184f60-768b-4e2e-847d-19c97289357e'})
print(plane.fuels) -- all sources of fuel (main tank and a drop tank)

local fuel = plane.fuel

print 'Start'
print(fuel)
for i, tank in ipairs(plane.fuels) do
print("Tank #" .. i)
print(tank)
end

print 'Set ' -- overall fuel level across all sources with the requested fuel type
plane = ScenEdit_SetUnit({name='fight #1', guid='30184f60-768b-4e2e-847d-19c97289357e', fuel={{2001,800}} })
print(plane.fuel)
for i, tank in ipairs(plane.fuels) do
print("Tank #" .. i)
print(tank)
end

print(plane.fuels) -- whats left

--------------
And using the wrapper to spread the new fuel level
local plane = ScenEdit_GetUnit({name='fight #1', guid='30184f60-768b-4e2e-847d-19c97289357e'})
print( plane.fuels)
local f = plane.fuel
f[2001].current = 800
plane.fuel = f
print( plane.fuels)

< Message edited by michaelm75au -- 3/21/2019 10:08:01 AM >


_____________________________

Michael

(in reply to michaelm75au)
Post #: 3
RE: New 15.1 Lua - 3/22/2019 8:31:11 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Using export to create an INST file in the normal folder (ImportExport)
ScenEdit_ExportInst('sidea', {'9506a165-6e44-40dd-b721-f9c07e056bdb'}, {filename='myCVBG.inst',name='CVBG'})

And using import to retrieve it
ScenEdit_DeleteUnit({name='CVN BG', guid='9506a165-6e44-40dd-b721-f9c07e056bdb'},true)
ScenEdit_ImportInst('sidea', 'myCVBG.inst')


_____________________________

Michael

(in reply to michaelm75au)
Post #: 4
RE: New 15.1 Lua - 3/22/2019 8:52:21 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Updating unit in game from a INI
ScenEdit_UpdateUnit({guid='c866539a-664c-48b2-88e3-be8e32514320',mode='delta', file='local delta.ini'})

Sample INI


Attachment (1)

_____________________________

Michael

(in reply to michaelm75au)
Post #: 5
RE: New 15.1 Lua - 3/24/2019 2:13:36 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Display a message, and set the 'jump' location.
ScenEdit_SpecialMessage('sidea','Life raft' ,{latitude='33.8495760280169', longitude='136.796207690362'})

_____________________________

Michael

(in reply to michaelm75au)
Post #: 6
RE: New 15.1 Lua - 3/24/2019 2:16:45 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Shows a list of selected/highlighted units

local units = ScenEdit_SelectedUnits()
print(units)
{ units = { [1] = { name = 'fight #1', guid = '30184f60-768b-4e2e-847d-19c97289357e' }, [2] = { name = 'Tanker #1', guid = '1530d502-69b2-4fa6-9145-c1f55dd39701' }, [3] = { name = 'Tanker #2', guid = 'd5eedc59-2541-4b7a-b540-607e84e579f8' }, [4] = { name = 'Looking #2', guid = '2cd64757-1b66-4609-ad56-df41bee652e5' } } }

_____________________________

Michael

(in reply to michaelm75au)
Post #: 7
RE: New 15.1 Lua - 3/31/2019 5:54:07 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Pass some data from scenario to scenario in a campaign.

The attached file has a campaign and 2 scenarios.
Load the campaign.
The first scenario has an action that sets a key to 150.
The second scenario has an action that will read the the passed key and show it.
Just cancel the campaign after the second scenario.

Note that playing in standalone mode might cause an error if you trying to use/save a 'campaign' key. Designers should cater for this.

--
I can't see a Lua method that shows if the scenario is in Campaign mode or not. One way to test could be to try saving a key value in campaign mode; you should get back an error if it is not in that mode.
Also note that this should not be abused. Putting too much into the campaign key store might cause performance/memory issues.

Attachment (1)

< Message edited by michaelm75au -- 3/31/2019 6:10:35 AM >


_____________________________

Michael

(in reply to michaelm75au)
Post #: 8
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> New 15.1 Lua 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.813