Community Forum

Need help from professionals

Forum Overview >> Scripting

CategoryScripting
Created23.06.2022 03:12


Dmitrii Artamonov (MadSochi) 23.06.2022 03:12
Guys. I'm not a scripter. i'm not even a programmer. But i have FS22 24/7 server and can NOT make it with full realism. Still can NOT find any mods for FS22 with that functions what my players on my server wants to:

1) Need to Disable/deactivate the button VISIT (teleport) production in the PRODUCTION CHAIN ​​tab - not in the Map tab (this is done by "No Teleport" mod), but in the production tab. ("No teleport" mod was created for FS 19 where wasn't productions TAB in the menu)
No Teleport function on main Map page looks like this:
function RemoveTeleportButtons:loadMap(mapFilename)
InGameMenuMapFrame.onClickVisitPlace = function() return; end;
g_currentMission.inGameMenu.pageMapOverview.buttonVisitPlace:setDisabled(true);
end;
addModEventListener(RemoveTeleportButtons);

I've tried to add this lines next to original code:
function RemoveTeleportButtons:loadProductionChains(mapFilename)
InGameMenuProductionChainsFrame.onClickVisitPlace = function() return; end;
g_currentMission.inGameMenu.pageProductionChainsOverview.buttonVisitPlace:setDisabled(true);
end;
addModEventListener(RemoveTeleportButtons);

But nothing happens. Button VISIT in ProductionChains tab still active.

2) Need to Disable/deactivate the CHANGE OUTPUT MODE button when selecting an active product for production, To leave only the Storing mode, disabling distribution and direct sale, to force players to load and transport everything manually.

3) Need to Disable the function for automatically deliver (teleport) animals to the farm. To force players to transport animals in the animal-trailers. Or, in other way, just change the PRICE of automatic transportation (in FS 19 this could be done by using the "Animal Species" mod with changing line sv.storeInfo.transportPrice = 999.0;)
but when i try to load map with this mod it calls error in animalSpecies.lua in line 47 with this code inside:

line45 function animalSpecies:updateAnimalTypes()
line46
line47 for k,v in pairs(g_currentMission.inGameMenu.pageAnimals.animalManager.animals) do
line48 --DebugUtil.printTableRecursively(v, ".", 0, 10);
line49 for sk,sv in pairs(v.subTypes) do

-- COWS ------------------------------------------------------------

if sv.fillTypeDesc.name == 'COW_TYPE_BROWN' then
--KEEP NEUTRAL
end;

if sv.fillTypeDesc.name == 'COW_TYPE_BROWN_WHITE' then
sv.output.milkPerDay = sv.output.milkPerDay * 1.5;
sv.output.manurePerDay = sv.output.manurePerDay * 2.5;
sv.output.liquidManurePerDay = sv.output.liquidManurePerDay * 2.5;
sv.input.foodPerDay = sv.input.foodPerDay * 1.5;
sv.input.waterPerDay = sv.input.waterPerDay * 1.5;
sv.input.strawPerDay = sv.input.strawPerDay * 2.0;
sv.storeInfo.buyPrice = 5000.0;
sv.storeInfo.sellPrice = 2450.0;
sv.storeInfo.transportPrice = 1500.0;
sv.storeInfo.shopItemName = ('%s - x2: manure+(2.5)/milk-(1.5)'):format(sv.storeInfo.shopItemName);
sv.breeding.birthRatePerDay = sv.breeding.birthRatePerDay * 0.9;
line69 end;
line70
line71 if sv.fillTypeDesc.name == 'COW_TYPE_BLACK' then
line72 e.t.c

In game console message:
Error: Running LUA method 'LoadSharedI3DFileFinished'
......./animalSpecies.lua:47: attempt to index field 'animalManager' (a nil value)

4) Need to Disable auto-stop vehicle when i leaving it. Every car in game stops automatically when you leave it. Even with modification FS22_DisableTurnOffMotor.zip + FS22_LessMotorBrakeForce.zip
In FS19 with FS22_LessMotorBrakeForce.zip when you leaving the vehicle on the move - your can can ride away from you very very far. But in FS22 it stops near to you. How to fix it?

Big thanks for your help and advise.


Note: Log in to post. Create a new account here.