Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Two quick LUA Questions

 
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 >> Two quick LUA Questions Page: [1]
Login
Message << Older Topic   Newer Topic >>
Two quick LUA Questions - 5/2/2019 3:26:08 PM   
rmunie0613

 

Posts: 202
Joined: 1/2/2018
Status: offline
1- Trying to unload cargo (ground forces) from a city when opposing ground forces are spotted inside a zoe around it.

>> ScenEdit_UnloadCargo({name='Structure (Military Base)', guid='505332a4-e257-47f4-8768-9e82b234ee4c'}, [table])
ERROR: [string "Console"]:1: unexpected symbol near '['
>> ScenEdit_UnloadCargo({name='Structure (Military Base)', guid='505332a4-e257-47f4-8768-9e82b234ee4c'})
ERROR: [string "Console"]:1: invalid arguments to method call

I seem to be missing a step,uncertain what it is though.

2- Attempting to have reloads available to Iranian SSM sites... I used the de record number (924) here for the weapon record...the following error keeps coming..
>> ScenEdit_GetUnit({name='Ammo Bunker (Underground)', guid='ec233bbf-baa9-4d32-878c-1019bf9e76b8'})

>> ScenEdit_AddWeaponToUnitMagazine(924)


ERROR: [string "Console"]:1: invalid arguments to method call

Any help with either greatly appreciated, thank you
~Ron
Post #: 1
RE: Two quick LUA Questions - 5/3/2019 3:43:16 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
1. For unloading cargo, you need to supply what to unload - ScenEdit_UnloadCargo (fromUnit, cargoList).
cargoList = List of cargo to unload: table of {guids}, or { { number, (optional) DBID of item}}
ScenEdit_UnloadCargo('505332a4-e257-47f4-8768-9e82b234ee4c', {{2918},'fde7142b-8757-47c0-8170-2748d74132d3'})


2. For adding to magazine - ScenEdit_AddWeaponToUnitMagazine (descriptor) where descriptor describes the weapon and magazine to update.
ScenEdit_AddWeaponToUnitMagazine({unitname='Ammo', w_dbid=773, number=1})

https://commandlua.github.io/index.html#Functions

_____________________________

Michael

(in reply to rmunie0613)
Post #: 2
RE: Two quick LUA Questions - 5/6/2019 12:52:05 AM   
rmunie0613

 

Posts: 202
Joined: 1/2/2018
Status: offline
Thank you! I will try that.

(in reply to michaelm75au)
Post #: 3
RE: Two quick LUA Questions - 5/6/2019 4:45:42 PM   
rmunie0613

 

Posts: 202
Joined: 1/2/2018
Status: offline
OK... I tried the above but (still novice at this sorry lol) got the following
>> ScenEdit_UnloadCargo({name='Structure (Military Base)', guid='505332a4-e257-47f4-8768-9e82b234ee4c'}, {{2406},})
ERROR: [string "Console"]:1: invalid arguments to method call

I realize that I may not be able to do what I had planned- t works with my switching in scenario creation mode to the other side, but obviously the player cannot do that and it would ruin the surprise even if he could..the idea being that the player must land some ground units which must remain inside specified areas for a length of time...and inside a structure "military base" are ground security forces to make it challenge... I want to make it unload certan units (cargo) when the player side enters the area, and possibly reinforcements if the player disposes of the initial security force. I see that there is not a way however to know the guid# for units inside as "cargo" until they already are out as actual uits- none that I can find anyway.

(in reply to rmunie0613)
Post #: 4
RE: Two quick LUA Questions - 5/7/2019 7:51:57 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
ScenEdit_UnloadCargo( '505332a4-e257-47f4-8768-9e82b234ee4c', {{2406},})
You need to just refer to the from unit as a string not a Lua table.

_____________________________

Michael

(in reply to rmunie0613)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Two quick LUA Questions 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.656