Ghosts in the Machine?

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
vettim89
Posts: 3744
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

Ghosts in the Machine?

Post by vettim89 »

I have no idea what is happening. In the scenario I am designing I have an event with a random trigger set for 1:15 to 1:30 after the scenario starts. The event has the following action


local unit=ScenEdit_GetUnit({side='US/UK/Poland', name='MV Canyon', guid='939c1135-c810-47b7-85cd-45681981bc2a'} )
ScenEdit_AddExplosion({warheadid=317,lat=unit.latitude, lon=unit.longitude, altitude=unit.altitude})
ScenEdit_SetUnitDamage({side='US/UK/Poland', name='MV Canyon', guid='939c1135-c810-47b7-85cd-45681981bc2a', dp=1420, flood=3, fire=2})
ScenEdit_MsgBox('SIGINT indicates that a coalition merchant ships has been struck in the Western Baltic.\n\nThe only possible explanation is that a German submarine in the area initiated hosilities rather than let the target escape.\n\n Commence your attack immediately! WEAPONS FREE', 1)
ScenEdit_SetSidePosture('EurCon', 'US/UK/Poland', 'H')
ScenEdit_SetSidePosture('US/UK/Poland', 'EurCon', 'H')
ScenEdit_AssignUnitToMission('48c2b130-41e6-494a-b4e8-c7a84d9029c7', 'TF22.1.3 Transit')

In the process of making sure the event worked as desired I copied the action into the lua console and ran it. I then reloaded the scenario and made any changes necessary. Saved the scenario and repeated.

My problem is that every time I start the scenario, the action runs and the merchant dies. The log does not show that the event fired. In fact the log shows nothing at all. Its like the game is remembering the test runs I ran through the console and repeats it as soon as I hit start. Did I make the mistake of saving the game while lua was running the action during my test and the action is now a permanent part of the scenario? I tried restarting the computer just to be sure nothing was hanging in the cache or memory and it didn't help.

I am flummoxed.
"We have met the enemy and they are ours" - Commodore O.H. Perry
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Ghosts in the Machine?

Post by michaelm75au »

The scen file to check???
Michael
User avatar
vettim89
Posts: 3744
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

RE: Ghosts in the Machine?

Post by vettim89 »

File attached. I deleted MV Canyon and inserted a new unit with a slightly different name. Copied the new name and GUID into the action and it is still happening. No notification that the event fired. The action just spins off on its own
Attachments
cauldron.zip
(161.11 KiB) Downloaded 11 times
"We have met the enemy and they are ours" - Commodore O.H. Perry
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Ghosts in the Machine?

Post by michaelm75au »

I loaded the scen and ran it until 08:28 (trigger being random time between 8:15pm and 8:45pm) when the event fired and I got a popup about 'weapons free'.
(using latest release build)
Michael
User avatar
vettim89
Posts: 3744
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

RE: Ghosts in the Machine?

Post by vettim89 »

Thanks Michael. I think the lua script was stuck in the buffer on my machine. I ran it and let the action go off which was immediate. Then I deleted/inserted the unit and entered the new GUID into the action and it is now WAD. Odd behavior but easily solved
"We have met the enemy and they are ours" - Commodore O.H. Perry
Post Reply

Return to “Lua Legion”