Raised This Month: $ Target: $400
 0% 

Change effect of HE Grenade..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 03-15-2011 , 09:18   Change effect of HE Grenade..
Reply With Quote #1

Hello. How can I change effect when HE Grenade is exploding and block his DMG?
Screeaam.. is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2011 , 09:20   Re: Change effect of HE Grenade..
Reply With Quote #2

Hook when grenade will explode and block it.
Then you can add your own effects when it should explode.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 03-15-2011 , 09:25   Re: Change effect of HE Grenade..
Reply With Quote #3

But how to hook?
Screeaam.. is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2011 , 10:18   Re: Change effect of HE Grenade..
Reply With Quote #4

Look at FrostNades code by XxAvalanchexX.
It is in the Unapproved Plugins section.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 03-15-2011 , 14:59   Re: Change effect of HE Grenade..
Reply With Quote #5

I found..

Should it run?

PHP Code:
RegisterHam(Ham_Think,"grenade","ham_grenade_think",0); 
Can someone translate each of the lines of the code? :

PHP Code:
// grenade is ticking away
public ham_grenade_think(ent)
{
    
// not a frostnade
    
if(!pev(ent,pev_bInDuck)) return FMRES_IGNORED;
    
    new 
Float:dmgtime;
    
pev(ent,pev_dmgtime,dmgtime);
    if(
dmgtime get_gametime()) return FMRES_IGNORED;
    
    
// and boom goes the dynamite
    
frostnade_explode(ent);

    return 
FMRES_SUPERCEDE;

And into my code must I include this:

PHP Code:
fw_setmodel(ent,model[]) 
?

Last edited by Screeaam..; 03-15-2011 at 15:01.
Screeaam.. is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2011 , 16:48   Re: Change effect of HE Grenade..
Reply With Quote #6

PHP Code:
// -- handling function for "grenade" entity thinking
public ham_grenade_think(ent// -- "ent" is the entity index
{
    
// -- ignore this part because it isn't needed here
    // not a frostnade
    //if(!pev(ent,pev_bInDuck)) return FMRES_IGNORED;
    
    // -- get the gametime value of when the grenade should explode
    
new Float:dmgtime;
    
pev(ent,pev_dmgtime,dmgtime);
    
    
// -- check if the explode time has not happened yet
    
if(dmgtime get_gametime()) return FMRES_IGNORED;
    
    
// -- call function made for frostnade damage/effects.
    // -- this can be ignore and/or changed to your own function
    // and boom goes the dynamite
    
frostnade_explode(ent);

    
// -- block grenade from exploding
    
return FMRES_SUPERCEDE;

Quote:
Originally Posted by Screeaam.. View Post
And into my code must I include this:

PHP Code:
fw_setmodel(ent,model[]) 
?
No. The author only included that for trails.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 03-15-2011 , 17:34   Re: Change effect of HE Grenade..
Reply With Quote #7

Thanks.

I have to do a certain condition in the function that she knew that it was a grenade HE and not eg Smoke Grenade ? Or this just know "This is HE" ?


Can I give You some reputation or so on this forum?
Screeaam.. is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 03-15-2011 , 18:10   Re: Change effect of HE Grenade..
Reply With Quote #8

exolent, the return type shouldn't be with HAM_* prefix?
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 03-15-2011 , 18:33   Re: Change effect of HE Grenade..
Reply With Quote #9

In FrostNades code by XxAvalanchexX in this function is return FMRES_SUPERCEDE;


But tell me, I need to do a certain condition what Grenade is it?
Screeaam.. is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2011 , 21:26   Re: Change effect of HE Grenade..
Reply With Quote #10

Quote:
Originally Posted by tuty View Post
exolent, the return type shouldn't be with HAM_* prefix?
PHP Code:
#define HAM_IGNORED        1    /**< Calls target function, returns normal value */
#define HAM_HANDLED        2    /**< Tells the module you did something, still calls target function and returns normal value */
#define HAM_OVERRIDE    3    /**< Still calls the target function, but returns whatever is set with SetHamReturn*() */
#define HAM_SUPERCEDE    4    /**< Block the target call, and use your return value (if applicable) (Set with SetHamReturn*()) */ 
PHP Code:
#define FMRES_IGNORED    1    // Calls target function, returns normal value
#define FMRES_HANDLED    2    // Tells metamod you did something, still calls target function and returns normal value
#define FMRES_OVERRIDE    3    // Supposed to still call the target function but return your value instead
                            // however this does not work properly with metamod; use supercede instead.
#define FMRES_SUPERCEDE    4    // Block the target call, and use your return value (if applicable) 
The effect would be no different as you can see they are the same values.
The only benefit would be readability, which I agree it should be changed to HAM_SUPERCEDE.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode