Page 1 of 1
lua
Posted: Sun Apr 17, 2022 2:55 pm
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.?
Re: lua
Posted: Sun Apr 17, 2022 3:30 pm
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.
Re: lua
Posted: Sun Apr 17, 2022 3:31 pm
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
Re: lua
Posted: Sun Apr 17, 2022 4:12 pm
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?
Re: lua
Posted: Sun Apr 17, 2022 5:08 pm
by Jason Petho
You should be able to change the turn number in that case.
Re: lua
Posted: Sun Apr 17, 2022 5:29 pm
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?
Re: lua
Posted: Sun Apr 17, 2022 5:35 pm
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?
Re: lua
Posted: Sun Apr 17, 2022 6:06 pm
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.
Re: lua
Posted: Sun Apr 17, 2022 6:09 pm
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?
Re: lua
Posted: Sun Apr 17, 2022 6:34 pm
by carll11
Thank you Berto...!I'll remove the wayward parenthese(sp) , singular lol...
edit, yup, that did the trick, no error....

U da man....