lua

Post new scenarios and mods here to share with other gamers.

Moderator: Campaign Series Matrix Edition Development Group

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

lua

Post by carll11 »

this is whats n the lua now-

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


I 'think' I read your past post on this and f I want to cut the units loose, I can;


function battle_plan_b (turn, side)

-- standard orders, uncomment as necessary:
if turn == 2 then
-- (unleash({215})
end

I did this some units are moving, some not,

The units I froze naturally arn't moving that fine but when I move up against them and fire on them etc., they dont fire back....nor move.....my understanding was when I used 'unleash' them, the 'standard' AI would take over they would fire and move etc.?
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: lua

Post by berto »

Yes, all correct. Note:
  • hold() -- indicated units put on hold, no movement, no fire
  • halt() -- no movement, but may opfire
  • unleash() -- nullifies any previous hold() or halt() order; handed over to the EAI (Engine AI) unless subsequent SAI (Scripted AI) orders are applied
For further info, see Manual/LUA_FUNCTIONS_REFERENCE.txt.
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
Jason Petho
Posts: 16742
Joined: Tue Jun 22, 2004 10:31 am
Location: Terrace, BC, Canada
Contact:

Re: lua

Post by Jason Petho »

You'll want the unleash to look like this though, removing the -- from the unleash line:


-- standard orders, uncomment as necessary:
if turn == 2 then
unleash({215})
end
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Re: lua

Post by carll11 »

thank you!!!

Do I need to restart the game re; making the lua edit? or change the turn number to the next turn perhaps?
User avatar
Jason Petho
Posts: 16742
Joined: Tue Jun 22, 2004 10:31 am
Location: Terrace, BC, Canada
Contact:

Re: lua

Post by Jason Petho »

You should be able to change the turn number in that case.
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Re: lua

Post by carll11 »

ops one last thing, there always is I guess;

I am getting a lua load error ID 3000...I copied the lua to an excel, tried to suss it out regards the line error,

'expected (to close'('at line 2359) near 'end'

2359 happens to be the unleash line, see image, is my spacing etc. and text correct?
Attachments
IMG_4562.JPG
IMG_4562.JPG (85.87 KiB) Viewed 632 times
User avatar
carll11
Posts: 955
Joined: Thu Nov 26, 2009 2:07 pm

Re: lua

Post by carll11 »

one last item, I did extend the games turns to 129 from 75, ...I know that will matter re; points awarded after the normal end of the scn. template hill 1338 lu etc...thats fine....just wondering if its has any other effect re; the lua and gameplay or script issues?
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: lua

Post by berto »

carll11 wrote: Sun Apr 17, 2022 5:29 pm ops one last thing, there always is I guess;

I am getting a lua load error ID 3000...I copied the lua to an excel, tried to suss it out regards the line error,

'expected (to close'('at line 2359) near 'end'

2359 happens to be the unleash line, see image, is my spacing etc. and text correct?
The leading ( before unleash() is a mistake, most definitely.

So it should more properly be something like this:

if turn == 7 then
unleash({215})
end

Note that the CSEE is forgiving, auto-corrects fiddly little things as necessary. The unleash() function calls for a list of trackids as inputs. Which you have done properly (where {215} is a list with a single member). But this also would work:

if turn == 7 then
unleash(215)
end

In that second example, the input is a trackid, not a list of trackids. Nevertheless, while not formally correct, it is still acceptable. I will have more to say about this sort of thing in future.
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
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: lua

Post by berto »

carll11 wrote: Sun Apr 17, 2022 5:35 pm one last item, I did extend the games turns to 129 from 75, ...I know that will matter re; points awarded after the normal end of the scn. template hill 1338 lu etc...thats fine....just wondering if its has any other effect re; the lua and gameplay or script issues?
Off the top of my head, I can think of possible Ammo and Arty Ammo issues. That is, unless you take steps to offset the steady decline of those supply values, by the end of a 129 turn scenario, they might decline down to 0. There might be other issues.

Jason designed the scenario and knows it firsthand. Thoughts, Jason?
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

Post by carll11 »

Thank you Berto...!I'll remove the wayward parenthese(sp) , singular lol...

edit, yup, that did the trick, no error.... :D U da man....
Post Reply

Return to “Scenario Design and Modding”