Overlord Scenario Playtest Thread

Status
Not open for further replies.
I've included the base save file here, in case I totally mess things up and I have to implore @Prof. Garfield to help me out with the landmass allocation - ;) But only in an emergency.

Also, I assume the changes made to the save file are kept there by the Lua scripts, meaning the Scn file can be made with the landmass info intact?
 

Attachments

  • Overlords Test.sav
    629.7 KB · Views: 41
I put down the markers, filled with interior units, and the filler units sort of worked, but also spread across the entire map to the USA and across to China!

Your 'polygon' has crossed the x=0 line in the map (which occurs near London). The polygon code I wrote can't deal with that. It looks like I have to change that. This is a popular map, and it is very reasonable for polygons to cross the dateline on it, given that it is in Western Europe. What I've given you now will allow you to make polygons that don't cross the dateline, and it shouldn't be too hard to convert Western Europe and Africa to the desired landmass using the function provided.

If you can't figure it out, copy the coordinates that do work (that is, give the polygon you expect when you fill them in) into changeLandmass.lua, and send me that file, along with the coordinates for polygons that don't work, and I'll put this stuff together. It'll be easier for me that way.

First try making polygons for North America, South America, Australia, and any other 'continents' that don't cross the date line.

Also, I assume the changes made to the save file are kept there by the Lua scripts, meaning the Scn file can be made with the landmass info intact?

This changes the info in the game, so you will have to save it again. We're using the Lua console here as a sort of "enhanced cheat mode", so you'll have to treat what we do here the same as if the change terrain cheat option allowed you to change the tile landmass.

I can make the change run as an "event" when the scenario is started if you prefer, once you use the Lua Template, but I don't really see the point of doing it that way in this case.
 
I've overcome the "crossing the dateline" problem while maintaining backwards compatibility. The new files are attached. Instructions are the same as before. If you've had polygons that worked, copy the coordinates out of changeLandmass.lua before replacing the file.
 

Attachments

  • PolygonLandmassCrossDateline.zip
    26 KB · Views: 32
@Prof. Garfield , hi there!

Got the Euro area mapped out with marker units nicely. Ready to post into the Lua script,
but before I do, can you review this console info and let me know if all looks OK?

{{1,53},{1,51},{1,49},{1,47},{1,45},{1,43},{1,41},{1,39},{3,37},{4,34},{6,34},{8,34},{8,32},{12,34},{14,34},{15,33},{17,31},{19,31},{20,32},{21,33},{21,35},{21,37},{21,39},{22,40},{22,42},{22,44},{23,45},{23,47},{23,49},{23,51},{23,53},{22,54},{21,55},{20,56},{18,56},{16,56},{16,54},{14,52},{14,50},{13,49},{12,48},{10,48},{8,48},{7,49},{5,51},{2,52},doesNotCrossThisX=26}

(I'm concerned if this line at the end is normal?)
 
I edited the Lua Changing Landmasses file, and added the poly info into landmass one. All was saved without problems. I reloaded the file and run the Changing Landmasses script...No obvious problems!

I am aiming to slice up the big land masses into sections, something like I have in the map below:
WW2 Map Masses Flat.png

One more thing - I'm assuming I don't have to make use of all the 63 land mass zones? :)

If we can fool CIV2 into thinking the world is made of sections, then the menu crash is gone...
Thanks for coming up with this very ingenious route, Prof!
 
I edited the Lua Changing Landmasses file, and added the poly info into landmass one. All was saved without problems. I reloaded the file and run the Changing Landmasses script...No obvious problems!

You can know for sure if it worked by checking the landmass number beside the tile coordinates.

One more thing - I'm assuming I don't have to make use of all the 63 land mass zones? :)

Correct. It was easiest to put them all in, just in case they were needed. I used a macro to make the list, so no extra time to do them all.

If we can fool CIV2 into thinking the world is made of sections, then the menu crash is gone...

I suppose it is possible the AI will have difficulty moving between continents or something, but it's the AI, so who could tell anyway...
 
Good show! Yep - There is now a "1" after the co-ords everywhere, but I am sure that will change as I assign more landmasses. I will keep everyone posted of my progress.

I am looking forward to learning more of Lua in terms of what it can do in CIV2 - I am thinking I should have jumped in way earlier.

Yourself and @JPetroski are to be seriously commended for pushing ToT to this new level - :)

PS
As for AI, a few "move unit" events can give them a helping hand.
 
@Prof. Garfield , hi there!

Got the Euro area mapped out with marker units nicely. Ready to post into the Lua script,
but before I do, can you review this console info and let me know if all looks OK?

{{1,53},{1,51},{1,49},{1,47},{1,45},{1,43},{1,41},{1,39},{3,37},{4,34},{6,34},{8,34},{8,32},{12,34},{14,34},{15,33},{17,31},{19,31},{20,32},{21,33},{21,35},{21,37},{21,39},{22,40},{22,42},{22,44},{23,45},{23,47},{23,49},{23,51},{23,53},{22,54},{21,55},{20,56},{18,56},{16,56},{16,54},{14,52},{14,50},{13,49},{12,48},{10,48},{8,48},{7,49},{5,51},{2,52},doesNotCrossThisX=26}

(I'm concerned if this line at the end is normal?)

Somehow I missed this earlier. Yes, this looks fine, although you don't need to have every tile there. (That is, for example, you could mark {1,53}, {1,39} and skip the squares between them, although it doesn't matter if you keep them.) The doesNotCrossThisX=26 is how I decided to maintain backwards compatibility in the General Library. (My third Lua lesson explains Lua Tables.) It should be set to a value of X that corresponds to a vertical line of tiles in the map that this particular polygon does not cross. If it is not there, it is assumed to be 0, which maintains backwards compatibility. The code for making polygons looks at the coordinates, and tries to determine a suitable value for doesNotCrossThisX. It assumes that the line segment between 2 adjacent polygon corners took the shorter route around the world to get there, excludes the x values between those two points on the shorter route from consideration for the "doesNotCrossThisX" value, and then picks a value from the remaining x values available. If the polygon does not behave as expected, add a few extra corners in any particularly long edges.
 
Hi there, @Prof. Garfield !

I started fresh and assigned the German/Euro landmass to poly 4, I laid the corner markers and interior units with no probs. I then copied the console co-ords to the changelandmass.Lua file using my usual text editor "Sc1".
I reloaded the save, and run the newly saved script, but europe is still showing as landmass poly 1. Seems my changes didn't take hold.

I'm using the Lua folder in the ToT directory, and my save is in my Overlords folder in the same directory. I haven't added all the Lua core folders into Overlords folder yet, as I was dealing with the map before tackling events.
Short version - Should the changelandmass file be in the same folder area as the save?

Here is how the console data looks in my editor...
landmass1.png
 
Just to make sure we're both on the same page, I've attached all 3 files again, but renamed with a 2 at the end. Extract them into your Lua folder, and follow the same instructions as before. By renaming the files, you won't lose any polygon coordinates you've defined.

I'm using the Lua folder in the ToT directory, and my save is in my Overlords folder in the same directory. I haven't added all the Lua core folders into Overlords folder yet, as I was dealing with the map before tackling events.
Short version - Should the changelandmass file be in the same folder area as the save?

OK, keep it as you have it now. It doesn't actually matter where the changelandmass file is, but keep them all in the lua folder under your TOT directory. It is important that the generalLibrary2.lua file is there. After you "load script" changeLandmass2.lua, you may have to move the cursor to see that the change took place.
 

Attachments

  • landmass2.zip
    26.1 KB · Views: 29
@Prof. Garfield !
Getting somewhere now - I loaded the new scripts, and USA is poly 4, and Spain is poly 5. I added in Germany/Europe as poly 6 - Reloaded and it is now showing a nice "6" on the co-ords.

Hopefully, the menu will only count destinations within the given landmass, and this silly bug can be consigned to the trash heap. Maybe TNO can fix it in some future ToTPP update...

Well - excellent work, and thanks for being patient with my no doubt irritating questions. The good thing is, you have made a Lua believer out of me.
I had a look at some of the potential features available in Lua for the scenario - And how it can solve many limitations in the macro text system.

So onwards and upwards, and thanks once more. :) I'll keep everyone posted on the thread. Time to divide up this map.
 
Calling @JPetroski and @Prof. Garfield !

