 |
 |
 |
 |
| Author |
Message |
Yukiko
Joined: 02 Feb 2006 Posts: 1094 Location: Southern Central USA
|
Posted: Wed May 24, 2006 3:47 am Post subject: Harvest Resource Questions |
|
|
In the POL docs the HarvestResource function is defined as:
| Quote: |
HarvestResource( resource, x, y, b, n )
Where: resource is a string, x and y are integer world coordinates, b is an integer and n is an integer
Attempts to harvest a resource from a location.
Notes: Harvests a*b resource units, where 0 is less than or equal to 'a' and 'a' is less than or equal to n. Thus you can request 0-40 units in groups of 5, etc.
|
My question is where is a defined? Is it a random number generated by the core?
I am trying to figure out how to regulate the number of resource units I get from chopping a tree. As I understand it I can change the value for b and that will determine the maximum units harvested per each function call. Now if I want to make the resources run out faster but not give all the resources to the player I can do this:
| Code: |
var wood_amount - := HarvestResource( "wood", tree.x, tree.y, 1, 10, me.realm );
wood_amount := CInt(wood_amount/2);
|
but is there a way to control that on the function call side of the equation? Will changing the value of b affect how many of the actual resources get sent to the player during the whole process of lumberjacking one tree? As it is with a .1 lumberjacking the script will give as many as 70 logs to my player. That seems just a bit high for a .1 skill level. |
|
 |
|
|
 |
 |
| Author |
Message |
Marilla
Joined: 02 Feb 2006 Posts: 329
|
Posted: Wed May 24, 2006 4:19 am Post subject: |
|
|
As I understand that to be written, a is the random number being generated.
You get a*b... b is sent to the function.
a will be >= 0 and <= n. So by setting n, you are setting the range that a will be in. Then it is multiplied by b, and that's your result.
So 0 would be the minimim ((a=0)*b), and n*b would be the max ((a=n)*b)
With that said, I can't say I know for a fact that's how it works. I know our players don't get anything close to 70 logs per chop, though. That said, we don't use the return value from that function to determine how much wood they get...
| Code: |
var wood_amount := HarvestResource ("wood", tree.x, tree.y, 1, 8);
if (!wood_amount)
SendSysmessage(me, "There's not enough wood here to chop.");
return 0;
endif
var skill := GetEffectiveSkill (me, SKILLID_LUMBERJACKING);
wood_amount := RandomInt(CINT(skill/33)) + CINT(skill/33) + 1;
if (!wood_amount)
wood_amount := 1;
endif
|
With this code, they get a reasonable amount, and the tree runs out in a reasonable amount of time. As you can see, though, we don't really use that return value at all, except to see when the tree is all out. Incidentally, the wood.cfg in /regions:
| Code: |
UnitsPerArea 50
SecondsPerRegrow 1800
Capacity 10000
Range 0 0 5119 4095
|
It seems possible that the max 8 value is what is coming out, and that when it hits 50, it's all done for that area, and the player has to move on. I haven't tested it extensively, but I wouldn't be surprised to see it that way, or something close.
Hope this helps! |
|
 |
|
|
 |
 |
|