News:

Welcome to World of Banished!

Main Menu

How to remove the forester's ability to plant trees?

Started by lauri0, December 21, 2023, 09:15:12 AM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

lauri0

I'm trying to make it so the forester can only cut trees, not plant them. Removing all references to planting from the Template/ForesterLodge.rsc seems to just hide the button without removing the behaviour. Has anybody tried to do it or knows what has to be done?

This is the part of the vanilla template file which among other things shows the enable planting button:
UIDescription ui
{
Dialog _dialog = "Dialog/StandardDialog.rsc:entity";

ElementController _controllers
[
{
ObjectType _type = RadiusUI;
}
{
ObjectType _type = ControlUI;
ElementDescription _element = "foresterCutButton";
String _insertAt = "userButton0";
DialogControllerConfig _config = "cutButtonConfig";
}
{
ObjectType _type = ControlUI;
ElementDescription _element = "foresterPlantButton";
String _insertAt = "userButton1";
DialogControllerConfig _config = "plantButtonConfig";
}
/*
{
ObjectType _type = ControlUI;
ElementDescription _element = "Dialog/AutoPickup.rsc:enableAutoPickupButton";
String _insertAt = "userButton2";
DialogControllerConfig _config = "Dialog/AutoPickup.rsc:autoPickupButtonConfig";
}*/
{
ObjectType _type = ResourceLimitUI;
ElementDescription _element = "resourceLimit";
String _insertAt = "userButton3";
DialogControllerConfig _config = "resourceLimitConfig";
}
{
ObjectType _type = ProductionUI;
ElementDescription _element = "Dialog/Production.rsc:production3";
String _insertAt = "pageUser";
}
{
ObjectType _type = PageToggleUI;
ElementDescription _element = "Dialog/Production.rsc:checkProduction";
String _insertAt = "userTitle0";
}
{
ObjectType _type = WorkPlaceUI;
ElementDescription _element = "Dialog/Work.rsc:workPlace";
String _insertAt = "userTitle1";
}
{
ObjectType _type = StatusIconUI;
ElementDescription _element = "Dialog/Building.rsc:icons";
String _insertAt = "userButton3";
}
{
ObjectType _type = StatusIconUI;
ElementDescription _element = "Dialog/Building.rsc:icons";
String _insertAt = "userTitle2";
DialogControllerConfig _config = "CropField.rsc:titleBuildStatus";
}
{
ObjectType _type = BuildUI;
ElementDescription _element = "Dialog/Build.rsc:build";
String _insertAt = "pageBuild";
}
{
ObjectType _type = DestroyUI;
ElementDescription _element = "Dialog/Destroy.rsc:destroy";
String _insertAt = "pageDestroy";
}

]
}

ControlUIConfig cutButtonConfig
{
ObjectType _type = ForesterComponent;
int _controlId = 2;
}

ControlUIConfig plantButtonConfig
{
ObjectType _type = ForesterComponent;
int _controlId = 1;
}

CheckDescription foresterCutButton : "Dialog/Work.rsc:enableWorkCheck"
{
ElementDescription _content = "labelForesterCutUncheck";
ElementDescription _check = "labelForesterCutCheck";
String _toolTipText = "ForesterCutTip";
}

CheckDescription foresterPlantButton : "Dialog/Work.rsc:enableWorkCheck"
{
ElementDescription _content = "labelForesterPlantUncheck";
ElementDescription _check = "labelForesterPlantCheck";
String _toolTipText = "ForesterPlantTip";
int _rightPad = 38;
}

LabelDescription labelForesterCutCheck : "Dialog/Work.rsc:labelEnableWork" { String _spriteName = "ForesterCut"; String _text = "ForesterCut";  }
LabelDescription labelForesterCutUncheck : "labelForesterCutCheck" { Color _color = 0xFF2E2B28; }

LabelDescription labelForesterPlantCheck : "Dialog/Work.rsc:labelEnableWork" { String _spriteName = "ForesterPlant"; String _text = "ForesterPlant";  }
LabelDescription labelForesterPlantUncheck : "labelForesterPlantCheck" { Color _color = 0xFF2E2B28; }

kid1293

I think you have to make the button 'clicked' (to disable planting) before you hide it.
What's wrong with the forester's buttons? There you can disable planting.

kralyerg

I'm not sure it's possible the way you want.

The part of the code you were adjusting is just the user interface section, it wouldn't affect the actual behavior of the building.

ForesterDescription forester
{
ResourceLimit _resourceLimit = Log;
ComponentDescription _naturalResource = "Template/NaturalResourceTree.rsc";
}


This tells the building that's its a forester and to plant and harvest Trees.  I don't think there's a way to alter Forester behavior directly to not plant.  There are large parts of the game hidden from modding.

It might be possible to swap out the Forester section for the similar function in the Gatherers Hut.  Gatherers only harvest, and don't plant.

HerbalistDescription herbalist
{
ComponentDescription _naturalResource
[
"Template/NaturalResourceTree.rsc",
]
ResourceLimit _resourceLimit = Log;
}


Something like that.  And then change the resource section at the top to add the herbalist function and comment out forester.

//forester
herbalist


You'd probably have to also edit the buttons on the UI too.

lauri0

#3
Thanks kralyerg, this approach works like a charm!

The reason why I wanted to remove the button is that I'm making a difficulty/balance mod to make the game harder and more of a survival experience compared to vanilla. So among many of the things I'm doing/trying to do is the idea of forests being a resource that the player has to use carefully. So I don't want there to be an easy way to plant a forest and the player would have to rely on the natural seeding and regrowth of trees to balance out logging as the town grows.

Perhaps if the vanilla forester's planting behaviour was slower/less efficient I wouldn't mind it, but I don't think there's much that can be done to modify that.

theonlywanderer

Are you planning to not allow trading?   If trading still exists, you'll at least have to figure out a way to prevent trading of logs for your forest mod to matter in the grand scheme.   I don't stay on forestry reliance very long as it is.   I setup traders soon as I stabilize food, tools and clothing.  My first trade port gets focused on logs where every merchant who can deal logs gets set to only bring logs.   I take those logs and make enough firewood for my town and to stock the trade port again to get more logs.   So, really, the forestry issue you are creating is easily worked around.

lauri0

#5
This is a valid concern, but should be easy to solve.

I plan to limit, but not remove trading. The idea is that it is a very remote settlement and as such it has to be largely self sufficient and traders aren't that interested in hauling cheap and heavy building materials for very long distances. On the other hand I might add some new trade resources which can only be gained by trading, e.g. salt. So trading will still be useful for more than just getting the seeds.

Having said that I haven't actually done any testing yet with modding the trader. I can see in the template file for the trading post that every merchant has a list of sellFlags and wantFlags which can be e.g. Wood, Fuel, Textile, etc. So it looks like it should be trivial to prevent wood trading by just removing the Wood flags from the merchants.

But in general I'm trying to balance (almost) everything with the assumption of forced self-sustainability (no trading) and then open up limited trading in a way which hopfully doesn't break the balance.


brads3

you could adjust the speed of growth,, so it takes more years for trees to grow back. you could also change how many trees are on the map at start. this would affect all the trees not just those the forester plants. and you could adjust how many logs they get from a tree. combined that would make the game much harder from the start onward.