R.E.D. World War II development thread

Still trying to get Operations on the NA/Europe Map.

Trying out a Operation Compass project. The Project appears in the build menu, but it doesn't launch upon completion?

99- NewProjects.xml
Spoiler :

Code:
	<!-- Operation Compass (Desert Counter Offensive) -->
	<Projects>
		<Row>
			<Type>OPERATION_COMPASS</Type>
			<Description>TXT_KEY_OPERATION_COMPASS</Description>
			<Help>TXT_KEY_OPERATION_COMPASS_DESC</Help>
			<Civilopedia>TXT_KEY_OPERATION_COMPASS_DESC</Civilopedia>
			<Strategy>TXT_KEY_OPERATION_COMPASS_DESC</Strategy>
			<MaxGlobalInstances>-1</MaxGlobalInstances>
			<MaxTeamInstances>1</MaxTeamInstances>
			<Cost>180</Cost>
			<IconAtlas>BW_ATLAS_1</IconAtlas>
			<PortraitIndex>10</PortraitIndex>
		</Row>
	</Projects>
	<Project_Flavors>
		<Row>
			<ProjectType>OPERATION_COMPASS</ProjectType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>10</Flavor>
		</Row>
		<Row>
			<ProjectType>OPERATION_COMPASS</ProjectType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>75</Flavor>
		</Row>
	</Project_Flavors>
Entries in RedDefinesProjects.lua
Spoiler :
Code:
OPERATION_COMPASS			= GameInfo.Projects.OPERATION_COMPASS.ID
g_Major_Projects
Spoiler :
Code:
	[ENGLAND] = {
		PROJECT_TETRARCH, PROJECT_MATILDAI, PROJECT_MATILDAII, PROJECT_CRUISER_III, PROJECT_CRUISER_IV, PROJECT_CHURCHILL, PROJECT_M4_FIREFLY, PROJECT_VALENTINE, PROJECT_A15,
		PROJECT_MOSQUITO, PROJECT_TYPHOON,  PROJECT_SPITFIRE_V, PROJECT_SPITFIRE_IX, 
		PROJECT_HEAVY_BOMBER, PROJECT_BEAUFIGHTER, PROJECT_WHIRLWIND, PROJECT_LANCASTER, [B]OPERATION_COMPASS[/B]},

g_ProjectsTable...

Spoiler :
Code:
	[OPERATION_COMPASS] =  {
		Buildings = {BASE},	
		Scenarios = {"AmericaEuro1936", },	
		Trigger = {Type = "date", Value = 19401101, ProbPerTurn = 100},
		TopSecret = true,
	},

g_Military_Project in Script[ScenarioName].lua...

Spoiler :
Code:
g_Military_Project = {
	------------------------------------------------------------------------------------
	[ENGLAND] = {
	------------------------------------------------------------------------------------
		[OPERATION_COMPASS] =  { -- projectID as index !
			Name = "TXT_KEY_OPERATION_COMPASS",
			OrderOfBattle = {
				{	Name = "Group 1", X = 115, Y = 2, Domain = "Land", CivID = ENGLAND, 
					Group = {		CW_INFANTRY,  UK_MATILDA_II, UK_INFANTRY	},
					UnitsName = { "8th Australian Division", "7th Armoured Division 'The Desert Rats'"}, 
					UnitsXP = {		25,		25,		15},
					InitialObjective = "105,3", 
					LaunchType = "ParaDrop",
					LaunchX = 115, -- Destination plot
					LaunchY = 2, 
					LaunchImprecision = 1, -- landing area
				},
			},			
		Condition = IsGermanyAtWarWithEngland, -- Must refer to a function, remove this line to use the default condition (always true)
		},
	},
}

And lastly the condition function.

Spoiler :
Code:
function IsGermanyAtWarWithEngland()
	local bDebug = false
	if not AreAtWar( GetPlayerIDFromCivID(GERMANY, false), GetPlayerIDFromCivID(ENGLAND, true)) then
		Dprint("      - Germany is not at war with England...", bDebug)
		return false
	end
	return true
end

Just wondering is there anything else needed? The project doesn't seem to launch.
 
something in the Lua.log ?

the condition function is placed before the g_Military_Project table ?
 
All I could really find from the log.
Spoiler :
[12571.375] RedMain: Finalize projects of next player...
[12571.375] RedMain: - London is building project : Operation Compass
[12571.375] RedMain: - Turn(s) left = 1
[12571.375] RedMain: - Removing project from build list and mark it as done...


