Raised This Month: $51 Target: $400
 12% 

Help


Post New Thread Reply   
 
Thread Tools Display Modes
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-18-2010 , 09:08   Re: Help
Reply With Quote #31

to cap the heal, simply register your cvar, and change
PHP Code:
sh_add_hp(attackerdamage0); 
to
PHP Code:
sh_add_hp(attackerdamageget_pcvar_num(YOUR_CVAR_HERE)); 
if you also want to cap the damage dealt to the victim, then replace
PHP Code:
float(sh_get_max_hp(victim)) 
with
PHP Code:
get_pcvar_float(YOUR_CVAR_HERE
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-18-2010 , 09:42   Re: Help
Reply With Quote #32

@Kanatzu: Ah yes I will, I just had an old hero that I used for the code which had Art in it -.-
If I will post this when its done in Off-Topic, your name will be in the title G-Dog (like posting others heroes in the Heroes Section, Hero: Necromonger(G-Dog) )

@G-DogThx G, as always you are fast and precise Though I would need some help with the max range aswell xD Will try it on now though, but ill probably fail
No no, I dont want to cap the damage, its fine, but as I stated in the last post, its kinda OP if you have 100 hp and use it on a guy with 100 and then you get 100 hp if you have more then 200 in max hp... That became pretty long lol xD

I the stuff, thx, but im trying to add a range cvar, and could someone tell me how I get the victims origin?
Im kinda interested how you made no keydowns available when attacked by necro G! As I need it for Icebreaker Also, for the stun, is the "3.0, 75" the time (3.0) and then the speed victim moves with (75)? Icebreaker aswell -.-

EDIT: After even more testing, I found out that the damage and lifesteal's are relative... .If you have 230 hp it goes down to 160, if you have 160 it goes down to 110, then 80, 60, 50 , 40 , 30, 20, 10 then the enemy dies. The heal is also relative. PLEASE learn me or edit how to change that, as its only junk if it is like that xD (No offense G-Dog, I love it, but its soooo damn annoying when you should always steal pcvar_drain and pcvar_pctdmg from victim MAX HEALTH)

So, I dont know if it is possible to fix, but to do it I guess fix get_user_health to make it get the users MAX_HEALTH or whatever. One thing that works is that if your max health is 230, you cant get more hp then 230 by draining. Once again gj on it G-Dog!

PHP Code:
/*Necromonger! Become a Necromonger from the moive Riddick
Copy and past cvars to shconfig
necro_level 10                                 // What level you might transform to a Necromonger
necro_cooldown 20.0                           // How long time until you can use your unholy powers again
necro_pctdmg 0.1                              // How much damage you inflict in percent, 0.1=10% of VICTIM max health
necro_drain 0.1                               // How much life you steal in percent, 0.1=10% of ATTACKER max health
Credits: // Thanks to G-Dog who helped me with the main parts of the code :) and to Kanatzu and Jelle for constant input and testing help.
*/
#include <superheromod>
// GLOBAL VARIABLES
new gHeroID;
new 
gHeroName[] = "Necromonger";
new 
bool:gHasNecro[SH_MAXSLOTS+1];
new 
pcvar_coolpcvar_dmgpcvar_drain;
new 
gSpriteBeam;
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Necromonger""0.2""G-Dog/The Art of War");
    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("necro_level""10");
    
pcvar_cool register_cvar("necro_cooldown""20.0");
    
pcvar_dmg register_cvar("necro_pctdmg""0.1");
    
pcvar_drain register_cvar("necro_drain""0.1");
    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
gHeroID sh_create_hero(gHeroNamepcvarLevel);
    
sh_set_hero_info(gHeroID"Drain Life""Suck the life out of those who deny you!");
    
sh_set_hero_bind(gHeroID);
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
    
gSpriteBeam precache_model("sprites/lgtning.spr");
//----------------------------------------------------------------------------------------------
public sh_hero_init(idheroidmode)
    if ( 
heroid == gHeroID )
        
gHasNecro[id] = mode true false;
//----------------------------------------------------------------------------------------------
public sh_hero_key(idheroIDkey)
{
    if ( 
gHeroID != heroID ) return;
    if ( 
key )    //ya I know, instead of sticking with one method I went with yet another method of checking keydown just to f with yall
    
{
        new 
tidtbody;
        
get_user_aiming(idtidtbody);
 
        if ( 
is_user_alive(tid) && gHasNecro[id] && !gPlayerInCooldown[id] && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )
            
leech_player(tidid);
    }
}
//----------------------------------------------------------------------------------------------
leech_player(victimattacker)
{
    if ( 
sh_is_active() && gHasNecro[attacker] && is_user_alive(victim) )
    {
        
//first lets stun the player, we'll let them move a little cause stoping them all together can get cheap
        
sh_set_stun(victim3.075.0);
 
        
//start the drain loop
        
new args[3]; args[0] = victimargs[1] = attacker
        
args[2] = floatround(floatclamp(get_pcvar_float(pcvar_dmg) * get_user_health(victim) / 10.01.0float(sh_get_max_hp(victim))));
        
set_task(0.3"drain_health"attackerargs3"a"10);        //loops our task to occur 10 times over a 3 second interval
 
        //add some effects
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_BEAMENTS);
        
write_short(attacker);            // start entity
        
write_short(victim);            // entity
        
write_short(gSpriteBeam);    // model
        
write_byte(0);                    // starting frame
        
write_byte(15);                    // frame rate
        
write_byte(30);                    // life in 0.1's   so 30 should = 3 seconds
        
write_byte(40);                    // line width
        
write_byte(4);                    // noise amplitude
        
write_byte(150);                // r, g, b
        
write_byte(0);                // r, g, b
        
write_byte(100);                    // r, g, b
        
write_byte(200);                // brightness
        
write_byte(200);                    // scroll speed
        
message_end();
 
 
 
        
//set our cooldown now, assuming there is one
        
if (get_pcvar_float(pcvar_cool) > 0.0sh_set_cooldown(attackerget_pcvar_float(pcvar_cool));
    }
 
}
//----------------------------------------------------------------------------------------------
public drain_health(args[])
{
    static 
victimattackerdamagevictim args[0]; attacker args[1]; damage args[2];
    if ( !
is_user_alive(victim) || !is_user_alive(attacker) )
    {
        
remove_task(attacker);
        return;
    }
 
    
sh_extra_damage(victimattackerdamage"drain life");
    
sh_add_hp(attackerdamageget_pcvar_num(pcvar_drain));  
 
    
//and finally some kind of sprite effect, for now i'm gonna copy drac and just have the red flash    
    
sh_screen_fade(attacker0.50.25255101040); //Red Screen Flash
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
    
gHasNecro[id] = false;
//---------------------------------------------------------------------------------------------- 
This is the one I used, and no, I didnt changed float to get_pcvar_float , is that the problem? I changed sh_add_hp(attacker, damage, 0); to sh_add_hp(attacker, damage, get_pcvar_num(YOUR_CVAR_HERE)); and both the steal and the damage is relative, so that shouldnt be the problem right?
__________________

Last edited by The Art of War; 03-18-2010 at 11:13.
The Art of War is offline
kanatzu
Veteran Member
Join Date: Oct 2007
Location: Sweden
Old 03-18-2010 , 16:53   Re: Help
Reply With Quote #33

Don't bump anyways. -.-
__________________




Quote:
Originally Posted by wrecked_ View Post
Stop saying words before I sodomize you with a cucumber.
kanatzu is offline
Send a message via MSN to kanatzu
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-18-2010 , 20:49   Re: Help
Reply With Quote #34

no longer based on health at the moment but max health, and fixed so the drain cvar will work as you expect. Or at least based on how you commented it at the top.
PHP Code:
/*Necromonger! Become a Necromonger from the moive Riddick

Copy and past cvars to shconfig
necro_level 10                                 // What level you might transform to a Necromonger
necro_cooldown 20.0                           // How long time until you can use your unholy powers again
necro_pctdmg 0.1                              // How much damage you inflict in percent, 0.1=10% of VICTIM max health
necro_drain 0.1                               // How much life you steal in percent, 0.1=10% of ATTACKER max health

Credits: // Thanks to Random1(G-Dog on allied modders) who helped me with the main parts of the code :) and to Kanatzu and Jelle for constant input and testing help.
*/

#include <superheromod>

#define LOOP_COUNT 10    //how many times does the drain function loop?
#define DRAIN_TIME 3.0    //how long in seconds does the drain effect last?

// GLOBAL VARIABLES
new gHeroID;
new 
gHeroName[] = "Necromonger";
new 
bool:gHasNecro[SH_MAXSLOTS+1];

//pcvars
new pcvar_coolpcvar_dmgpcvar_drain;

//misc
new gSpriteBeam;
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Necromonger""0.3""Random1/The Art of War");
    
    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("necro_level""10");
    
pcvar_cool register_cvar("necro_cooldown""20.0");
    
pcvar_dmg register_cvar("necro_pctdmg""0.1");
    
pcvar_drain register_cvar("necro_drain""0.1");
    
    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
gHeroID sh_create_hero(gHeroNamepcvarLevel);
    
sh_set_hero_info(gHeroID"Drain Life""Suck the life out of those who deny you!");
    
sh_set_hero_bind(gHeroID);
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
    
gSpriteBeam precache_model("sprites/lgtning.spr");
//----------------------------------------------------------------------------------------------
public sh_hero_init(idheroidmode)
    if ( 
heroid == gHeroID )
        
gHasNecro[id] = mode true false;
//----------------------------------------------------------------------------------------------
public sh_hero_key(idheroIDkey)
{
    if ( 
gHeroID != heroID ) return;
    if ( 
key )    //ya I know, instead of sticking with one method I went with yet another method of checking keydown just to f with yall
    
{
        new 
tidtbody;
        
get_user_aiming(idtidtbody);
 
        if ( 
is_user_alive(tid) && gHasNecro[id] && !gPlayerInCooldown[id] && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )
            
leech_player(tidid);
    }
}
//----------------------------------------------------------------------------------------------
leech_player(victimattacker)
{
    if ( 
sh_is_active() && gHasNecro[attacker] && is_user_alive(victim) )
    {
        
//first lets stun the player, we'll let them move a little cause stoping them all together can get cheap
        
sh_set_stun(victimDRAIN_TIME75.0);
 
        
//start the drain loop
        
new args[4], maxhpargs[0] = victimargs[1] = attackermaxhp sh_get_max_hp(victim) / LOOP_COUNT;
        
args[2] = floatround(floatclamp(get_pcvar_float(pcvar_dmg) * maxhp1.0float(maxhp)));
        
args[3] = floatround(floatclamp(get_pcvar_float(pcvar_drain) * sh_get_max_hp(attacker) / LOOP_COUNT1.0float(maxhp)));    //we still clamp with victims max hp cause it makes no sense to gain more hp than you take
        
set_task(DRAIN_TIME/LOOP_COUNT"drain_health"attackerargs4"a"LOOP_COUNT);        //loops our task to occur x times over a 3 second interval
 
        //add some effects
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_BEAMENTS);
        
write_short(attacker);                        // start entity
        
write_short(victim);                        // entity
        
write_short(gSpriteBeam);                   // model
        
write_byte(0);                                // starting frame
        
write_byte(15);                                // frame rate
        
write_byte(floatround(DRAIN_TIME*10));      // life in 0.1's   so 30 should = 3 seconds
        
write_byte(40);                                // line width
        
write_byte(4);                                // noise amplitude
        
write_byte(150);                            // r, g, b
        
write_byte(0);                                // r, g, b
        
write_byte(100);                            // r, g, b
        
write_byte(200);                            // brightness
        
write_byte(200);                            // scroll speed
        
message_end(); 
 
        
//set our cooldown now, assuming there is one
        
if (get_pcvar_float(pcvar_cool) > 0.0sh_set_cooldown(attackerget_pcvar_float(pcvar_cool));
    }
 
}
//----------------------------------------------------------------------------------------------
public drain_health(args[])
{
    static 
victimattackerdamagerecover
    
victim args[0]; attacker args[1]; damage args[2]; recover args[3];
    if ( !
is_user_alive(victim) || !is_user_alive(attacker) )
    {
        
remove_task(attacker);
        return;
    }
 
    
sh_extra_damage(victimattackerdamage"drain life");
    
sh_add_hp(attackerrecover0);  
 
    
//and finally some kind of sprite effect, for now i'm gonna copy drac and just have the red flash    
    
sh_screen_fade(attacker0.50.25255101040); //Red Screen Flash
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
    
gHasNecro[id] = false;
//---------------------------------------------------------------------------------------------- 
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-19-2010 , 04:14   Re: Help
Reply With Quote #35

Awesome as usual, I love you Random1
Compiles nicely will test it even more on my HLDS when I get home Big THX! Though im not very good at it, I see no range cvar or setting; As stated before I would like one, if its too much or not possible, please notify me Otherwise, could someone make it? -.- I will test it in about 2-3 hours when I get back to the HLDS comp, cant test it now, but as stated I cant spot any line that defines anything to do with range except the
PHP Code:
 new tidtbody
        
get_user_aiming(idtidtbody); 
which means unlimited range as long as victim is in attacker's sight/aim
__________________

Last edited by The Art of War; 03-19-2010 at 07:19.
The Art of War is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-19-2010 , 11:26   Re: Help
Reply With Quote #36

so even though the player has to be looking directly at the player you want to add a distance check on top of that? Well anyways here you go
PHP Code:
/*Necromonger! Become a Necromonger from the moive Riddick

Copy and past cvars to shconfig
necro_level 10                            // What level you might transform to a Necromonger
necro_cooldown 20.0                        // How long time until you can use your unholy powers again
necro_pctdmg 0.1                        // How much damage you inflict in percent, 0.1=10% of VICTIM max health
necro_drain 0.1                            // How much life you steal in percent, 0.1=10% of ATTACKER max health
necro_radius 230                        // How close players need to be for attack to work

Credits: // Thanks to Random1(G-Dog on allied modders) who helped me with the main parts of the code :) and to Kanatzu and Jelle for constant input and testing help.
*/

#include <superheromod>

#define LOOP_COUNT 10    //how many times does the drain function loop?
#define DRAIN_TIME 3.0    //how long in seconds does the drain effect last?

// GLOBAL VARIABLES
new gHeroID;
new 
gHeroName[] = "Necromonger";
new 
bool:gHasNecro[SH_MAXSLOTS+1];

//pcvars
new pcvar_coolpcvar_dmgpcvar_drainpcvar_radius;

//misc
new gSpriteBeam;
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Necromonger""0.4""Random1/The Art of War");
    
    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("necro_level""10");
    
pcvar_cool register_cvar("necro_cooldown""20.0");
    
pcvar_dmg register_cvar("necro_pctdmg""0.1");
    
pcvar_drain register_cvar("necro_drain""0.1");
    
pcvar_radius register_cvar("necro_radius""240");
    
    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
gHeroID sh_create_hero(gHeroNamepcvarLevel);
    
sh_set_hero_info(gHeroID"Drain Life""Suck the life out of those who deny you!");
    
sh_set_hero_bind(gHeroID);
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
    
gSpriteBeam precache_model("sprites/lgtning.spr");
//----------------------------------------------------------------------------------------------
public sh_hero_init(idheroidmode)
    if ( 
heroid == gHeroID )
        
gHasNecro[id] = mode true false;
//----------------------------------------------------------------------------------------------
public sh_hero_key(idheroIDkey)
{
    if ( 
gHeroID != heroID || !gHasNecro[id] || gPlayerInCooldown[id] ) return;
    if ( 
key )    //ya I know, instead of sticking with one method I went with yet another method of checking keydown just to f with yall
    
{
        new 
tidtbody;
        
get_user_aiming(idtidtbody);
        
        new 
origin[3], origin2[3];
        
get_user_origin(idorigin);
        
get_user_origin(tidorigin2);
        
        if ( 
get_distance(originorigin2) < get_pcvar_num(pcvar_radius) )
            if ( 
is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )
                
leech_player(tidid);
    }
}
//----------------------------------------------------------------------------------------------
leech_player(victimattacker)
{
    if ( 
sh_is_active() && gHasNecro[attacker] && is_user_alive(victim) )
    {
        
//first lets stun the player, we'll let them move a little cause stoping them all together can get cheap
        
sh_set_stun(victimDRAIN_TIME75.0);
 
        
//start the drain loop
        
new args[4], maxhpargs[0] = victimargs[1] = attackermaxhp sh_get_max_hp(victim) / LOOP_COUNT;
        
args[2] = floatround(floatclamp(get_pcvar_float(pcvar_dmg) * maxhp1.0float(maxhp)));
        
args[3] = floatround(floatclamp(get_pcvar_float(pcvar_drain) * sh_get_max_hp(attacker) / LOOP_COUNT1.0float(maxhp)));    //we still clamp with victims max hp cause it makes no sense to gain more hp than you take
        
set_task(DRAIN_TIME/LOOP_COUNT"drain_health"attackerargs4"a"LOOP_COUNT);        //loops our task to occur x times over a 3 second interval
 
        //add some effects
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_BEAMENTS);
        
write_short(attacker);                        // start entity
        
write_short(victim);                        // entity
        
write_short(gSpriteBeam);                   // model
        
write_byte(0);                                // starting frame
        
write_byte(15);                                // frame rate
        
write_byte(floatround(DRAIN_TIME*10));      // life in 0.1's   so 30 should = 3 seconds
        
write_byte(40);                                // line width
        
write_byte(4);                                // noise amplitude
        
write_byte(150);                            // r, g, b
        
write_byte(0);                                // r, g, b
        
write_byte(100);                            // r, g, b
        
write_byte(200);                            // brightness
        
write_byte(200);                            // scroll speed
        
message_end(); 
 
        
//set our cooldown now, assuming there is one
        
if (get_pcvar_float(pcvar_cool) > 0.0sh_set_cooldown(attackerget_pcvar_float(pcvar_cool));
    }
}
//----------------------------------------------------------------------------------------------
public drain_health(args[])
{
    static 
victimattackerdamagerecover
    
victim args[0]; attacker args[1]; damage args[2]; recover args[3];
    if ( !
is_user_alive(victim) || !is_user_alive(attacker) )
    {
        
remove_task(attacker);
        return;
    }
 
    
sh_extra_damage(victimattackerdamage"drain life");
    
sh_add_hp(attackerrecover0);  
 
    
//and finally some kind of sprite effect, for now i'm gonna copy drac and just have the red flash    
    
sh_screen_fade(attacker0.50.25255101040); //Red Screen Flash
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
    
gHasNecro[id] = false;
//---------------------------------------------------------------------------------------------- 
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-19-2010 , 11:59   Re: Help
Reply With Quote #37

That is fully correct, I just tested it in my HLDS, based on max health as stated, AWESOME!! Yes, as I tried it in a awp map, range is truly unlimited, and as it stuns it might be too OP with both stun and unlimited range. AWESOME!
__________________
The Art of War is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 03-19-2010 , 14:26   Re: Help
Reply With Quote #38

I thought you wanted to hit every person in a specific radius when you press the power key.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-19-2010 , 14:59   Re: Help
Reply With Quote #39

That is Icebreaker, the other one
And cool, didnt knew that sh_set_stun makes blocks keydowns.
__________________
The Art of War is offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 03-19-2010 , 15:26   Re: Help
Reply With Quote #40

explained in superheromod.inc
Fr33m@n 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 01:48.


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