Page 1 of 2
add ons in scenerios etc.
Posted: Sat Mar 19, 2022 10:46 pm
by carll11
So I added a unit to one side in a scn., but when I played the game the units did not move...I was under the impression the objectives enemy held obj.s were always the default, that is units added to a scen. will naturally go after the closest enemy held objectives?
Re: add ons in scenerios etc.
Posted: Sat Mar 19, 2022 11:49 pm
by Jason Petho
Is it an existing scenario?
Your scenario?
Details, details.
Re: add ons in scenerios etc.
Posted: Sat Mar 19, 2022 11:55 pm
by berto
If the side is scripted, without assigning SAI orders to any new units they will likely not move. Why? It's because a standard opening (in the scenario .lua script) is to
hold(<all side units>) -- don't do anything, not even fire
or
halt(<all side units>) -- don't move, but may shoot
After that, units -- including any newly added ones -- would be assigned orders on an individual or parent formation basis.
Note that you can override the hold() or halt() orders by means of
unleash(<trackid #>) -- follow the EAI (Engine AI) orders
in which case such unleashed units will, as you suppose, pursue objectives, else enemy units, in the former unscripted Campaign Series manner.
We will start a forum thread/series explaining the ins & outs of the CSEE/SAI scripting sometime soon.
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 2:02 am
by carll11
Jason yes it was an existing scn...sorry for not adding that.
Berto-
are you saying I can add this verbiage to the lua;
unleash(<trackid #>) -- follow the EAI (Engine AI) orders
where would I add that?
does it go somewhere in ;
function battle_plan_b (turn, side)
-- standard orders, uncomment as necessary:
if turn == 1 then
-- all Side B units hold initially (or maybe use halt())
hold(ALLB)
end
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 2:11 am
by berto
carll11 wrote: Sun Mar 20, 2022 2:02 am
are you saying I can add this verbiage to the lua;
unleash(<trackid #>) -- follow the EAI (Engine AI) orders
where would I add that?
does it go somewhere in ;
function battle_plan_b (turn, side)
-- standard orders, uncomment as necessary:
if turn == 1 then
-- all Side B units hold initially (or maybe use halt())
hold(ALLB)
end
Yes. Imediately after that, you might add something like
if turn == 1 then
unleash(215)
end
if the unit in question has a trackid # of 215. (And is a Side B unit. Add that code in battle_planb_() or battle_plan_a() as appropriate.) (unleash({215}) would also work, and is more formally correct. To be explained in future.) Thereafter, that unit would be totally free of the SAI, would follow the dictates of the game engine EAI (over which you have no control).
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 4:12 am
by Jason Petho
Don't forget the new unit needs to be added to the scenario lua file as well (where all the other units are listed).
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 2:29 pm
by carll11
Jason.....Holy
I added an entire NVA regt.....
I would have to add teach coy. as, wiht the hex #'s etc.?;
ex;
C1_D1_R33_NVA_RIFLE_COY_64_AK_A_SVN_176
do local units = difference(_C1_D1_R33_NVA_RIFLE_COY_64_AK_A_SVN_176,{181,182})
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 3:07 pm
by Jason Petho
Yes, that is correct. You need any of the text that is after -- on the unit line, those are commented out anyway. But the name and id in the same format as the others will be important.
But unit, I thought you were just adding a platoon! *chuckles* Sorry!
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 3:07 pm
by carll11
well I tried the lua edit, but as jason said, ti appears if the units arent in there they wont respond and haven't.
Can I cut the lua loose from the scn.?
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 3:18 pm
by Jason Petho
I presume you renamed the scenario to something other than the original file?
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 3:35 pm
by Jason Petho
If you show me the org file, I can help with adding the units to your lua file
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 4:15 pm
by carll11
HI J;
No I didnt rename it.
I made copys of the scn and all the other files ( LZ albany) for safe keeping naturally.
Then I add an NVA regt. to the org. Placed them on the map, extended the scn. length ( I figured out you had to do that numerous times in the scn. lines or it would error out).
I made the code change Berto suggested and viola', the units I added are moving and attacking.....my bad earlier was trying to change it mid scn. instead of starting the game all over again, I should have known better but I haven't worked with the CS data/code scenario creation in a very long time....
Further Q- if I add other objectives I 'assume' the units will take those into consideration too or are there Lua code changes I need to make? OR, Does the AI or game engine figure out objective priorities as well?
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 4:27 pm
by Jason Petho
Unfortunately, if you add additional Objectives, it will mess with the Objective count in the Lua file, making the current scripts and objectives be broken.
Unless you go in and renumber all "OBJECTIVES[1]" (and all the other objectives) to whatever the new Objective number might be (which you could identify using MAP HINTS.
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 4:47 pm
by carll11
do you mean adding Obj. hexes etc. ;
from the :Lua;
OBJECTIVES = {}
OBJECTIVES[1] = "40,22" -- 1-12[20/10] 21
my add line example;
OBJECTIVE[2]_AREA= add my hex # --what does the rest of the code mean? 1-12? and 21 ( the 20/10 are the points values I believe? I can a keep them what I want based on what I want them to take re; priority?)
And from the lua;
LZ_ALBANY_AREA = hexes_within(OBJECTIVES[1], NODIR, 2)
my add line example;
LZ_ALBANY_AREA = hexes_within(OBJECTIVES[2], NODIR, 2)
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 5:17 pm
by Jason Petho
When you an objective, you will change the numbering of how the objectives are listed in the lua file.
Which means you'll need to change the numbering to suit (only if you add new objectives)
Here is an example from the giong dinh scenario on how to identify the numbers.
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 5:22 pm
by Jason Petho
So, if you add a new one, you will need to most likely RENUMBER the old ones so they are still relevant.
Looking at the Objectives in the Giong Dinh lua file, you will see how they are organized. The ID, the location and the values.
If you add a new one, you have to renumber the Objectives (they are number from left to right and top to bottom)
So if you added an objective to the west, then
OBJECTIVES[1] = "10,31" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21
Would become
OBJECTIVES[2] = "10,31" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21
in the modified file.
Re: add ons in scenerios etc.
Posted: Sun Mar 20, 2022 5:28 pm
by carll11
Ahhhh, I see....when I am done with this play thru, I'll tinker, thank you!!!!
Oh hold up; in your typing you wrote;
OBJECTIVES[2] = "10,31" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21
shouldnt 10 31 be the new hex # 12 29?
Re: add ons in scenerios etc.
Posted: Mon Mar 21, 2022 2:46 pm
by KEYSTONE0795
"We will start a forum thread/series explaining the ins & outs of the CSEE/SAI scripting sometime soon."
Please do. For me, I get the most enjoyment from tinkering with a scenario after I've played it. A comprehensive lua/event engine tutorial will add years to the longevity of this title and create more anticipation for DLC's and new titles.
I've been playing Campaign Series since the original Talonsoft release. So pleased to be still playing it even after my retirement!!!!!!!
Re: add ons in scenerios etc.
Posted: Mon Mar 21, 2022 3:29 pm
by Jason Petho
carll11 wrote: Sun Mar 20, 2022 5:28 pm
Ahhhh, I see....when I am done with this play thru, I'll tinker, thank you!!!!
Oh hold up; in your typing you wrote;
OBJECTIVES[2] = "10,31" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21
shouldnt 10 31 be the new hex # 12 29?
No.
The screenshot above is without any changes, it is the stock file.
But, as I suggested, if you add an objective to the west, the listing would then look like this:
OBJECTIVES[1] = "8,10" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21 -- THIS IS THE NEW OBJECTIVE
OBJECTIVES[2] = "10,31" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21 -- THIS IS THE RENUMBERED OLD OBJECTIVE
OBJECTIVES[3] = "12,29" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21 -- THIS IS THE RENUMBERED OLD OBJECTIVE
OBJECTIVES[4] = "13,28" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21 -- THIS IS THE RENUMBERED OLD OBJECTIVE
OBJECTIVES[5] = "14,25" -- 1-5[3/3] 6-11[4/4] 12-14[5/5] 21 -- THIS IS THE RENUMBERED OLD OBJECTIVE
Keep in mind that any of the old objective numbers will still be referenced in the lua file down below, so you'll have to go through all lua file and replace each OBJECTIVES[#] with the appropriate number.
Hopefully that clears that up?
Re: add ons in scenerios etc.
Posted: Mon Mar 21, 2022 3:35 pm
by Jason Petho
KEYSTONE0795 wrote: Mon Mar 21, 2022 2:46 pm
"We will start a forum thread/series explaining the ins & outs of the CSEE/SAI scripting sometime soon."
Please do. For me, I get the most enjoyment from tinkering with a scenario after I've played it. A comprehensive lua/event engine tutorial will add years to the longevity of this title and create more anticipation for DLC's and new titles.
I've been playing Campaign Series since the original Talonsoft release. So pleased to be still playing it even after my retirement!!!!!!!
With the 1.10 UPDATE, I did start filling in the section 8.5 of the manual. That's a good starting point about what the lua file is and how it works.
I'll be making some videos in the future as well to provide some insight.