Been working on laying down the scripts for "canbuildsettings" in Lua, but have hit a barrier...
Upon loading the save, I get this...

error loading module 'canBuildSettings' from file 'N:\CIV2 TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua':
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:186: '}' expected (to close '{' at line 185) near 'unitTypeBuild'
stack traceback:
[C]: in ?
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk

I know there must be a bug in my "canbuildsettings" file, most likely a glaring one, but I probably need some advice here.
Not sure if I am missing something, with the improvements code, and it seems to dislike the line where I restrict building
Ocean Liners to cities with shipyards...Although I cannot see what is wrong...And pointers are most welcome...

Object and Canbuildsettings files attached.
 

Attachments

  • object.zip
    4.1 KB · Views: 27
  • canBuildSettings.zip
    3.6 KB · Views: 30
The problem was that you were missing the closer for the first bracket. This should fix (that issue--I haven't tested to see if there are others).

This is what you had

unitTypeBuild[object.uFreighter.id] = {allImprovements={object.iShipyard} <-- one bracket at end

This is what you have now

unitTypeBuild[object.uFreighter.id] = {allImprovements={object.iShipyard}} <-- two brackets at end

Here's a visual for how to spot this. Note the red line on the left of the screen as soon as you click on line 185. This red line is showing you all the stuff that's kind of associated with that one event, basically. Which is wrong, as you have multiple events.

upload_2021-3-11_9-28-20.png



When you fix the issue, that red line on the left disappears.

upload_2021-3-11_9-27-34.png
 

Attachments

  • canBuildSettings.zip
    3.6 KB · Views: 25
Thanks for the pointers, @JPetroski !

I got through those errors and fixed my oversights and removed any rogue hyphens and spaces in techs/unit/improvement names.

Now I have a new error...:)

error loading module 'object' from file 'N:\CIV2 TOT\1_OVERLORDS 1940\LuaParameterFiles\object.lua':
N:\CIV2 TOT\1_OVERLORDS 1940\LuaParameterFiles\object.lua:44: syntax error near 'Culture'
stack traceback:
[C]: in ?
[C]: in function 'require'
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:2: in main chunk
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk
 
@CurtSibling the error is you have a space

object.aAsian Culture

remove that space and make it

object.aAsianCulture

and it'll work (you do have some other entries with this issue).
 
@CurtSibling the error is you have a space

object.aAsian Culture

remove that space and make it

object.aAsianCulture

and it'll work (you do have some other entries with this issue).

Thanks - My eyes go crossed, and I miss the obvious bugs. I will go through the object file and double check for more spaces.
 
@JPetroski , Sorry to keep bugging you (pun not intended) I really appreciate your guidance.

I have another fun bug in the Object file:

error loading module 'object' from file 'N:\CIV2 TOT\1_OVERLORDS 1940\LuaParameterFiles\object.lua':
N:\CIV2 TOT\1_OVERLORDS 1940\LuaParameterFiles\object.lua:327: syntax error near '<\246>'
stack traceback:
[C]: in ?
[C]: in function 'require'
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:2: in main chunk
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk

Searching the file for any overlooked spaces...
 

Attachments

  • object.zip
    4 KB · Views: 39
The problem was that you were missing the closer for the first bracket. This should fix (that issue--I haven't tested to see if there are others).

Here's a visual for how to spot this. Note the red line on the left of the screen as soon as you click on line 185. This red line is showing you all the stuff that's kind of associated with that one event, basically. Which is wrong, as you have multiple events.

When you fix the issue, that red line on the left disappears.

View attachment 589496

BTW - I am using Sc1 editor, I either don't have the red indicator feature, or I have not turned on the setting. I suspect your version is newer than mine.
 
It's no bother to help you. Actually I think it is my sworn duty at this point after @Prof. Garfield, @Knighttime and others helped me so much :)

The issue is the umlaut. Lua doesn't accept those.

object.wBadTölzJunkerschule

I use Notepad++ as it color codes different parts of the code, highlights different brackets that are meant to go together, and shows which code is continuous (like you had) so you can figure out mistakes better. It is free and you might try it and see if you like it better. Of course perhaps Sc1 editor has all of this but in a different fashion.
 
Status
Not open for further replies.
Top Bottom