Resources.cfg

Here you can post threads specific to the current release of the core (099)

Moderator: POL Developer

Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Resources.cfg

Post by Turley »

Ok I write it a bit more clear, as you would implement such a function in escript:

Code: Select all

Function HarvestRessource(resource, x, y, b, n, realm)
Var avail_units := GetUnits(resource, x, y, realm);
Var temp := avail_units / b;
If (temp > n)
  temp := n;
Endif
DepleteUnits(resource, x, y, realm, temp*b);
Return temp * b;
Endfunction
GetUnits and DepleteUnits are just simple functions per coordinate you store the cfg entry available_units and subtract from it plus regenerate them over time.

So b can be interpreted as the cost and n is the maximum amount of such a "cost-block".
In the simplest example you want something like maximum 5 units with a cost of 1 each would need 1,5 as param. It results/depletes 0-5
Or something like get maximum 3 units with a cost of 10 each means as params 10,3. This means possible results/depletions are 0,10,20,30
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Resources.cfg

Post by Yukiko »

OK. So 'n' represents the upper boundary of the cost to harvest. If I have understood it correctly then that's all I wanted to know. Maybe my math skills are too limited and someone more skilled than me could look at the equation and understand what 'n' represents. Thanks Turley. Hopefully I understood it correctly. :)
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Resources.cfg

Post by Yukiko »

Turley answered my question on Discord so I thought I'd post it here.

You either get the full b *n or b * a number between 1 and n or you get 0 depending on the availability of resources. It leaves whatever remains of the resource.
Post Reply