Spoiler :
[12603.500] RedMain: Check for Military Operations...
[12603.500] RedMain: - PlayerID was nil, assume LaunchMilitaryOperation was called by ActivePlayerStartTurn for active player...


Spoiler :
[12603.500] RedMain: -------------------------------------
[12603.500] RedMain: Check for Military Operations...
[12603.500] RedMain: - PlayerID was nil, assume LaunchMilitaryOperation was called by ActivePlayerStartTurn for active player...
[12603.500] RedMain: -------------------------------------
[12603.500] RedMain: Initializing Military Operations for Winston Churchill
[12603.515] RedMain: - Testing condition for Operation ID = 8
[12603.515] RedMain: Military Operations initialized...


How I placed the condition function:

Spoiler :
Code:
----------------------------------------------------------------------------------------------------------------------------
-- Military Projects
----------------------------------------------------------------------------------------------------------------------------


function IsGermanyAtWarWithEngland()
	local bDebug = false
	if not AreAtWar( GetPlayerIDFromCivID(GERMANY, false), GetPlayerIDFromCivID(ENGLAND, true)) then
		Dprint("      - Germany is not at war with Norway...", bDebug)
		return false
	end
	return true
end

g_TroopsRoutes = { 
	[ITALY] = {	
			[TROOPS_ITALY_AFRICA] = {
				Name = "Italy to Africa",
				CentralPlot = {X=84, Y=28},
				MaxDistanceFromCentral = 7,
				ReserveUnits = 12, -- minimum unit to keep in this area (ie : do not send those elsewhere)
				EmbarkList = { {X=84, Y=28}, {X=84, Y=27}, {X=86, Y=26},  {X=86, Y=25}, }, -- near Rome, Naples
				RandomEmbark = false, -- true : random choice in spawn list
				WaypointList = { {X=83, Y=22}, {X=81, Y=22},  }, -- Waypoints
				RandomWaypoint = true, -- true : random choice in waypoint list (use 1 random waypoint), else use sequential waypoint movement.
				LandingList = { {X=85, Y=7}, {X=86, Y=6}, {X=96, Y=4}, {X=97, Y=6}, }, -- near Triploli, Benghazi
				RandomLanding = false, -- false : sequential try in landing list
				MinUnits = 2,
				MaxUnits = 4, -- Maximum number of units on the route at the same time
				Priority = 10, 
				Condition = ItalyReinforcementToAfrica, -- Must refer to a function, remove this line to use the default condition (true)
			},
			[TROOPS_ITALY_ALBANIA] = {
				Name = "Italy to Albania",
				CentralPlot = {X=84, Y=28},
				MaxDistanceFromCentral = 7,
				ReserveUnits = 5, -- minimum unit to keep in this area (ie : do not send those elsewhere)
				EmbarkList = { {X=90, Y=25}, {X=91, Y=24}, {X=92, Y=24}, }, -- near Bari
				RandomEmbark = false, -- true : random choice in spawn list
				WaypointList = { {X=93, Y=25},  }, -- Waypoints
				RandomWaypoint = false, -- true : random choice in waypoint list (use 1 random waypoint), else use waypoint to waypoint movement.
				LandingList = { {X=95, Y=24}, {X=95, Y=23}, {X=95, Y=25}, }, -- near Tirana
				RandomLanding = false, -- false : sequential try in landing list
				MinUnits = 1,
				MaxUnits = 1, -- Maximum number of units on the route at the same time
				Priority = 10, 
				Condition = ItalyReinforcementToAlbania, -- Must refer to a function, remove this line to use the default condition (true)
			},
			[TROOPS_AMERICA_UK] = {
				Name = "America to UK",
				CentralPlot = {X=0, Y=32},
				ReserveUnits = 8, -- minimum unit to keep in this area (ie : do not send those elsewhere)
				LandingList = { {X=66, Y=55}, {X=66, Y=53}, {X=66, Y=52}, }, -- near Bristol, Plymouth
				RandomLanding = true, -- false : sequential try in landing list
				MinUnits = 2,
				MaxUnits = 4, -- Maximum number of units on the route at the same time
				Priority = 20, 
				Condition = IsAmericaAtWarWithGermany, -- Must refer to a function, remove this line to use the default condition (true)
			},
	},
}

