@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_cool, pcvar_dmg, pcvar_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(gHeroName, pcvarLevel);
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(id, heroid, mode)
if ( heroid == gHeroID )
gHasNecro[id] = mode ? true : false;
//----------------------------------------------------------------------------------------------
public sh_hero_key(id, heroID, key)
{
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 tid, tbody;
get_user_aiming(id, tid, tbody);
if ( is_user_alive(tid) && gHasNecro[id] && !gPlayerInCooldown[id] && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )
leech_player(tid, id);
}
}
//----------------------------------------------------------------------------------------------
leech_player(victim, attacker)
{
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(victim, 3.0, 75.0);
//start the drain loop
new args[3]; args[0] = victim; args[1] = attacker;
args[2] = floatround(floatclamp(get_pcvar_float(pcvar_dmg) * get_user_health(victim) / 10.0, 1.0, float(sh_get_max_hp(victim))));
set_task(0.3, "drain_health", attacker, args, 3, "a", 10); //loops our task to occur 10 times over a 3 second interval
//add some effects
message_begin(MSG_BROADCAST, SVC_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.0) sh_set_cooldown(attacker, get_pcvar_float(pcvar_cool));
}
}
//----------------------------------------------------------------------------------------------
public drain_health(args[])
{
static victim, attacker, damage; victim = args[0]; attacker = args[1]; damage = args[2];
if ( !is_user_alive(victim) || !is_user_alive(attacker) )
{
remove_task(attacker);
return;
}
sh_extra_damage(victim, attacker, damage, "drain life");
sh_add_hp(attacker, damage, get_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(attacker, 0.5, 0.25, 255, 10, 10, 40); //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?
__________________