Problem with GetHarvestDifficulty & HarvestResource func
Posted: Thu Apr 03, 2008 8:38 am
I want modiffy my script bladed.src. I have get thoose code from ZH 095:
WHen I try chip some kindling, I always get thoose frase:
Please, if have some one thoose problem, or know how to enable thoose functions that they will working pretty, helpme.
Code: Select all
function CarveTree(who, blade, use_on)
blade := blade;
if(abs(who.x-use_on.x)>2 || abs(who.y-use_on.y)>2)
SendSysMessage(who, "You are not close enough");
return;
endif
PrintTextAbove(who, "*Trying to get some kindlings*",_DEFAULT_TEXT_FONT,52);
if(GetStamina(who)<= 1)
SetStamina(who, 0);
SendSysMessage(who, "You have to rest a while!",3,33);
return;
else
SetStamina(who, GetStamina(who) - 1);
endif
sleep(1);
CheckToolWear (who, blade, SKILLID_LUMBERJACKING);
var count := GetHarvestDifficulty("wood", use_on.x, use_on.y, use_on.objtype);
if((count == error) or (!count))
SendSysMessage(who, "There's not enough kindling here to chip.");
return 1;
endif
var wood_amount := HarvestResource( "wood", use_on.x, use_on.y, 1, 5 );
if((wood_amount == 0) or (!wood_amount))
SendSysMessage(who, "There's not enough kindling here to chip.");
return 1;
endif
CreateItemInBackpack(who, UOBJ_KINDLING, 1);
DestroyItem(use_on);
SendSysMessage(who, "You chip off some kindling and put it in your backpack");
endfunction
If I disable first function check GetHarvestDifficulty, I have problem with second function HarvestResource.There's not enough kindling here to chip.
Please, if have some one thoose problem, or know how to enable thoose functions that they will working pretty, helpme.