Have actor perform action based on probability

Hello everyone.

I would like for an actor to perform an action based on probability. For instance if the actor has a 33% chance of going right rather than left. How can I randomize this action based on that percentage.

My first thought is creating a probability table based on left or right. Create a set number of columns for each percentage, the. Create 100 rows with left or right entered in each cell.

For example.... if the column percentage is 75% then 75 of the 100 columns would read left instead of right. Then I would create a behavior based on a random selection of that column/row and what lever is returned the actor will act.

Is there any easier way to do such a thing?

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited January 2017

    @campsjkevin

    what about

    Rule: If random(1,100) <= 33 then
              Turn Right
    Otherwise
              Turn Left
    
  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2017

    Move / Direction random (1,3)*180

Sign In or Register to comment.