There are two pieces of data - the think function and the think time.
You have to set both.

For goldsrc:

// this will schedule a think right away
SetThink ( &CCan::CanThink );
pev->nextthink = gpGlobals->time;

If you want the think function to get called again every second then you
need to reschedule the call in CanThink

void CCan::CanThink()
{
//...
      pev->angles = angles;
      ALERT(at_console,"Can Thinking...");

        // think again in 1 second
        pev->nextthink = gpGlobals->time + 1;
}

Source has the same concept, but also adds multiple think contexts (an
entity can be processing more than one think simultaneously) and the
syntax is a bit different.

Jay



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Drak
> Sent: Sunday, April 15, 2007 5:27 PM
> To: [email protected]
> Subject: [hlcoders] Setting Think
>
> This is a multi-part message in MIME format.
> --
> [ Picked text/plain from multipart/alternative ]
> (GoldSrc)
>
> Why is it when I use "SetThink", it doesn't really do
> anything, it will randomly call the function. What exactly is
> it doing? What I'm trying todo is, set the entitys angles
> every second.
> (Trying to make the UT weapon spining on a entity)
>
> void CCan::CanThink( void )
> {
>      Vector angles;
>      angles = pev->angles;
>
>      angles.y += 25.0 / 10.0;
>      if(angles.y >= 180.0)
>      {
>          angles.y -= 360.0;
>      }
>      pev->angles = angles;
>      ALERT(at_console,"Can Thinking..."); }
>
> And in the spawn function, i set "SetThink( CanThink);" But
> this function never calls, should it be located somewere else?
>
> --
>
>
> _______________________________________________
> 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

Reply via email to