PDA

View Full Version : I've made a Craft Skill Calculator



NeeL
2013-10-08, 10:23 AM
Dear all,
I've searched the webs and this forum for a good calculator on the statistics on the craft skill. However, I found none.

So, I made one.
It's a bit of a cheat because it does not calculate at all, it rather tries all four scenarios 100.000 times. Nonetheless, I've created a bit of code which needs the input of your total craft skill modifier, the DC of the item you want to craft and the usual market price in gold pieces.
The output lets you compare the differences in destructive failure and success chance for using the skill in weeks/silver pieces and days/copper pieces, and again for taking +10 on the DC.

It's useful for the inexperienced player, deciding to craft something in days, or weeks and take 10 or not. However, it is in Matlab code, since my experience in C++ is too little. Is there someone here who is willing to change this into something more useful for the rest of the world?

function craftcalculator(modifier,DC,GPprice,take10)
%----- Corneel Eijsbouts - 8 oktober 2013 -----
%craftcalculator gives a probability to finish crafting or destroy crafting
%materials in portions of 7 days using copper pieces or weeks using silver
%pieces.
%Input arguments:
%- modifier: the total modifier on your craft skill
%- DC: the difficulty Class for creating the item
%- GPprice: The price of the item in gold pieces
%- take10: 1 or true for YES, 0 or false for NO
%
%Output columns:
%- chance of failure per week using the price in silver pieces
%- chance of success per week using the price in silver pieces
%- chance of failure in those 7 days using the price in copper pieces
%- chance of success in those 7 days using the price in copper pieces
%- chance of failure per week using the price in silver pieces with DC+10
%- chance of success per week using the price in silver pieces with DC+10
%- chance of failure in those 7 days using the price in copper pieces with DC+10
%- chance of success in those 7 days using the price in copper pieces with DC+10

repeations= 100000;
days=70;
weeks=10;
results=zeros(8,days); %Empty score table
a=DC;
for n=0:3 %the four situations (days/weeks, DC/DC+10)
if n==0
time=weeks;
DC=a;
elseif n==1
time=days;
DC=a;
elseif n==2
time=weeks;
DC=a+10;
elseif n==3
time=days;
DC=a+10;
end
for i=1:repeations
%setting amount of 'points' to gain with crafting
points=GPprice*10;
if (n==1 || n==3)
points=points*10;
end
t=1; %keeping track of time
while (points > 0 && t <= time)
d20=ceil(20*rand); %D20 throw
if take10
result=10+modifier;
else
result=d20+modifier;
end
check=result-DC;
if check <= -5 %If fail destructively
results(2*n+1,t)=results(2*n+1,t)+1;
points=0; %Crafting stops
elseif check >= 0 %If success
points=points-(result*DC);
end
if (points <= 0 && check > -5) %If crafting stops without failure
results(2*n+2,t)=results(2*n+2,t)+1;
end
t=t+1;
end
end
end
% NOTE: in Matlab a ' behind an array chances the columns and rows
weekscore=100*results([1 2 5 6],1:weeks)'/repeations; %Singling out the weekscores
dayscore=[(1:days)' 100*results([3 4 7 8],:)'/repeations]; %Singling out the dayscores
daysinweeks=zeros(size(weekscore)); %empty matrix for 7 days summations
for d=7:7:days
w=ceil(d/7);
daysinweeks(w,:)=sum(dayscore(d-6:d,2:end)); %filling with 7 day summation
end
totalresults=[weekscore daysinweeks];
totalresults=totalresults(:,[1 2 5 6 3 4 7 8]); %Last minute rearanging the columns
%Output
disp(' ')
disp(' Using the normal DC | Using the DC+10')
disp(' WEEKS (in sp) | PER 7 DAYS (in cp)| WEEKS (in sp) | PER 7 DAYS (in cp)')
disp(' failure success | failure success | failure success | failure success')
disp(totalresults)
For an spellcaster with Intelligence 10 (+0), 4 ranks Craft(alchemy) (+4), and masterwork artisan's tools or a alchemy lab (+2), crafting Burn Salve (DC 10, market value 15 GP), not taking 10:
input:
- total modifier: +6
- DC: 10
- Market value in GP: 15
- not taking 10: 0 or false


>> craftcalculator(6,10,15,0)

Using the normal DC | Using the DC+10
WEEKS (in sp) | PER 7 DAYS (in cp)| WEEKS (in sp) | PER 7 DAYS (in cp)
failure success | failure success | failure success | failure success
0 60.2950 0 1.1510 44.9130 35.1010 95.9030 3.7450
0 30.0340 0 97.1100 9.1110 6.9710 0.2140 0.1380
0 7.6650 0 1.7390 1.7410 1.3650 0 0
0 1.6200 0 0 0.3510 0.2740 0 0
0 0.3160 0 0 0.0800 0.0630 0 0
0 0.0530 0 0 0.0120 0.0080 0 0
0 0.0150 0 0 0.0030 0.0040 0 0
0 0.0020 0 0 0.0020 0.0010 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Using the the price in silver pieces, you've a 60% chance in being done in one week, 30% in two weeks, and nearly 10% to take longer than two weeks.
While in copper pieces, you know almost certain to take longer than a week but not more than two weeks. DC+10 is not recommended. :smallsmile:

Vortenger
2013-10-08, 11:18 AM
I'm not savvy enough to follow up on this but I do feel it necessary to say thanks! I'll be keeping an eye on this thread to see if I can use this at a later date. This'll be really useful to both the groups I play in.

NeeL
2013-10-09, 07:30 AM
I've had contact with Neek who has made a php script that executes the craft for you, five years ago (http://www.giantitp.com/forums/showthread.php?t=100879). His program isn't on-line any more, but if there is somebody willing to host it (and maybe able to fix/improve the code where necessary) I can forward it to you.

In the distant future I'll probably convert my script into C++ and from there I can make it into an Windows executable. But before I can do that, I have to learn C++ al over again, for which I do not have the time.