Author Topic: Start Conditions  (Read 470 times)

0 Members and 1 Guest are viewing this topic.

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Start Conditions
« on: March 09, 2021, 05:53:32 PM »
Is there a way to have a specific type of resource in the barn at the start? There's a place for stone, wood, etc, but if I wanted to have apples, is there a way to do that?

Thanks!

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3920
  • Never confuse movement with progress
Re: Start Conditions
« Reply #1 on: March 09, 2021, 09:12:10 PM »
In the file Game/StartConditions/StartConditions.rsc
you find a section like this

Code: [Select]
WeakComponentDescription _initialVisibleList
[
"Template/RawMaterialWood.rsc",
"Template/RawMaterialStone.rsc",
"Template/RawMaterialIron.rsc",

"Template/RawMaterialTool.rsc",
"Template/RawMaterialPotato.rsc",
"Template/RawMaterialFirewood.rsc",
"Template/RawMaterialLeatherCoat.rsc"
]

That tells what you have available (visible) from start.

In any special start condition file, you can tell how much of each you get
Here is the vanilla Game/StartConditions/Easy.rsc file

Code: [Select]
int _initialWoodCount = 150;
int _initialStoneCount = 70;
int _initialIronCount = 50;

int _initialToolCount = 50;
int _initialFoodCount = 2400;
int _initialFuelCount = 400;
int _initialClothingCount = 40;

int _plantCount = 2;
int _treeCount = 2;
int _livestockCount = 1;

float _livestockOffsetX = 0.0f;
float _livestockOffsetY = 0.0f;
float _livestockRadius = 4;
int _livestockGroupCount = 8;

That means - if you have Potatoes 'visible', you will get 2400 of them.

You can add whatever you want to the first list (wheat, cabbage, or even rice)
and in the second you tell the sum. They will be evenly distributed.

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #2 on: March 10, 2021, 09:03:39 AM »
Ah ok! Thank you!

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #3 on: March 10, 2021, 05:45:53 PM »
Do you have to do anything differently if the item flag is a custom flag (ie custom7)?

I am trying to add silkworm eggs to the start conditions, but they won't show up.

https://www.mediafire.com/file/u6txj4gls79zz9f/A8JapaneseStart.zip/file

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3920
  • Never confuse movement with progress
Re: Start Conditions
« Reply #4 on: March 11, 2021, 02:38:44 PM »
I guess we are not able to add custom flags in start conditions.

We have Food, Tool, Clothing, and Fuel. The big flags, so to speak.
I don't think Luke implemented custom items at the start.
Your try with 'initialcustom7Count' is a good try but I don't think
there is such value in the game engine.

If you make them edible, though. Sorry.

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3920
  • Never confuse movement with progress
