benlucraft Posted January 20, 2016 Share Posted January 20, 2016 Hi guys does anyone know how the sums on creating crimes work? I've never been good at mathematics lol Thanks in advance guys Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted January 20, 2016 Share Posted January 20, 2016 Hi guys does anyone know how the sums on creating crimes work? I've never been good at mathematics lol Thanks in advance guys Yea the formula was annoying i recoded the crime system Quote Link to comment Share on other sites More sharing options...
benlucraft Posted January 20, 2016 Author Share Posted January 20, 2016 Yea the formula was annoying i recoded the crime system Tell me about it do you have or does anyone you know have maybe a mod that changes the create a crime function to set crime pass based on level or stats?? Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted January 21, 2016 Share Posted January 21, 2016 In docrime.php, the $sucrate (or success rate) is determined, by default, using basic maths - algebra, to be exact. $find = ['LEVEL', 'CRIMEXP', 'EXP', 'WILL', 'IQ']; $repl = [$ir['level'], $ir['crimexp'], $ir['exp'], $ir['will'], $ir['IQ']]; $sucrate = str_replace($find, $repl, $r['crimePERCFORM']); The default formula upon crime creation is ((WILL*0.8)/2.5)+(LEVEL/4) Remember that "BODMAS", BIDMAS", "PEMDAS", or however you remember it, all play in here - I was taught the "BIDMAS" method, though they all mean basically the same thing. Brackets Indices Division Multiplication Addition Subtraction (in that order) Now, for example, we'll use the "stats" that would be there as a brand new player (i.e. Will = 100, Level = 1, CrimeXP = 0, EXP = 0, IQ = 10) Break up the formula, brackets comes first. ((100 * 0.8) / 2.5) = 80 / 2.5 = 32 (1 / 4) = 0.25 32 + 0.25 = 32.25 So, that leaves us with 32.25. Now, because of the way that the docrime.php is setup, the closer to 100 the formula equals, the easier the crime (anything above 100 is treated as success anyway). With that logic, and with a newbie (to your game), there's at least 32.25% chance of successfully completing that crime. I say "at least" because there's also a rand() in there too, adding to the chances of success The output from the crime failure is simple. It's a 50% chance of just a fail or jail time. --------- You can easily add to that str_replace() logic at the top, adding more things like 'TOTAL_STATS', 'STRENGTH', 'MONEY', etc. (and obviously add the replacements too) to be able to use more modifiers. Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 27, 2016 Share Posted March 27, 2016 (edited) No matter what I try I get division by zero. My first crime is just set at 100, so everyone can begin crimes. My next set I wanted to be their will % -.- zero=zero=zero Just saying I graduated from school about 15 years ago and .92 = 92% My issue is NOT going over 100 -.- Edited March 27, 2016 by boionfire81 hating math Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 27, 2016 Share Posted March 27, 2016 I think it is because that .92 is less than zero. I have never been a big fan of this approach, I guess its to make it more dynamic but just putting in a number for it makes life a lot easier. Also, makes crimes tougher for all the stat whores out there Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 27, 2016 Share Posted March 27, 2016 well technically it's more than 0, but less than 1 lol but I'm thinking the mccode dude agrees with you. But almost every value would = a 0.*** prior to any further instructions. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 27, 2016 Share Posted March 27, 2016 Yeah I didn't mean less than zero lol. But you can't divide by zero hence your error. In regards to issue of not going over 100%, it doesn't matter 310% is the same as 100%. You just work out the calculations like MTG showed you can see what you may expect. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.