Okay, I noticed that I was seeing frequent takeovers when simulating in the Barclay's premier league. I wouldn't mind that if they didn't totally imbalance the transfer market. I agree that new owners do tend to inject capital into the team; however, the game rather lazily just replaces the teams current budget with 100m, which falsely assumes that all new owners will splash mega-bucks. Now I decided to rid the game of this madness without ridding the game of the "new ownership" concept.
First, here is the default section from foreign.lua which governs changing the budget for newly taken over teams:
Code:
function InvestorDynamicEvent( eventId )
local storyId = "INVESTOR"
local numStories = GetNumStoriesWithId( storyId )
if( numStories > 0 ) then
for storyCount = 1, numStories do
local currentStory = GetStoryByIdAndIndex( storyId, storyCount )
local storyTeam = GetStoryTeam( currentStory )
SetStringTeam( storyTeam )
if( eventId == "INVESTOR_ST1" ) then
TriggerNews( "news_title_investor_stage1_", 1, 10, "news_body_investor_stage1_", 1, 5, currentStory )
UpdateStoryActivityById( storyId )
local nextEventLow = 28
local nextEventHigh = 40
local randDays = GetRandomNumber( nextEventLow, nextEventHigh )
AddDateEvent( "INVESTOR_MONEY", randDays )
-- Add more stages
elseif( eventId == "INVESTOR_MONEY" ) then
UpdateTeamBudget( storyTeam, 100000000 ) -- 100million for now
TriggerNews( "news_title_investor_stagemoney_", 1, 10, "news_body_investor_stagemoney_", 1, 5, currentStory )
UpdateStoryActivityById( storyId )
SetStoryVariable( currentStory, "0" )
GenerateTransferActivityForTeam( storyTeam ) -- Fix pacing
end --if( event == "INVESTOR_ST1" ) then
end -- for storyCount = 1, numStories do
end -- if( numStories == 0 ) then
end
Now, I decided to inject some randomness into how the game injects new capital:
Code:
function InvestorDynamicEvent( eventId )
local storyId = "INVESTOR"
local numStories = GetNumStoriesWithId( storyId )
if( numStories > 0 ) then
for storyCount = 1, numStories do
local currentStory = GetStoryByIdAndIndex( storyId, storyCount )
local storyTeam = GetStoryTeam( currentStory )
SetStringTeam( storyTeam )
if( eventId == "INVESTOR_ST1" ) then
TriggerNews( "news_title_investor_stage1_", 1, 10, "news_body_investor_stage1_", 1, 5, currentStory )
UpdateStoryActivityById( storyId )
local nextEventLow = 28
local nextEventHigh = 40
local randDays = GetRandomNumber( nextEventLow, nextEventHigh )
AddDateEvent( "INVESTOR_MONEY", randDays )
-- Add more stages
elseif( eventId == "INVESTOR_MONEY" ) then
local teamBudget = GetTeamBudget( storyTeam )
local randomBudgetInc = 0
local newTeamBudget = 0
local randomBudgetChance = GetRandomNumber( 1, 100 )
if( randomBudgetChance <= 2 ) then
randomBudgetInc = GetRandomNumber( 80000000, 100000000 )
elseif( randomBudgetChance <= 12 ) then
randomBudgetInc = GetRandomNumber( 30000000, 80000000 )
elseif( randomBudgetChance <= 62 ) then
randomBudgetInc = GetRandomNumber( 4000000, 15000000 )
elseif( randomBudgetChance < 98 ) then
randomBudgetInc = GetRandomNumber( 15000000, 30000000 )
elseif( randomBudgetChance >= 98 ) then
randomBudgetInc = GetRandomNumber( 2000000, 4000000 )
newTeamBudget = ( teambudget + randomBudgetInc )
UpdateTeamBudget( storyTeam, newTeamBudget )
TriggerNews( "news_title_investor_stagemoney_", 1, 10, "news_body_investor_stagemoney_", 1, 5, currentStory )
UpdateStoryActivityById( storyId )
SetStoryVariable( currentStory, "0" )
GenerateTransferActivityForTeam( storyTeam ) -- Fix pacing
end --if( event == "INVESTOR_ST1" ) then
end -- for storyCount = 1, numStories do
end -- if( numStories == 0 ) then
end
For an explanation: here is why I did each step:
1st, we need to create some new variables:
This one grabs the teams existing budget and stores it as "teamBudget":
Code:
local teamBudget = GetTeamBudget( storyTeam )
This one creates "randomBudgetInc" and sets it to zero:
Code:
local randomBudgetInc = 0
This one creates "newTeamBudget" and sets it to zero:
This one grabs a random number between 1 and 100 and stores it as "randomBudgetChance":
Code:
local randomBudgetChance = GetRandomNumber( 1, 100 )
2nd, we need to create outcomes for random variable "randomBudgetChance". 1st, the script will check to see if randomBudgetChance is less than or equal to 2. If yes (2% chance), then it will set the variable randomBudgetInc to a random number between 80m and 100m:
Code:
if( randomBudgetChance <= 2 ) then
randomBudgetInc = GetRandomNumber( 80000000, 100000000 )
If it is not less than or equal to 2, then it will move to the next line. This next line asks if randomBudgetChance is less than or equal to 12 (10% chance that it is greater than 2 but less than or equal to 12). If yes, it sets randomBudgetInc to a random number between 30m and 80m:
Code:
elseif( randomBudgetChance <= 12 ) then
randomBudgetInc = GetRandomNumber( 30000000, 80000000 )
This process is repeated:
for > 12 and ≤ 62 (50% chance, randomBudgetInc = 4m - 15m):
Code:
elseif( randomBudgetChance <= 62 ) then
randomBudgetInc = GetRandomNumber( 4000000, 15000000 )
for > 62 and < 98 (35% chance, randomBudgetInc = 15m - 30m):
Code:
elseif( randomBudgetChance < 98 ) then
randomBudgetInc = GetRandomNumber( 15000000, 30000000 )
and finally, for ≥ 98 (3% chance, randomBudgetInc = 2m - 4m):
Code:
elseif( randomBudgetChance >= 98 ) then
randomBudgetInc = GetRandomNumber( 2000000, 4000000 )
Next, we need to add our value "randomBudgetInc" to the existing budget:
Code:
newTeamBudget = ( teambudget + randomBudgetInc )
Finally, we will set the team's budget to our new budget value:
Code:
UpdateTeamBudget( storyTeam, newTeamBudget )
So, we should still see semi-frequent takeovers but they should de-stabilize the market much less frequently. And sometimes they should have almost no impact. I did not edit or create any news content so the game will still talk about the cash injection like it was a mega-huge injection, but you won't know whether or not they got a bunch of cash until you watch them for a few transfer windows. I tried to explain the steps so that even programming novices like myself might be able to choose their price steps and chances.
Now, I am not a computer programmer and I only took one semester of programming in college, so I may have got this way wrong, so if any of you are familiar with writing scripts please check my syntax. I won't post the altered file until I have a chance to test it later this week. But, if anyone wants to just swap the default code in foreigninvestor.lua with what I posted here, please feel free (as always).