Lua question- unit firing etc.

Campaign Series: Vietnam is a new turn-based, tactical/operational war game that focuses on the Indochina War, Vietnam Civil War and the first years of US involvement in Vietnam with over 100 historical scenarios.

Moderator: Jason Petho

Post Reply
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Lua question- unit firing etc.

Post by carll11 »

Hi Gents, I am using the 671104 hill 1338 as my start point for a new (2nd) created scn..

In the scn file I have created the files in use read;

VN_671104_Hill_1338.map
VN_671104_Hill_1338.org
Dak To-Battle for the Mountains.ai
Dak To-Battle for the Mountains.lua

Funny thing is, there is no lua file by that name when I perform a search. Is the Dak To-Battle for the Mountains.lua a place holder for lack of a better term?

This is my 2nd go round on this, first game I created I used the same start scn. 671104 hill 1338 , I got messages when I took a place and held it according to the vn_ 671104 Hill 1338 lua.....

So, when I start to play does the scn. use the lua for vn_ 671104 Hill 1338? Because, this is what I see in a saved game file for that scn;

VN_671104_Hill_1338.map
VN_671104_Hill_1338.org
VN_671104_Hill_1338.ai
VN_671104_Hill_1338.lua

Thats fine, but I had an issue, some nva units would not fire when I had US units next to them that were firing on them.....

Is there a lua code line preventing that?
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: Lua question- unit firing etc.

Post by berto »

I don't quite understand. You yourself have created a

Dak To-Battle for the Mountains.lua

file, yes? Whether by copying the stock VN_671104_Hill_1338.lua file or by some other means.

About the NVA not firing, wouldn't this explain it?

https://www.matrixgames.com/forums/view ... 0#p4988050

Probably the NVA, all or in part, are under a hold() order.
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Re: Lua question- unit firing etc.

Post by carll11 »

No sir, I did not create a/the lua 'Dak To-Battle for the Mountains', it just appeared in the new scn. file I named as the title of my scenario 'Dak To-Battle for the Mountains' .

I searched for it, it doesn't physically exist, perhaps its a placeholder generated automatically because the scn. file requires at least a name of map, org. ai and lua 'file'. :?:
I didn't create a Dak To-Battle for the Mountains.ai either yet theres a file name there for it 🤷

When my 1st try at editing this scn. was played, when you go into the save game file, the lua listed is VN_671104_Hill_1338, so apprenrtly the scn. points itself back at the 'parent' scn.? And names the AI. file for the 'parent' scenario as well, which is VN_671104_Hill_1338.....

So, the other issue, the units not firing, yes, I created the unleash order yes, wasn't aware there was even a hold fire order as in hold()...thx!
User avatar
Jason Petho
Posts: 17652
Joined: Tue Jun 22, 2004 10:31 am
Location: Terrace, BC, Canada
Contact:

Re: Lua question- unit firing etc.

Post by Jason Petho »

No sir, I did not create a/the lua 'Dak To-Battle for the Mountains', it just appeared in the new scn. file I named as the title of my scenario 'Dak To-Battle for the Mountains' .

I searched for it, it doesn't physically exist, perhaps its a placeholder generated automatically because the scn. file requires at least a name of map, org. ai and lua 'file'. :?:
I didn't create a Dak To-Battle for the Mountains.ai either yet theres a file name there for it 🤷
Ah yes, it will just create the reference to it in the scenario file (the same as the AI file), but you still have to generate the lua file using CSLINT. It does not do it automatically.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: Lua question- unit firing etc.

Post by berto »

carll11 wrote: Tue Apr 26, 2022 12:51 pm
I searched for it, it doesn't physically exist, perhaps its a placeholder generated automatically because the scn. file requires at least a name of map, org. ai and lua 'file'. :?:
I didn't create a Dak To-Battle for the Mountains.ai either yet theres a file name there for it 🤷
Strictly speaking, there is no absolute requirement to have either a .ai file or a .lua file. A scenario will work without them.

Yes, the scenario editor will set placeholder .ai * .lua file names in the generated .scn file. But it is up to you to create those files.

In most cases, you will not need to create a scenario .ai file; the overall init.ai file (in the top-level game folder should suffice). If you need to tweak a few specific AAI parameters, best to do it in the .lua file, as described here:

https://www.matrixgames.com/forums/view ... 0&t=378941

A scenario .lua file is optional. But without it, the AI will be under control of the EAI (Engine AI). How to make scenario Lua files will be made clearer at some future date.
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Re: Lua question- unit firing etc.

Post by carll11 »

Ah, I see ( I think) okay then thank you both.

I searched the lua for hill 1338 no hold() on fire I could see, I just find it curious way any unit would not fire back when adjacent to a unit and being fired upon :ugeek:

So, I guess a question to wrestle with would be, do I delete the lua file from the scn ?


Oh another q/clarification- the AI file created by the scn file 'Dak To-Battle for the Mountains.ai' , will it work and enact the EAI OR do I need to rename it 'init.ai' ?
User avatar
Jason Petho
Posts: 17652
Joined: Tue Jun 22, 2004 10:31 am
Location: Terrace, BC, Canada
Contact:

Re: Lua question- unit firing etc.

Post by Jason Petho »

carll11 wrote: Tue Apr 26, 2022 10:14 pm
Oh another q/clarification- the AI file created by the scn file 'Dak To-Battle for the Mountains.ai' , will it work and enact the EAI OR do I need to rename it 'init.ai' ?
If the Dak To-Battle for the Mountains.ai is not found in the Scenarios folder, it will automatically default to the init.ai file.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: Lua question- unit firing etc.

Post by berto »

In your CSVN scenario modding explorations, do not concern yourself with custom, scenario .ai files in any way. The general init.ai file will handle everything.
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Re: Lua question- unit firing etc.

Post by carll11 »

Thank you gentleman!
User avatar
Crossroads
Posts: 18484
Joined: Sun Jul 05, 2009 8:57 am

Re: Lua question- unit firing etc.

Post by Crossroads »

I'd recommend to access / tweak scenario's Adaptive AI parameters via Lua as well, see my blog about that:

https://cslegion.com/developer-diary/ca ... aptive-ai/
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < v2.10.20 Available Now (Dec 03, 2025)
CS: Middle East 1948-1985 < v3.10.20 Available Now (Dec 03, 2025)
Post Reply

Return to “Campaign Series: Vietnam”