Thread: Skipping functions

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    312
    The Source engine is huge and complicated. You probably need to toy about with "Think" functions to get this to work, and set the next 'think time' for your weapon (offset from gpGlobals->curtime - which is the current game time)

    This question is probably better directed at VERC Collective forums http://collective.valve-erc.com or Wavelength forums http://www.thewavelength.net

    edit: here's some mock code - it's been a long time since I did anything with the Source engine. You really ought to ask on VERC for a better answer.

    Code:
    DEFINE_THINKFUNC(ShootWeaponThink);
    DEFINE_THINKFUNC(ZoomSightThink);
    DEFINE_THINKFUNC(IdleThink);
    
    CMyWeapon::PrimaryAttack()
    {
       // Maybe some code here
       pPlayer->SetFOV(0,  75f, 0.2f);
       SetThink(&CMyWeapon::ShootWeaponThink);
       SetNextThink( gpGlobals->curtime + 0.5 ); 
    }
    
    CMyWeapon::ShootWeaponThink()
    {
       // weapon firing code
       SetThink(&CMyWeapon::IdleThink);
       SetNextThink( gpGlobals->curtime + 0.05 ); 
    }
    Last edited by Bench82; 04-20-2006 at 01:18 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Void Functions Help
    By bethanne41 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2005, 05:30 PM
  2. Functions and Classes - What did I do wrong?
    By redmage in forum C++ Programming
    Replies: 5
    Last Post: 04-11-2005, 11:50 AM
  3. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  4. Factory Functions HOWTO
    By GuardianDevil in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 01:41 PM
  5. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 05:39 AM