well, do a dry run of the code on paper to make sure my logic is correct.. you probably want while (pObject == pLast ) at the bottom of the while loop, and to set pLast as a member varible for the class and dont set it to NULL on entry to the function.
----- Original Message ----- From: "Yacketta, Ronald" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 14, 2001 4:04 PM Subject: RE: [hlcoders] # of entities > Hrmmm I rip'ed that code from SpawnSpot... > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of _Phantom_ > Sent: Wednesday, November 14, 2001 11:01 AM > To: [EMAIL PROTECTED] > Subject: Re: [hlcoders] # of entities > > > your resetting pLast to NULL each time this function is called, in > effect you are doing > > * find camera (first one) > * save to pLast > * loop while camera != pLast (so if the camera == first one we loop, oo > second camera != first one) > * use pobject (second camera) > * exit function > > thus each time you are finding the same camera (the second one I would > guess) > > ----- Original Message ----- > From: "Yacketta, Ronald" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, November 14, 2001 2:37 PM > Subject: RE: [hlcoders] # of entities > > > > OOPS! Wrong cvs tree ;) > > > > There is a > > pLast = pObject; > > In between the for {} and do {} while (); > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]] On Behalf Of Yacketta, > > Ronald > > Sent: Wednesday, November 14, 2001 9:35 AM > > To: [EMAIL PROTECTED] > > Subject: RE: [hlcoders] # of entities > > > > > > Tis what I have so far, another issue I am having.. > > The first trigger_camera is fired clean (developer 100 running) Second > > > pass, the player is dropped to a SpawnSpot *boogle* then Back to a > > camera *boggle*. The player should "never" leave the Camera's UNTIL a > > team/class is selected. > > > > void CBasePlayer::PreThink(void) > > { > > blah blah blah > > ... > > CBaseEntity *pObject = NULL; > > CBaseEntity *pLast = NULL; > > > > // If joe-blow is not on a team, find a camera and > > // for him to use it! > > // stay in camera mode until a team/class is selected > > if ( (!FStrEq(this->m_szTeamName, TEAM_PS) ) > > && (!FStrEq(this->m_szTeamName, TEAM_GHOST) ) > > && (!FStrEq(this->m_szTeamName, TEAM_SPECTATOR) ) ) > > { > > // Thanks ReedBeta for the timer idea! > > if (gpGlobals->time > m_flNextCameraTime) > > { > > // Taked from EntSelectSpawnPoint > > > > for ( int i = 2; i > 0; i-- ) // TODO: remove > > the static 2, replace with dynamic code > > // That > > will find the # of trigger_cameras in the map > > { > > pObject = UTIL_FindEntityByClassname( pObject,"trigger_camera" ); > > if(!pObject) > > continue; > > } > > > > do > > { > > UTIL_LogPrintf("doing the do\n"); > > // increment pObject > > pObject = UTIL_FindEntityByClassname( > > pObject, "trigger_camera" ); > > } while ( pObject != pLast ); > > > > // End EntSelectSpawnPoint > > pObject->Use(this,this,USE_TOGGLE,0); > > > > m_flNextCameraTime = gpGlobals->time + 15; > > } > > } > > ... > > ... > > ... > > } > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]] On Behalf Of botman > > Sent: Wednesday, November 14, 2001 9:01 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [hlcoders] # of entities > > > > > > > Grrrr... That erks me now ;) > > > I can find all 3 trigger_cameras in a level, but every time > > > PreThink() > > > > > is called The same trigger_camera is fired *sigh* even though I have > > > > a > > > > > do{} while (pLast != pObject); (similar to the > > > Spawn selection code) > > > > > > -Ron > > > > Is pLast declared global (or static within the function)??? Maybe > > it's always starting at the first one each time. > > > > Jeffrey "botman" Broome > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > > please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > > please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders