The Spanish Civil War v4 for ToT + ToTPP + Lua - Development Thread [ON HOLD]

That's great !

You can this way make the spyed unit "visible" by the spying tribe too ;).
Could be great with random (yet unseen) land units too !
Are you gonna take tech back once used (like I did in the tes scenario) or will one reveal more and more as turns are going forward ?

Definitly an Idea i'll implement someday someway in some scenarii ! Well thought !
Hi! Thanks, it's a very good idea to "reveal" the tile of the discovered ship! I'll implement it.

No, I don't take the FT back. I'm always tracking which was the latest FT level reached and checking if the player advanced it on previous turn, so the actual espionage only occurs when the human player keeps researching new levels of FT.
 
Hi! Thanks, it's a very good idea to "reveal" the tile of the discovered ship! I'll implement it.
FYI, the latest version of the general library has functions for this:

-- gen.revealUnitStack(unitOrTile,tribe) --> void
-- if unit provided, reveals that unit and all other units on the tile
-- to the tribe
-- if tile, reveals all units on the tile (if any are present)

-- gen.hideUnitStack(unitOrTile,tribe) --> void
-- if unit provided, hides the unit and all other units on the tile from tribe
-- if tile provided, hides all units on the tile (if any are present)

Based on my limited testing, you can only reveal or not reveal an entire stack. If I remember correctly, if the "top" unit is visible (get with tile.units()), then the stack is visible, otherwise it is not.
 
Thanks for that @Prof. Garfield , I have just grabbed the 3 files changed from your most recent commit.

I've fixed the issue I had with the weird cities appearing (my unit ids were wrong in my parameters table...D'oh!). I also added a bunch of extra ships, implemented revealing the ship tile on the map (only when it's sailing) as per the above gen.revealUnitStack() code, and displayed different texts whether the enemy ship is damaged or not.

1661901467495.png

When a ship is damaged, the message is slightly different:

1661903145416.png


1661904075445.png


That's all for today...

Pablo
 
Last edited:
New espionage feature available for both playable tribes:

By default, diplomacy is disabled, so if players try to access to the F3 - Foreign Minister window, they get this message, the screeen cannot be accessed:

1662044613826.png


But if a random espionage action (in the same fashion as the spy Navy feature) allows this, they get this message:

1662043590796.png


If the player goes to the Foreign Minister window:
1662043648612.png

And Check Intelligence:
1662043722301.png

On the next turn, if the players didn't fund more intel, and the random spy on embassy didn't happen, the diplomacy screen gets disabled back again.

Also this works with the other tribe:

1662045040781.png

1662045102964.png

Please don't mind the bug on the title of the Tangier tribe, I forgot to retrict government switching when I imported the data to the new maps :D

Pablo
 
Looks really interesting. I assume Portugal/France will be off limits to both sides and if so how do you intend to make it so (Impassable terrain borders or some kind of border unit)?

Hi @tootall_2012 , I just implemented the functionality with Lua. It checks the Political map base terrains and the code is quite simple, see below (I use SQL syntax highlight in the forum as it works well with Lua):

SQL:
local function canEnterTerritoy(unit)
    
    local auxTextDomain = " cross the borders of "
    
    if unit.owner.isHuman then
    
        if unit.type.domain == 1 then
        
            -- air
            auxTextDomain = " violate the national airspace of "
            
        end

        -- Check Political Map for foreign countries
        if civ.getTile(unit.location.x,unit.location.y,1).baseTerrain == object.bFrance or civ.getTile(unit.location.x,unit.location.y,1).baseTerrain == object.bUnitedKingdom
           or civ.getTile(unit.location.x,unit.location.y,1).baseTerrain == object.bTangierInternationalZone or civ.getTile(unit.location.x,unit.location.y,1).baseTerrain == object.bAndorra
           or (civ.getTile(unit.location.x,unit.location.y,1).baseTerrain == object.bPortugal and unit.owner == object.pNationalistSpanish and (not flag.value("NatCanEnterPortugal"))) then
                    
            text.simple(text.substitute("Our %STRING1 unit is not authorised to %STRING2 %STRING3.", {unit.type.name,auxTextDomain,civ.getTile(unit.location.x,unit.location.y,1).baseTerrain.name}),"Forbidden Action")
            return false
        
        else       
            
            return true       
        
        end     
    
    else
    
        -- Do not bother to restrict for AI units
        return true   
    
    end

end

Then this is invoked by the event onEnterTile(unit,previousTile):

SQL:
    if specialmaps.canEnterTerritoy(unit) then

        -- Update Political and Strategic Maps
        specialmaps.updateMapsOnUnitMovement(unit)
    
    else
    
        -- teleport back to previousTile
        unit:teleport(previousTile)
        unit:activate()
    
    end

It shows different messages for air and ground units and looks nice in-game:

1662191921637.png

1662192038762.png

1662192445485.png

1662193111037.png


Regards,

Pablo
 
Guess you may whish to test AI's behaviour and maybe find a way to restrict it efficiently too ?
 
Sneak peek of the Strategic Map (Central Andalusia). This map will highlight all the major and minor objectives, plus major roads (Circuito nacional de firmes especiales), major ports, airfields, crossroads, mountain passes, mining, coastal fortresses, industries, etc. As you could see in a previous post, this map also tracks any enemy attacks and advances against your territories on the previous turn.

I used Lua to generate all the base terrains as it was a very manual task and I'm happy with the result. I need to see what color I use for the landmarks as i'd rather use different tones to label each type of thing. Once I finish with everything I'll try different combinations and see.

1662216458385.png

The minimap looks nice IMHO, it reminds me of a physical map from my school times :)
1662216798165.png
 
VERY interesting how you use the political map as a way to ensure that units can't enter certain tiles. Very interesting indeed. I may have to steal this idea for Cold War II. It would be a grand way to keep democracies from playing whack a mole across the entire planet.
 
VERY interesting how you use the political map as a way to ensure that units can't enter certain tiles. Very interesting indeed. I may have to steal this idea for Cold War II. It would be a grand way to keep democracies from playing whack a mole across the entire planet.
Well, the ai's part is to be thought further to avoid them from storing more and more units on such frontiers or worse, create a loop, isn't it ?
 
Last edited:
VERY interesting how you use the political map as a way to ensure that units can't enter certain tiles. Very interesting indeed. I may have to steal this idea for Cold War II. It would be a grand way to keep democracies from playing whack a mole across the entire planet.
Oh please do, I'll be honoured! I can share with you my terrain files and Lua code whenever you need.

I still haven't finished programming all the code which maintains the political map (I need to think about how to fill gaps on adjacent tiles) but let me know if I can be of help.
 
Well, the ai's part is to be thought further to avoid them from storing more and more units on such frontiers, isn't it ?
Correct. You can't use my approach "as is" for the AI, as basically the AI will keep trying to move the unit to the tile they want and Lua code teleporting it back in a loop until they run out of movement points.

But extra Lua code can help and will assist in making the AI much more challenging (as that's something I'm going to implement and test):

1) Create a function A which returns a boolean for a tribe passed by if there's any enemy tribe (there's war between them) with a shared land border.

2) Create a function B which accepts an unit as a parameter and returns the friendly city location closest to the unit location which is also close to the enemy border.

3) Create function C which for a unit passed by, returns the location of the closest enemy city.

4) onEnterTile, if A is true for the unit owner tribe, then call function B, teleport the unit there and then set the GoTo command of that unit to whatever tile returns function C.

If A is false, then that means the unit owner is at peace with all its neighbours. In this case you can teleport the unit back to the previous tile and spend all its movement points (set them to a high number).

This is a rough idea, needs polishing, but basically it would ensure all units don't go where they shouldn't, and focus on moving against any enemy they share a border with.

I'll experiment and will get back to you.

Regards,

Pablo
 
Hi @tootall_2012 , I just implemented the functionality with Lua. It checks the Political map base terrains and the code is quite simple, see below (I use SQL syntax highlight in the forum as it works well with Lua):
...

View attachment 638384
Looking at the above screen shot, in addition to your lua function, I was curious whether you intended to include visible markings on the main map to clearly identify for the players the actual national borders between Spain and France/Portugal.

For example, in Napoleon I used the ToTPP label function to place (*) to represent borders. It was a little crude but effective in allowing the players to know at a glance where the borders were.

