The Daily Click ::. Forums ::. Klik Coding Help ::. Probability - Another dumb question
 

Post Reply  Post Oekaki 
 

Posted By Message

Santa



Registered
  19/05/2003
Points
  644
1st June, 2003 at 10:30:45 -

Yup, Me again - asking silly questions again.

Ok here goes, i wanna make something happen based on a probability set by the user. 5 numbers, I want the user to be abe to say well, 0% chance of a number 1 10% chance of a number 2 etc......

I cant really figure a way of doing this without using way two many numbers.

 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
1st June, 2003 at 10:52:56 -

You might want to randomize values. (Use with alterable value e.g. Start of Frame ---> Set Active's Alterable Value A to Random( [the number] ) ). If you need more help just reply saying what you need help in.

 
http://www.klik-me.com

Santa



Registered
  19/05/2003
Points
  644
1st June, 2003 at 14:13:55 -

lol what help do i need eeek, lol im stupid..... im not getting this at all, i know its probably real simple but im struggling.

If i make 6 random numbers the chances of the 6 numbers being chosen is 1/6 i could use a line that says if 1 then activate group 1 etc... But i want to be able to increase the chances of numbers, normally i would do this by making a random number between say 1 and 100, then saying if its greater than 1 but less than 20 then activate 1 if its greater than 20 and less than 50 activate group 2 that would work fine except i want the user to be able to change the chances.

EEk help lol

 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
1st June, 2003 at 23:15:08 -

Hmm.. I don't really get what you're trying to say. How bout giving an example or something? Is it really necessary to use more than one random number?

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
2nd June, 2003 at 04:48:47 -

The easiest method of doing a probability state movement is by setting the object's alterable value to a random number, like Alebrain said. Then when the value is equal to a value then make the object do something eg.

Always - set fly.alt a to random (10)

If fly.alt a = 1 - Shoot a bullet at player.

Just remember that setting something to random 10 is setting it to a random digit starting at 0. Which means this counter goes from 0-9 (10 digits.)

The only problem with this is that there is an equal chance of any of the statuses being selected.

One way to make some options have a greater chance of being picked would be:


Always - set fly.alt a to random (10)

If fly.alt a = 0 - Shoot a bullet at player.
If fly.alt a = 1 - Shoot a bullet at player.
If fly.alt a = 2 - Shoot a bullet at player.

If fly.alt a = 3 - Evade Player.
If fly.alt a = 4 - Follow Player.

This creates a 3/10 change for shooting at the player, and a 1/10 chance for evading or following the player.

That's just one way. Now i feel like writing an A.I Article.

-Andy

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Santa



Registered
  19/05/2003
Points
  644
2nd June, 2003 at 06:05:33 -

aH YEAH - I missunderstood - that would work great

 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

Santa



Registered
  19/05/2003
Points
  644
6th June, 2003 at 16:26:00 -

Ok, im back again, didnt really take the time to read this properly, just printed it out and filed it away for future reference, when i did read it through a little slower i realised this wont solve my problem.

HEres what i want to do, I want to be able to activate one of several groups at random, but only one. I want the user to be able to set the probability of these groups being activated using a percentage value.

Using the above examples i wouldnt be able to allow the user to change the probability.


 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
6th June, 2003 at 17:25:19 -

To do that you just use the same principal, have a counter and set it to random 10 or something.

counter = 0 - activate group 1
counter = 0 - activate group 1
counter = 0 - activate group 1
counter = 1 - activate group 2
counter = 2 - activate group 3

That should work the same. And then you make it so when the counter isn't 0 deactive group 1. Do the same for 1 and 2 aswell.


 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Santa



Registered
  19/05/2003
Points
  644
6th June, 2003 at 18:46:08 -

THis would make it choose the groups at random, but the user wouldnt be able to change the probability, because to change the probability you would have to change:

counter = 0 - activate group 1
counter = 1 - activate group 2
counter = 2 - activate group 3

more lines would have to be added or removed to match the options the user selects.

Im sorry if i am being totally thick n missing the point here, Im a newbie n it sucks

 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

Santa



Registered
  19/05/2003
Points
  644
6th June, 2003 at 21:32:40 -

Whoooopie, Ever noticed how things seem easyer when ya had a few beers to help ya brain hehe ..... was just on my way to bed n figured out the answer to my problem, so i got back up and tapped away for 20 minutes, and yup it worked.

I realise that their is probably a much simpler way of doing this, and if anyone looks at my example i would like their feedback. ignore the ini part of this demo, figured i would learn how to make a ini whilst i was at it hehe

http://www.atnas.com/clickstuff/probability.gam
http://www.atnas.com/clickstuff/probability.exe

Cheers for ya help Andy, ya been good 2 me, please have a look and tell me what u think.

 
SAnTA - www.atnas.com

-------------------
www.create-games.com/download.asp?id=2918

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
6th June, 2003 at 22:04:05 -

Yea, pretty cool, it's good to know that i'm a help.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
   

Post Reply



 



Advertisement

Worth A Click