nevermind that, the earlier code of the timer starting in 
weapon_superfrag isn't working and been working on fixing that.

I now have the following code in weapon_superfrag.cpp

in(mind you that I put it in this event just for testing purposes):
case EVENT_WEAPON_SEQUENCE_FINISHED:
            SetTimer( GRENADE_TIMER );
            break;

then on to the code in SetTimer:

void CWeaponSuperFrag::SetTimer( float ThrowDelay )
{
    m_flThrowTime = gpGlobals->curtime + ThrowDelay;
   
    if( gpGlobals->curtime > m_flThrowTime )
    {
        ThrowAfterDelay();
    }
}

then the last function that is gonna eventually force a throw(right now 
I just want it to do what the EVENT normally does, to decide if the 
grenade is ready to throw or not, again for testing purposes):

void CWeaponSuperFrag::ThrowAfterDelay()
{
    m_fDrawbackFinished = true;
}

but in game the grenade just stays as DrawbackFinished = false and never 
moves to true.
so any idea where it's going wrong?

Tony Sergi schreef:
> Weapon_superfrag can't load things simply 'because the header is
> included'. In order to do things from weapon_grenade, weapon_superfrag
> needs to be a CHILD of weapon_grenade. For customizations, you then
> override functions with the same name, by adding the overriding
> functions into superfrag.
>
> If you want to make weapon_superfrag do something different from the
> normal one, you override the function you need to change so that it does
> the same code with different options. This is inheritance.
>
> -Tony
>  
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Yorg Kuijs
> Sent: September-26-08 9:19 AM
> To: Discussion of Half-Life Programming
> Subject: Re: [hlcoders] grenade code
>
> alright I think I fixed the previous problems
> but can't really test it yet.
> Right now in weapon_superfrag it does SetTimer bla bla bla and what is 
> actually that timer is named m_flThrowTime
>
> in grenade_superfrag.cpp it uses m_flDetonateTime now what I need to 
> make is m_flDetonateTime = m_flThrowTime
> so that it basically keeps counting from the timer that started before 
> grenade was thrown(otherwise it would reset the timer when you throw it)
>
> I know weapon_superfrag can load things from grenade_superfrag because 
> the header file is included, how would I handle this reversed? 
> weapon_superfrag does NOT have a header file, also the m_flThrowTime is 
> actually declared in weapon_basehlmpcombatweapon(or something like it)
>
>
>
> _______________________________________________
> 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
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.169 / Virus Database: 270.7.3/1693 - Release Date: 26-9-2008 7:35
>
>   


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to