g_Military_Project = {
	------------------------------------------------------------------------------------
	[ENGLAND] = {
	------------------------------------------------------------------------------------
		[OPERATION_COMPASS] =  { -- projectID as index !
			Name = "TXT_KEY_OPERATION_COMPASS",
			OrderOfBattle = {
				{	Name = "Group 1", X = 115, Y = 2, Domain = "Land", CivID = ENGLAND, 
					Group = {		CW_INFANTRY,  UK_MATILDA_II, UK_INFANTRY	},
					UnitsName = { "8th Australian Division", "7th Armoured Division 'The Desert Rats'"}, 
					UnitsXP = {		25,		25,		15},
					InitialObjective = "105,3", 
					LaunchType = "ParaDrop",
					LaunchX = 115, -- Destination plot
					LaunchY = 2, 
					LaunchImprecision = 1, -- landing area
				},
			},			
		Condition = IsGermanyAtWarWithEngland, -- Must refer to a function, remove this line to use the default condition (always true)
		},
	},
}
 
edit:

change
Code:
bDebug = [B]false[/B]
to true in IsGermanyAtWarWithEngland() and add
Code:
Dprint("      - Germany is at war with England...", bDebug)

just before
Code:
return true
in that function

to check if the condition is at least called.
 
Hello Gedemon

It's just my personal opinion but i think subs has too difficult time surviving at the beginning of the game. It's more like it was later in war when they didn't have much chance

So i made a scenario promotion for subs and cruisers which will be applied earlier in the game

on beginning destroyers has 2 movement points less and -33% combat strength against subs and cruisers -1 and -15%

there were 2 happy times for the subs, the first one from beginning to '41 when britts learned to fight them and the second one from US joined the war to '42 when they began with convoy system. and the last change was the black may for subs when they began to loose many vessels without getting much damage done to the convoys

so i made 3 defines (dates), in the first one destroyers gets removed -2 penalty and applied -1, on the second one cruisers are being removed the penalty and on last date destroyers gets removed that penalty

looks like it makes a huge difference, now you have no problem surviving with subs on sea

so i'm wondering if you want to merge this option since it's some changes to many files?

it still has one bug though, first it worked well and got applied on new units like ocean movement promotion but now it looks like i need to add it on serial events on new unit created, can't understand why? because it uses function SetScenarioPromotion(unit) found in RedUnitFunctions.lua
 
Hello Gedemon

It's just my personal opinion but i think subs has too difficult time surviving at the beginning of the game. It's more like it was later in war when they didn't have much chance

So i made a scenario promotion for subs and cruisers which will be applied earlier in the game

on beginning destroyers has 2 movement points less and -33% combat strength against subs and cruisers -1 and -15%

there were 2 happy times for the subs, the first one from beginning to '41 when britts learned to fight them and the second one from US joined the war to '42 when they began with convoy system. and the last change was the black may for subs when they began to loose many vessels without getting much damage done to the convoys

so i made 3 defines (dates), in the first one destroyers gets removed -2 penalty and applied -1, on the second one cruisers are being removed the penalty and on last date destroyers gets removed that penalty

looks like it makes a huge difference, now you have no problem surviving with subs on sea

so i'm wondering if you want to merge this option since it's some changes to many files?

it still has one bug though, first it worked well and got applied on new units like ocean movement promotion but now it looks like i need to add it on serial events on new unit created, can't understand why? because it uses function SetScenarioPromotion(unit) found in RedUnitFunctions.lua

What about having a sub-promotion where they withdraw from battle every time, except when 'cornered' by two or more ships bracketing them?
 
What about having a sub-promotion where they withdraw from battle every time, except when 'cornered' by two or more ships bracketing them?

i was thinking about that too but later in game it would be too easy to be a sub i think. it looks like the main problem is that destroyers are too mobile, they come all the way from Australia to hunt your subs in a couple of turns in earth map and that is not very realistic
 
I see 2 temporary solutions until I work again on the naval AI (I want to limit the number of ships hunting a specific sub for example, and later maybe a full fleet AI, grouping ships together with missions):

- remove some destroyers of the initial order of battles for all nations

- find and edit the following values in the define files (in RedDefinesRules.lua but I'd suggest to change them in the scenario defines - or add them there with your own values, the scenario defines override the base rules)
Code:
DESTROYER_SUB_HUNTING_MAX_TURNS_ATTACK		= 2 -- Number of previous turns attacks entries destroyers look at for subhunting
DESTROYER_SUB_HUNTING_MAX_TURNS_TO_TARGET	= 3 -- Max turns needed for destroyer to reach last attack plot for subhunting
CRUISER_SUB_HUNTING_MAX_TURNS_ATTACK		= 1 -- Number of previous turns attacks entries cruisers look at for subhunting
CRUISER_SUB_HUNTING_MAX_TURNS_TO_TARGET		= 1 -- Max turns needed for cruiser to reach last attack plot for subhunting
try to put everything to 1 for example, or just change DESTROYER_SUB_HUNTING_MAX_TURNS_TO_TARGET to 2 or 1.


edit: subs should also have the ignore ZOC promotion IMO, but that will have to wait for a conversion to BNW
 
i need some help with trying to format this for the 1940 map.

g_Reinforcement_OOB = {
------------------------------------------------------------------------------------
[GERMANY] = {
------------------------------------------------------------------------------------
[19400710] = { xyz


first question: Is the bracket_Germany_closebracket necesary? Do i need a full copy of the script for every nation i want to play with?

Second question: do i need to reference in anywhere (Outside of the DefinesEurope1940 lua) that i am using this function? I looked extensively through all the RedAmericaEuro1936 and ScriptAmericaEuro1936 and could not find any other reference to g_Reinforcement_OOB, and the function works pretty well in that mod....
But i know the mods are different, the 1940euro has had a lot more work done, and may have other newer code that breaks or conflicts with g_Reinforcement_OOB

I tried loading the mod with a variety of additions of closed brackets and commas but every time, with the new code, it broke loading of the mod.
 
Thanks, yes i know those. i just thought it's the only way to help it as long as there is no ignore ZOC to limit mobility... it basically only need 2 destroyers to make it not possible for the sub to escape. and it certainly makes a difference if it's 12 instead of 16 moves on ocean tiles if they reach there or not, also when hunting a sub it's a big difference if they have less moves to use on that.

but no big deal, just thought maybe i put that scenario on forums here, it would be the best to only have scenario files instead of all the mod. but of course it's not necessary to have that effect in action then
 
Something wierd happend, look at the 2 transport north of Plymouth. Those 2 are part of the Sealow opération team.
 

Attachments

  • Civ5Screen0008.jpg
    Civ5Screen0008.jpg
    227.7 KB · Views: 162
Something wierd happend, look at the 2 transport north of Plymouth. Those 2 are part of the Sealow opération team.

does other units of the operation have disembarked ?
 
@ ilshur: sorry, I thought that I had posted an answer to your question a few day ago, I will write it again when back home.
 
Will a Pacific scenario be added?
 
In the 1939 Europe scenario, there is a small typo for the Hungarian Tank Turan. It should be written Turán. I am not complaining, thanks for the wicked mod.
 
Hello Gedemon, i'm currently working on strategic AI for the mod, trying to get at least dynamic routes so troops can be redacted where ever they are needed and bombers and battleships involved in that. Got dynamic routes running but there is much to think when making rules for them so there isn't unnecessary embarking. just so you know, maybe no idea to make double work if you can use it later?

i made it so that all things can be disabled both on scenario and nation basis, some also for minor divs but it's WIP right now, only dynamic route system is working but not brains behind it yet
 
lol forgot it, i had a question... how about waypoints? is units capable of moving to next waypoint if it's very far? because it would require a lot of computing i think to make waypoints all the way on long routes... i guess one is required anyway so they doesn't go on disembark mode directly after embarking. i made it so that it finds a nearest sea plot in area where they are needed and uses that as waypoint
 
Thanks, yes i know those. i just thought it's the only way to help it as long as there is no ignore ZOC to limit mobility... it basically only need 2 destroyers to make it not possible for the sub to escape. and it certainly makes a difference if it's 12 instead of 16 moves on ocean tiles if they reach there or not, also when hunting a sub it's a big difference if they have less moves to use on that.

but no big deal, just thought maybe i put that scenario on forums here, it would be the best to only have scenario files instead of all the mod. but of course it's not necessary to have that effect in action then
Hi!

The Allies began deploying a lot of new technology in 1943, such as better sonar, centimetric radar, "hedgehog" mortars, etc., that forced Germany to temporarily withdraw its submarines from action, so another way to give submarines a better chance could be to start destroyers with no advantage against submarines, but allow players to research "Improved antisubmarine warfare (ASW) technology" later in the war. so that any destroyer that entered port after it was developed would receive an "improved ASW" attribute which would give the current ASW bonus.

Just a thought....
 
Back
Top Bottom