View Single Post
  #2 (permalink)  
Old 2006-09-03, 04:38 AM
Sinzygy Sinzygy is offline
Junior Member
 
Join Date: Sep 2006
Posts: 1
Sinzygy is on a distinguished road
Default

uhm, i guess i would do it this way:

PHP Code:
function random_search($s_moves)
{
    if(
$s_moves >= 1)
    {
        
$rand round(rand(1,7));

        if(
$rand == 1)
        {
            
//Found nothing
        
}
    
        else if(
$rand == 2)
        {
            
//Found $5
        
}

        
// go on like this, for every number a special event

    
        //Now you gotta decrease the players search moves by one

        //and now return your result
    
}


If you want to make some events occur with different chances:

Just change
PHP Code:
$rand round(rand(1,7)); 
to
PHP Code:
$rand round(rand(1,100)); 
and then
PHP Code:
        if($rand <= 50)
        {
            
//50% chance to find nothing
        
}
    
        else if(
$rand 50 && =<60)
        {
            
//105 chance to find $5
        

hope that helps.

- Sinzygy
Reply With Quote