Re: Start Conditions
« Reply #5 on: March 11, 2021, 03:18:30 PM »
I could see that the start didn't show up at all.
I removed  ':defaults'
from "Game/StartCondition/StartConditions.rsc:defaults"
in A8JapaneseStart.rsc and it worked, but no eggs  :(

The game is possibly stuck with the old values in the engine.
Luke updated some, but not all, with new flags.

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #6 on: March 11, 2021, 04:32:27 PM »
Hmmm oh well. Thank you for the help though!

I will try my long workaround then haha

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #7 on: March 11, 2021, 05:20:11 PM »
Well, my workaround worked!

But I discovered another flaw... My game crashed when bannies try to add the silkworm eggs to storage and I have no idea why.

Anyone have a clue?

https://www.mediafire.com/file/kh842iq8fsmzdhc/A8JapaneseStart.zip/file

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3920
  • Never confuse movement with progress
Re: Start Conditions
« Reply #8 on: March 11, 2021, 10:20:55 PM »
Hi.
This will be a long post.
I have tried to run your Japanese start but had to remove the ':defaults' from the start line.
It works. With only that start file loaded, the eggs are put into the Kura.

Do you set up the new limits for use in your mod?

Here I have sample code from after the UI section in an Animal Pen that produces fertilizer (Custom4)
I have to add the NewLimitStringTable instead of StringTable at certain points to have the new limit to display.

Code: [Select]
ResourceLimitUIConfig resourceLimitConfig
{
ResourceLimit _resourceLimit = Custom4;
}

RibbonDescription resourceLimit
{
Alignment _alignment = TopRight;
bool vertical = false;
int _topPad = 8;
int _cellPad = 8;

ElementDescription _elements
[
"labelLimit",
"editLimit",
]

Dialog _toolTipDialog = "Dialog/ToolTip.rsc";
StringTable _toolTipStringTable = "Dialog/NewLimitStringTable.rsc:gameDialogs";
String _toolTipText = "Custom4LimitTip";
}

LabelDescription labelLimit
{
Alignment _alignment = MidLeft;

Font _font = "Font\FontSmall.rsc";
int _imageWidth = 20;
int _imageHeight = 20;
int _spacing = 4;
LabelPosition _labelPosition = TextRight;
Alignment _textAlignment = MidLeft;

StringTable _stringTable = "Dialog/NewLimitStringTable.rsc:gameDialogs";
String _text = "Custom4Limit";
SpriteSheet _spriteSheet = "Dialog/NewLimitSpriteSheet.rsc";
String _spriteName = "LimitRawMaterials";
}

SpinnerDescription editLimit : "Dialog/SharedElements.rsc:spinnerSmall6"
{
int _increment = 100;
ElementDescription _border = "Dialog/SharedElements.rsc:flatButtonEnabledBorder";
}

I have attached the necessary files for using new limits and display the custom items in certain places.

The files in the Template folder (and the file limitResources.rsc) have to be added to be sure that new items
display correctly in vanilla buildings. Luke didn't do it. We have to add it ourselves.

You are welcome to any of my sources in 'The Laboratory' to check the usage of the new limits.

Remove the ':defaults'.
You must load what is above defaults. It did not work until I removed it.

All this does not answer why your game crashes.
You probably have other files loaded that interfere with your mod.
For example - The Kura file in your Housing mod does not have Custom7 flags.
It could be a conflict. Try ONLY the start file to see if it works.

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3920
  • Never confuse movement with progress
Re: Start Conditions
« Reply #9 on: March 12, 2021, 12:26:13 AM »
Your workaround is quite nice! :)
I learned something today. Thanks

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 11030
Re: Start Conditions
« Reply #10 on: March 12, 2021, 01:07:00 AM »
dont you need to process the new limit flags before calling anything else in your root resource file ?
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #11 on: March 12, 2021, 07:24:06 PM »
Having done some testing, I have discovered that the silkworms eggs don't show up at all when I tried trading for them. I think I will have to try adding your custom limit files to see if that works. I don't have anything that creates them, they are only a good you can get by trade (theoretically).

I did remove the ':defaults' part, which had no affect for me, I'm afraid. I will come back to this when I've had a chance to test the limit resource code you sent.

Thank you!

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #12 on: March 14, 2021, 06:19:43 PM »
It was the new limit files! I added what you gave me and it worked!

Is it ok if I use those files for the mod itself?

Thank you again! I would not have figured out how to fix this otherwise.

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3920
  • Never confuse movement with progress
Re: Start Conditions
« Reply #13 on: March 14, 2021, 10:19:05 PM »
:)

Way back we had a meeting about how to distribute the new limits that Luke made.
We all had things to say, but it was Kralyerg who made those files for us all to use.
I only wanted the two 'reserved' limits to be spared for the future.

You are totally free to use the files but do not change anything.

If you have a special need, you can use the reserved limits.
With a disclaimer, it should work with other mods. Usually, you don't need them.

It is up to you how often to use the files, but I think any major mod should have them.
It is easy to put a mod 'wrong' in the load order and wreck a good setup.

Offline angainor88

  • Modders
  • Trader
  • *****
  • Posts: 419
Re: Start Conditions
« Reply #14 on: March 15, 2021, 08:07:55 AM »
Thank you!

I came too late to modding, so I missed all those discussions haha. I'm not planning to make any changes to these; all the work has been done for me already!