[eluser]IamPrototype[/eluser]
0.8.. user level, right?
So it goes like this:
Code:
<?php
$weapon = 544;
$job_difficulty = 4000;
$fudge = 0.8;
$success = (($weapon * rand(1,100)) / $job_difficulty) > $fudge;
if ($success)
{
echo "YES";
}
else
{
echo "NO";
}
?>
Output: YES
So the job will be successful no matter what... and... uhm, wouldn't it be a lot more "real life" if you was able to successful the job BUT sometimes you could fail. Your code is really good, but the higher your level and weapon is the higher the chance is to successful, but sometimes you will fail because something did happen.. like you lost your... thing... etc. It's hard for me to explain, let me try this way:
In MouseHunt.. you'll start catching white and brown mices, when you're on the next level.. you'll be able to catch better mouses, but sometimes you still fail catching the white and brown etc. because the mouse got the cheese without setting the trap off, get the idea?
EDIT: Just tried to update my scripts a few times.. and I DO fail sometimes, sorry, I didn't notice. I guess the random number between 1 and 100 does that part, right?
---
Anyways, the jobs could have a certain amount of EXP, nothing random, but a number that I'll pick. So everytime the job is a success the users fudge will be plussed with the EXP.
I could code an extension for the default controller and check the users level, or would that be a bad idea? What I'm thinking of is:
Code:
if ($user_level > 500) {
// update level
} else {
if($user_level > 1000) {
// update
} // and so on
}
I guess that wouldn't be the best way on how to do it

And receiving the levels from a database table would be better, so I could create custom levels whenever I want to.. would it be good to use some loop here, or?
P.S: You're helping me a lot, thanks!