View Single Post
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-29-2018 , 09:07   Re: ROG - A better random origin generator
Reply With Quote #4

Quote:
Originally Posted by EFFx View Post
Tested a little, and got these feedbacks:

A check for de_mon map:

PHP Code:
if((fOrigin[2] <= -1000.0) || (fOrigin[2] >= 350.0)) 
Because it generates points under the map, if you guys didn't know, the de_mon map has another simple map under the original one. So with the <= -1000.0 it doesn't spawn entities there.
About the >= 350.0, it's generating points in the montains, which is bad, because players can drop there and camp forever.
We're already aware of the outside areas and the hill sides. I made a stock that can be used in maps where the outside area is underground (such as de_mon). As for the 'mountains' I still don't have a solution.

PHP Code:
public Float:GetValidPoint( )  
{  
    new 
Float:fPoint];  
    
fPoint] = GetLowestPoint( );  

    
fPoint] += 10.0;  
    while( ( 
engfuncEngFunc_PointContentsfPoint ) == CONTENTS_SOLID ) || ( engfuncEngFunc_PointContentsfPoint ) == CONTENTS_WATER ) )  
    {  
        
fPoint] += 1.0;  
    }  
          
    new 
pcCurrent engfuncEngFunc_PointContents fPoint );  
          
    if( 
pcCurrent == CONTENTS_EMPTY )  
    return 
fPoint];  
          
    return 
0.0;  
}  

public 
Float:GetLowestPoint( )  
{  
    new 
pcCurrent;  
    new 
Float:fStartingOffset];  
      
    while( ( 
engfuncEngFunc_PointContentsfStartingOffset ) == CONTENTS_SOLID ) || ( engfuncEngFunc_PointContentsfStartingOffset ) == CONTENTS_WATER ) || ( engfuncEngFunc_PointContentsfStartingOffset ) == CONTENTS_EMPTY ) )  
    {  
        
fStartingOffset] -= 5.0;   
    }  
      
    
pcCurrent engfuncEngFunc_PointContents fStartingOffset );   

    if( 
pcCurrent == CONTENTS_SKY )  
    return 
fStartingOffset];  
      
    return 
0.0;  

Usage
PHP Code:
new Float:fLowestPoint GetValidPoint( ); 
FYI, -350.0 is a non stuck-free origin in de_mon. ~ -420.0 is the minimum.
__________________

Last edited by edon1337; 07-29-2018 at 09:09.
edon1337 is offline