Well there's one obvious flaw I see in this code. Not sure if it's related to
your problem..
>// at least one intermission spot in the world.
>iRand = RANDOM_LONG( 0, 3 );
>
>while ( iRand > 0 )
>{
> pNewSpot = FIND_ENTITY_BY_CLASSNAME( pSpot, "info_intermission");
>
> if ( pNewSpot )
> {
> pSpot = pNewSpot;
> }
>
> iRand--;
>}
In this loop, if you come to the end of the list of info_intermissions in the
world, the loop will freeze on the last one. When FIND_ENTITY_BY_CLASSNAME
returns NULL (indicating no more info_intermissions), pSpot is not updated. In
the next iteration, pSpot will be the same, and FIND_ENTITY_BY_CLASSNAME will
return NULL again. This will continue, pSpot being stuck on the last
info_intermission in the map, until the iRand counter runs out.
What you want to do is this:
iRand = RANDOM_LONG(0, 3);
while (iRand-- > 0)
{
pSpot = FIND_ENTITY_BY_CLASSNAME(pSpot, "info_intermission");
if (!pSpot)
{
pSpot = FIND_ENTITY_BY_CLASSNAME(NULL, "info_intermission");
// if pSpot is still NULL at this point, there is
// no info_intermission in the map
}
}
That way if the loop gets to the last info_intermission in the map, it will
loop back around to the first one.
You might also want to increase that 3 in the first statement to a larger
number, just in case some mapper puts a buttload of info_intermissions in the
map (so the first 4 won't be the only ones used).
---Reedbeta
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders