Need help with equations/Percentages.
by Eric Schuld · in Torque Game Builder · 03/05/2009 (1:40 pm) · 4 replies
I am making a game that uses equations and percentages. Basically what I want to do is have people walking by a store and they will have a certain chance to stop and buy that product. Also They will have a chance to like or dislike that product.
What behavior models would I use for that andhow would I add the percentages & Equations?
What behavior models would I use for that andhow would I add the percentages & Equations?
#2
03/05/2009 (2:39 pm)
There is a function called "getRandom()" that will return you a number between 0.0 and 1.0. You could set up a trigger in front of the store and each person who hits it could have a percentage chance of stopping. If the person had a variable called "chanceOfStopping", you could simply do something like:if( getRandom() < Shopper.chanceOfStopping )
{
// He buys something here
}
#3
03/05/2009 (2:45 pm)
That is good to know. If I add weather effects could I make that effect the getrRandom behavior. Like if I'm selling icecream and its 95 degree out there is a slight better chance the person would buy a cone. Or if it's rainy and cold it lowers the chance?
#4
03/05/2009 (2:55 pm)
I can't tell if you're asking or saying, Eric, but yes, you could do that. Before you find the results, just add the factors, then get your random and punch it into your formula and then get your result.
Torque 3D Owner Jason Ravencroft