Resources.cfg

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

Moderator: POL Developer

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

Re: Resources.cfg

Post by Turley » Mon Aug 28, 2017 9:08 am

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: 2411
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Resources.cfg

Post by Yukiko » Mon Aug 28, 2017 9:37 am

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. :)
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

Yukiko
Distro Developer
Posts: 2411
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Resources.cfg

Post by Yukiko » Mon Aug 28, 2017 11:08 am

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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

Post Reply