Borders.png


I'm certain with your skill set you could easily come up with a better graphical solution. For certain it would make it simpler for the player to know in advance where the borders were rather then have to rely exclusively on the lua function to see whether they'd made a transgression or not.

Just something I thought might be useful to think about.
 
Last edited:
Looking at the above screen shot, in addition to your lua function, I was curious whether you intended to include visible markings on the main map to clearly identify for the players the actual national borders between Spain and France/Portugal.

For example, in Napoleon I used the ToTPP label function to place (*) to represent borders. It was a little crude but effective in allowing the players to know at a glance where the borders were.

View attachment 638550

I'm certain with your skill set you could easily come up with a better graphical solution. For certain it would make it simpler for the player to know in advance were the borders were rather then have to rely exclusively on the lua function to see whether they'd made a transgression or not.

Just something I thought might be useful to think about.
My understanding was that players may know in advance about the frontiers by looking at the (more or less) visible second/third/fourth map ?

On the one hand, the information isn't on the first map, on the other hand it allows for more accurate frontiers to display.
 
Having to go back and forth between the different maps to check if you‘re over the border or not might become a little inconvenient over time, at least in my humble opinion.
 
Last edited:
Hi @tootall_2012, in this scenario there are only two playable tribes which are at war against each other. All other non playable nations are just there to fill the map, but they can't research or produce/move units or do anything useful at all.

I really see no reason why the human player would want to move their units towards Portugal or France instead of fighting their enemy, this is not an empire building scenario and there are no benefits in "expanding". Actually it's impossible to declare war to the non playable nations or capture any of their cities.

I actually only introduced this Lua functionality to ensure the Nationalist Spanish only use Portugal if they have been authorised to, as crossing through Portugal is the only "useful" choice for using another country's territory. Then one thing led to another, and in the end I ended up putting these warning messages for all countries just for the sake of it as I'm actually enjoying programming with Lua and wanted to try out things for my own learning. I'm also happy to inspire others to use my political map idea and functionality as I think it can be a nice feature on any historical scenario.

But yes, as @Dadais mentioned, a quick click of a button and you see where the actual borders are:

MAP 1:
1662362343681.png

MAP 2:
1662362383835.png

MAP 3:
1662362479736.png


The AI controlled players won't be invading these non playable nations because I'm going to program a very aggressive AI using Lua, all AI controlled units will be where they have to be, and not wandering around the map :)

Pablo
 
BTW, using the Wayback Machine of the Internet Archive I have been able to recover the first release of my MGE scenario dating June 2003 (19 years ago!). The first release included a HTML guide with lots of info on how to play the scenario, and included also some in-game screenshots depicting historical battles which I want to show you here (nostalgy mode: ON):

The logo made by @CurtSibling for the occasion
1662365124421.png


Nationalist Convoys crossing the Gibraltar strait (July-August 1936)
1662364659141.png

Battle for Madrid (November 1936 - March 1939)
1662364694604.png

Bombing of Guernika (26th April, 1937)
1662364719087.png

The Ebro battle (July - November 1938)
1662364739576.png


It makes me smile to see how different v4 for ToT is going to look :)
 
My espionage Lua module keeps growing. Let me show you another random action which will happen when the human player decided to fund the intelligence agency (research FT) on the previous turn:

The new action will pick a random enemy city and using gen.setCityInvestigated, it will allow the human player to see its city status.

1662375617513.png


Then they click on the city and can see its content, just the same way as in vanilla civ we investigsated it with a Spy.
 
Looking at the above screen shot, in addition to your lua function, I was curious whether you intended to include visible markings on the main map to clearly identify for the players the actual national borders between Spain and France/Portugal.

For example, in Napoleon I used the ToTPP label function to place (*) to represent borders. It was a little crude but effective in allowing the players to know at a glance where the borders were.

Having to go back and forth between the different maps to check if you‘re over the border or not might become a little inconvenient over time, at least in my humble opinion.

Just to point that this opinion is a very important one (at least in compare with mine, while Pablostuka has deeper experience) :
Something to be kept in mind to find the best solution(s) considering various nowadays limits.
 
Top Bottom