Raised This Month: $ Target: $400
 0% 

Solved Find a random spawn location around an origin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
zXCaptainXz
Member
Join Date: May 2017
Old 02-14-2022 , 15:39   Re: Find a random spawn location around an origin?
Reply With Quote #2

I won't pretend like I even barely understood how this function works, but maybe you could try shuffling the array randomly before scanning?

Code:
    
new randIndex, tmp;
for(new i; i < sizeof(iOrder); i++)
{
    randIndex = random(sizeof(iOrder));
    tmp = iOrder[i];
    iOrder[i] = iOrder[randIndex];
    iOrder[randIndex] = tmp;
}
EDIT: I was doing some digging and I found this function, maybe you could make some use of it instead of all this mess?

Code:
stock bool:is_monster_hull_vacant( ent, const Float:origin[ 3 ] )
{
    new iTr = 0;
    engfunc( EngFunc_TraceMonsterHull, ent, origin, origin, 0, ent, iTr );

    if( !get_tr2( iTr, TR_StartSolid ) && !get_tr2( iTr, TR_AllSolid ) && get_tr2( iTr, TR_InOpen ) )
        return true;
        
    return false;
}

Last edited by zXCaptainXz; 02-14-2022 at 15:52. Reason: Adding stuff
zXCaptainXz is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode